Object Hierarchy | 関連する C++クラス:ImageClip2
ImageClip
v2.0
ImageClip オブジェクトはイメージSourceのインスタンスを表し、ディスク上に保存されているイメージへのリファレンスにもなります。イメージ クリップとイメージのソースは、イメージを FxTree に導入する手段、または Shader に影響を及ぼすテクスチャとして使用されます。イメージ クリップは AddImageClip または CreateImageClip を呼び出して作成します。
ファイルのパスや解像度などの重要な情報は、イメージSourceのParameterとして保存され、Clip.Sourceを呼び出して取得します。イメージのピクセル値を読み取るには、ImageClip.GetImageを呼び出します。
'
' This example illustrates how to create an ImageClip object and connect it
' as the source of an image texture.
'
NewScene , false
set oImage = AddImageSource( "$SI_HOME\Data\XSI_SAMPLES\Pictures\jio.jpg" )
set oImageClip = AddImageClip( oImage )
set oSphere = ActiveSceneRoot.AddGeometry( "Sphere", "MeshSurface" )
set oMaterial = oSphere.AddMaterial("Phong")
set oPhong = oMaterial.Shaders( "Phong" )
set oColor8Mix1 = oPhong.ambient.ConnectFromProgID("Softimage.sib_color_8mix.1")
set oColor8Mix2 = oPhong.diffuse.ConnectFromProgID("Softimage.sib_color_8mix.1")
set oTex2D = oColor8Mix1.color1.ConnectFromProgID("Softimage.txt2d-image-explicit.1")
call oColor8Mix2.color1.Connect(oTex2D)
set oTex2D.tex.Source = oImageClip |
/*
This example illustrates how to retrieve the image file name used for the texture of
an object. It also illustrates how to retrieve the x and y resolution of that image.
*/
var oCube = CreatePrim("Cube", "MeshSurface", null, null);
ApplyShader(null, null, null, siUnspecified, siLetLocalMaterialsOverlap);
CreateProjection("cube", siTxtSpherical, siTxtDefaultSpherical, "",
"Texture_Projection", null, siRelDefault, "");
BlendInPresetsInsp(null, null, null, true, siReplaceAndBlendInPreset, null, null, null, null);
var oImageClip = oCube.Material.CurrentImageClip;
var oImageSource = oImageClip.Source;
LogMessage("The image filename is " + oImageSource.Parameters("FileName").Value);
LogMessage("The image x resolution is " + oImageSource.Parameters("XRes").Value);
LogMessage("The image y resolution is " + oImageSource.Parameters("YRes").Value);
// Expected result:
//INFO : "The image filename is <$factory>\Application\rsrc\noIcon.pic"
//INFO : "The image x resolution is 256"
//INFO : "The image y resolution is 256" |