Class SoTextureCubeMap
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.misc.SoBase
-
- com.openinventor.inventor.fields.SoFieldContainer
-
- com.openinventor.inventor.nodes.SoNode
-
- com.openinventor.inventor.nodes.SoTexture
-
- com.openinventor.inventor.nodes.SoTextureCubeMap
-
- All Implemented Interfaces:
SafeDisposable
public class SoTextureCubeMap extends SoTexture
Cube texture mapping node. Cube map textures provide a new texture generation scheme for looking up textures from a set of six two-dimensional images representing the faces of a cube. The (s,t,r) texture coordinates are treated as a direction vector emanating from the center of a cube. At texture generation time, the interpolated per-fragment (s,t,r) selects one cube face two-dimensional image based on the largest magnitude coordinate (the major axis). A new (s,t) is calculated by dividing the two other coordinates (the minor axes values) by the major axis value, and the new (s,t) is used to lookup into the selected two-dimensional texture image face of the cube map.Cube map textures are often used within shader programs to implement effects such as reflection or refraction.
There are three ways to send the texture to Open Inventor:
- The textures can be read from six image files specified in the
filenames
field. - Textures can be specified in memory by setting the image fields (
imagePosX
, ...) to contain the texture data. Doing so resets thefilenames
field to the empty string. - Textures can be rendered from a scene graph using the renderToTextureProperty field.
But in all cases, the images must be specified in the following order:
- imagePosX (left)
- imagePosY (bottom)
- imagePosZ (back)
- imageNegX (right)
- imageNegY (top)
- imageNegZ (front)
The
SoTextureCoordinateReflectionMap
node can be used to automatically generate appropriate texture coordinates for cube mapping.If the texture image's width or height is not a power of 2, and the Non Power Of Two (NPOT) extension is available on your graphics board, by default Open Inventor will send the image to OpenGL without modification. See
SoTexture2
for a complete discussion of this feature.Transparency Texture images can contain transparency (alpha values less than 1) and modify the transparency of geometry in the scene. Also note that some image file formats, for example JPEG, do not support transparency information (alpha channel).
Limitations:
- Since Open Inventor 10.0.0 Alpha 2 it is no longer possible to fill a
SoTextureCubeMap
with textures in different formats or sizes. All six textures must have the same format and size. If these conditions are not met, an error message is displayed (in debug) and nothing is changed on the state.
EXAMPLE SoInput.addDirectoryFirst( "/ImageDirectory" ); String[] faceFile = { "left.jpg", "bottom.jpg", "back.jpg", "right.jpg", "top.jpg", "front.jpg", }; SoTextureCubeMap texture = new SoTextureCubeMap(); for (int i = 0; i < 6; ++i) { texture.filenames.set1Value( i, faceFile[i] ); } root.addChild( new SoTextureCoordinateReflectionMap() ); root.addChild( texture ); root.addChild( geometry ); File format/default:
TextureCubeMap {
filenames "" imagePosX 0 0 0 imageNegX 0 0 0 imagePosY 0 0 0 imageNegY 0 0 0 imagePosZ 0 0 0 imageNegZ 0 0 0 wrapS REPEAT wrapT REPEAT wrapR REPEAT enableCompressedTexture false model MODULATE blendColor 0 0 0 enableBorder false borderColor 0 0 0 0 maxAnisotropy 1.0 minFilter AUTO magFilter AUTO useAutoMipmap false internalFormat AUTO_INTERNAL_FORMAT Action behavior:
SoGLRenderAction
,SoCallbackAction
Sets current texture in state.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.openinventor.inventor.nodes.SoTexture
SoTexture.FileTypes, SoTexture.Filters, SoTexture.HW_Features, SoTexture.InternalFormats, SoTexture.Models, SoTexture.WrapType
-
Nested classes/interfaces inherited from class com.openinventor.inventor.nodes.SoNode
SoNode.RenderModes
-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
Fields Modifier and Type Field Description SoMFFilePathString
filenames
Names file(s) from which to read texture image(s).SoSFFloat
HDRIExposure
Specifies an exposure factor when using an HDRI file.SoSFImage
imageNegX
SeeimagePosX
.SoSFImage
imageNegY
SeeimagePosX
.SoSFImage
imageNegZ
SeeimagePosX
.SoSFImage
imagePosX
Contains an in-memory representation of the texture map.SoSFImage
imagePosY
SeeimagePosX
.SoSFImage
imagePosZ
SeeimagePosX
.SoSFNode
renderToTextureProperty
Specifies anSoRenderToTextureProperty
node containing a scene graph that will be rendered to create the texture image.SoSFEnum<SoTexture.WrapType>
wrapR
Indicates what to do when texture coordinates in the R (depth) direction lie outside the range 0-1.SoSFEnum<SoTexture.WrapType>
wrapT
Indicates what to do when texture coordinates in the T (vertical) direction lie outside the range 0-1.-
Fields inherited from class com.openinventor.inventor.nodes.SoTexture
blendColor, borderColor, enableBorder, enableCompressedTexture, internalFormat, magFilter, maxAnisotropy, minFilter, model, wrapS
-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Constructor Summary
Constructors Constructor Description SoTextureCubeMap()
Creates a texture node with default settings.
-
Method Summary
-
Methods inherited from class com.openinventor.inventor.nodes.SoTexture
getBitmapFileType, isSupported, readTexture, readTexture, setBitmapFileType
-
Methods inherited from class com.openinventor.inventor.nodes.SoNode
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderEngineMode, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
-
Methods inherited from class com.openinventor.inventor.fields.SoFieldContainer
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
-
Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable
-
Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
-
-
-
Field Detail
-
filenames
public final SoMFFilePathString filenames
Names file(s) from which to read texture image(s). The standard image file formats are supported. SeeSoRasterImageRW
for the list. If the first file is an HDRI file, only this file is used since it has all 6 faces encoded. If the filename is not an absolute path name, the list of directories maintained bySoInput
is searched. If the texture is not found in any of those directories, then the file is searched for relative to the directory from which theSoTextureCubeMap
node was read. For example, if anSoTextureCubeMap
node with a filename of "../tofu.rgb" is read from /usr/people/bob/models/food.iv, then /usr/people/bob/tofu.rgb will be read (assuming tofu.rgb isn't found in the directories maintained bySoInput
).
-
imagePosX
public final SoSFImage imagePosX
-
wrapT
public final SoSFEnum<SoTexture.WrapType> wrapT
Indicates what to do when texture coordinates in the T (vertical) direction lie outside the range 0-1. . Default is REPEAT.
-
wrapR
public final SoSFEnum<SoTexture.WrapType> wrapR
Indicates what to do when texture coordinates in the R (depth) direction lie outside the range 0-1. . Default is REPEAT.
-
renderToTextureProperty
public final SoSFNode renderToTextureProperty
Specifies anSoRenderToTextureProperty
node containing a scene graph that will be rendered to create the texture image. The scene is rendered into a Pbuffer and then directly bound or copied into texture memory. Null by default.- Since:
- Open Inventor 6.0
-
HDRIExposure
public final SoSFFloat HDRIExposure
Specifies an exposure factor when using an HDRI file. 1.0 by default.
-
-