H3D API
2.4.1
|
The Pixel3DTexture node defines a 3D image-based texture map as an explicit array of pixel values (image field) and parameters controlling tiling repetition of the texture onto geometry. More...
#include <H3D/Pixel3DTexture.h>
Public Member Functions | |
Pixel3DTexture (Inst< DisplayList > _displayList=0, Inst< SFNode > _metadata=0, Inst< SFBool > _repeatS=0, Inst< SFBool > _repeatT=0, Inst< SFBool > _repeatR=0, Inst< SFBool > _scaleToP2=0, Inst< SFImage > _image=0, Inst< SFTextureProperties > _textureProperties=0) | |
Constructor. | |
virtual Node * | clone (bool deepCopy=true, DeepCopyMap *deepCopyMap=NULL) |
Returns a new instance of this node type with the same state as this one. More... | |
![]() | |
X3DTexture3DNode (Inst< DisplayList > _displayList=0, Inst< SFNode > _metadata=0, Inst< SFBool > _repeatS=0, Inst< SFBool > _repeatT=0, Inst< SFBool > _repeatR=0, Inst< SFBool > _scaleToP2=0, Inst< SFImage > _image=0, Inst< SFTextureProperties > _textureProperties=0, Inst< UpdateSaveToURL > _saveToUrl=0, Inst< SFBool > _saveSuccess=0, Inst< SFInt32 > _saveHeight=0, Inst< SFInt32 > _saveWidth=0) | |
Constructor. | |
virtual void | render () |
Performs the OpenGL rendering required to install the image as a texture. | |
virtual void | renderTextureProperties () |
Render all OpenGL texture properties. | |
virtual GLint | glInternalFormat (Image *_image) |
Returns the internal OpenGL format to use given an Image. | |
virtual void | enableTexturing () |
Virtual function for making all OpenGL calls that are needed to enable texturing for the texture. | |
virtual void | disableTexturing () |
Virtual function for making all OpenGL calls that are needed to disable texturing for the texture. | |
virtual GLuint64 | getTextureHandle () |
Get the bindless texture handle. | |
virtual Vec3f | textureSize () |
Sometimes the texture represents a volume in space, e.g. More... | |
virtual void | glTexImage (Image *_image, GLenum _texture_target, bool scale_to_power_of_two) |
Installs the given image as a OpenGL texture with a call to the glTexImage3D function. More... | |
virtual void | renderSubImage (Image *_image, GLenum _texture_target, int xoffset, int yoffset, int z_offset, int width, int height, int depth) |
Replaces part of the current texture from an image. | |
virtual void | setTextureWidth (int _width) |
Set the texture width. | |
virtual void | setTextureHeight (int _height) |
Set the texture height. | |
virtual void | setTextureDepth (int _depth) |
Set the texture depth. | |
virtual GLenum | glPixelFormat (Image *_image) |
Returns the OpenGL pixel format to use given an Image, e.g. | |
![]() | |
H3DSingleTextureNode (Inst< DisplayList > _displayList=0, Inst< SFNode > _metadata=0, Inst< UpdateSaveToURL > _saveToUrl=0, Inst< SFBool > _saveSuccess=0, Inst< SFInt32 > _saveHeight=0, Inst< SFInt32 > _saveWidth=0) | |
Constructor. | |
virtual | ~H3DSingleTextureNode () |
Destructor. | |
virtual GLuint | getTextureId () |
Get the OpenGL texture id that is used for this texture. | |
virtual GLuint | getTextureUnit () |
Get the OpenGL texture unit that is used for this texture. | |
virtual GLenum | getTextureTarget () |
Get the OpenGL texture target that is used for this texture. | |
virtual int | getTextureWidth () |
Get the texture width. | |
virtual int | getTextureHeight () |
Get the texture height. | |
virtual int | getTextureDepth () |
Get the texture depth. | |
virtual void | setTextureId (GLuint _id) |
Set the OpenGL texture id that is used for this texture. | |
virtual void | setTextureUnit (GLint unit) |
Set the OpenGL texture unit that is used for this texture. | |
virtual void | setTextureTarget (GLenum target) |
Set the OpenGL texture target that is used for this texture. | |
virtual bool | makeResident () |
{ Bindless texturing functions More... | |
virtual void | makeNonResident () |
Make the texture non-resident. | |
virtual bool | isResident () |
Returns true if the texture is resident in GPU memory or false otherwise. | |
virtual void | invalidateTextureHandle () |
This should be called if the texture object is to be replaced. More... | |
void | addShaderField (Field &_field) |
Add a shader field which contains this texture node. More... | |
void | removeShaderField (Field &_field) |
Remove a shader field which contains this texture node. More... | |
virtual void | inUse () |
Call to signify that this texture is currently in use. More... | |
![]() | |
X3DTextureNode (Inst< DisplayList > _displayList=0, Inst< SFNode > _metadata=0, Inst< UpdateSaveToURL > _saveToUrl=0, Inst< SFBool > _saveSuccess=0, Inst< SFInt32 > _saveHeight=0, Inst< SFInt32 > _saveWidth=0) | |
Constructor. | |
virtual string | defaultXMLContainerField () |
Returns the default xml containerField attribute value. More... | |
virtual void | preRender () |
This function will be called by the X3DShapeNode before any rendering of geometry and before the call to the render function. | |
virtual void | postRender () |
This function will be called by the X3DShapeNode after the geometry has been rendered to restore the states to what it was before the call to preRender(). | |
virtual GLbitfield | getAffectedGLAttribs () |
Returns a bitmask of the OpenGL attrib bits that will be affected by this node. More... | |
virtual GLuint | renderImage (Image *image, GLenum texture_target, bool scale_to_power_of_two) |
Installs the image as a OpenGL texture. More... | |
virtual GLenum | glPixelComponentType (Image *image) |
Returns the OpenGL pixel compnent type to use given an Image, e.g. More... | |
virtual Image * | renderToImage (H3DInt32 _width, H3DInt32 _height, bool output_float_texture=false) |
Create a new Image object which contains the result of rendering this texture. More... | |
![]() | |
X3DAppearanceChildNode (Inst< DisplayList > _displayList=0, Inst< SFNode > _metadata=0) | |
Constructor. | |
![]() | |
X3DNode (Inst< SFNode > _metadata=0) | |
Constructor. | |
X3DMetadataObject * | getMetadataByName (const string &_name) |
Given a name, the first X3DMetadataObject in the metadata field that matches that name is returned. More... | |
![]() | |
Node () | |
Constructor. | |
virtual | ~Node () |
Destructor. | |
X3DPrototypeInstance * | getProtoInstanceParent () |
If this node is the root node in the proto body of a X3DPrototypeInstance then this will return that node. More... | |
void | setProtoInstanceParent (X3DPrototypeInstance *p) |
Set the X3DPrototypeInstance this node is the the root node if applicaple. | |
virtual void | traverseSG (TraverseInfo &ti) |
traverseSG is called once per scenegraph loop on the scene in order to traverse the scenegraph. More... | |
virtual bool | lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result) |
Detect intersection between a line segment and the Node. More... | |
virtual void | closestPoint (const Vec3f &p, NodeIntersectResult &result) |
Find closest point on Node to p. More... | |
virtual bool | movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result) |
Detect collision between a moving sphere and the Node. More... | |
virtual Field * | getField (const string &_name) const |
return a pointer to the field specified by name within this instance | |
int | addDestructCallback (void(*func)(Node *, void *), void *args) |
Add a callback function to be run on destruction of node. More... | |
int | removeDestructCallback (void(*func)(Node *, void *), void *args) |
Add a callback function to be run on destruction of node. More... | |
![]() | |
H3DDisplayListObject (Inst< DisplayList > _displayList=0) | |
Constructor. | |
![]() | |
H3DImageObject (Inst< SFImage > _image=0) | |
Constructor. | |
Static Public Attributes | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
![]() | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
![]() | |
static bool | load_images_in_separate_thread = true |
This is the default value for the GlobalSettings::loadTexturesInThread field. More... | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
![]() | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
Additional Inherited Members | |
![]() | |
typedef DependentSFNode< FieldRef< TextureProperties, Field, &TextureProperties::propertyChanged > > | SFTextureProperties |
The SFTextureProperties is dependent on the propertyChanged field of the contained TextureProperties. | |
![]() | |
typedef std::map< Node *, Node * > | DeepCopyMap |
A map type used during a deep copy clone() to map from original nodes to cloned nodes. | |
![]() | |
static void | makeUnusedTexturesNonResident (H3DTime _unusedTime) |
Look at all resident textures and make those that have not been used recently non-resident. More... | |
![]() | |
static X3DTextureNode * | getActiveTexture () |
Gets the currently active texture, i.e. More... | |
static void | setActiveTexture (X3DTextureNode *t) |
Set the active texture. More... | |
![]() | |
static unsigned int | nrNodesAlive () |
Returns the nr of nodes currently alive, i.e. nodes created but not destructed. | |
static int | nrNodesCreated () |
Returns the number of nodes created in total since the start of the program. | |
![]() | |
H3DUniquePtr< SFBool > | repeatS |
If true the texture will repeat itself when the s texture coordinate is outside the range [0,1]. More... | |
H3DUniquePtr< SFBool > | repeatT |
If true the texture will repeat itself when the t texture coordinate is outside the range [0,1]. More... | |
H3DUniquePtr< SFBool > | repeatR |
If true the texture will repeat itself when the r texture coordinate is outside the range [0,1]. More... | |
H3DUniquePtr< SFBool > | scaleToPowerOfTwo |
If true the image used will be scaled so that the dimensions are a power of two if they are not. More... | |
H3DUniquePtr< SFTextureProperties > | textureProperties |
The textureProperties field contains a TextureProperties node which allows fine control over a texture's application. More... | |
![]() | |
H3DUniquePtr< UpdateSaveToURL > | saveToUrl |
When a new value is specified for saveToUrl the current texture is rendered to a buffer and saved to the specified filename. More... | |
H3DUniquePtr< SFBool > | saveSuccess |
Contains the result of the last save operation. More... | |
H3DUniquePtr< SFInt32 > | saveHeight |
The height of the image to write to file when the saveToUrl field is used. More... | |
H3DUniquePtr< SFInt32 > | saveWidth |
The width of the image to write to file when the saveToUrl field is used. More... | |
![]() | |
H3DUniquePtr< SFNode > | metadata |
Meta data about the node. More... | |
![]() | |
H3DUniquePtr< DisplayList > | displayList |
The DisplayList instance handling the OpenGL caching of this object. | |
![]() | |
H3DUniquePtr< SFImage > | image |
Field containing the Image to use as a texture. | |
![]() | |
typedef std::vector< H3DSingleTextureNode * > | TextureVector |
} | |
![]() | |
virtual std::pair< H3DInt32, H3DInt32 > | getDefaultSaveDimensions () |
Returns the default dimensions to use when this texture is saved to file. More... | |
![]() | |
GLint | glCompressedInternalFormat (GLint _format, const std::string &_compression) |
Given a non-compressed internal format, return an equivelent compressed format based on the compression settings. More... | |
![]() | |
void | cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for the clone() method. More... | |
![]() | |
static Node * | getClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for nodes that implement clone() More... | |
![]() | |
H3DUniquePtr< Field > | imageUpdated |
Field to indicate image changed C++ only field. | |
H3DUniquePtr< Field > | textureUpdated |
Field which is used to trigger an update of the texture when it has been modified through some functions. More... | |
H3DUniquePtr< UpdateTextureProperties > | updateTextureProperties |
Field that will make sure that the texture properties changes are transferred to the texture when changed. More... | |
![]() | |
GLuint64 | texture_handle |
The texture handle (GPU) | |
GLuint | texture_id |
The OpenGL texture id of the installed texture, 0 if not installed. | |
GLint | texture_unit |
The OpenGL texture unit that is used to render this texture. More... | |
GLenum | texture_target |
The OpenGL texture target that is used to render this texture. | |
int | texture_width |
texture width | |
int | texture_height |
texture height | |
int | texture_depth |
texture depth | |
Field::FieldVector | shader_fields |
Shader fields which contain this texture. | |
H3DTime | last_used |
Time-stamp at which this texture was last used. | |
bool | is_resident |
True if this texture is currently resident. | |
![]() | |
static TextureVector | resident_textures |
List of all currently resident textures. | |
The Pixel3DTexture node defines a 3D image-based texture map as an explicit array of pixel values (image field) and parameters controlling tiling repetition of the texture onto geometry.
The image field describes the raw data to be used for this 3D texture. The first value of the array is the number of components to the image and shall be a value between 0 and 4. The following three numbers are the size of the texture: width, height and depth, respectively. The remaining values of the array are treated as the pixels for the image. There shall be at least width × height × depth number of pixel values provided. Each of the width, height and depth are required to be a power of 2 unless scaleToPowerOfTwo is TRUE.
The repeatS, repeatT and repeatR fields specify how the texture wraps in the S, T and R directions. If repeatS is TRUE (the default), the texture map is repeated outside the 0-to-1 texture coordinate range in the S direction so that it fills the shape. If repeatS is FALSE, the texture coordinates are clamped in the S direction to lie within the 0.0 to 1.0 range. The repeatT and repeatR fields are analogous to the repeatS field.
Pixel values are limited to 256 levels of intensity (i.e., 0-255 decimal or 0x00-0xFF hexadecimal). A one-component image specifies one-byte hexadecimal or integer values representing the intensity of the image. For example, 0xFF is full intensity in hexadecimal (255 in decimal), 0x00 is no intensity (0 in decimal). A two-component image specifies the intensity in the first (high) byte and the alpha opacity in the second (low) byte. Pixels in a three-component image specify the red component in the first (high) byte, followed by the green and blue components (e.g., 0xFF0000 is red, 0x00FF00 is green, 0x0000FF is blue). Four-component images specify the alpha opacity byte after red/green/blue (e.g., 0x0000FF80 is semi-transparent blue). A value of 0x00 is completely transparent, 0xFF is completely opaque. Note that alpha equals (1.0 - transparency), if alpha and transparency range from 0.0 to 1.0. Each pixel is read as a single unsigned number. For example, a 3-component pixel with value 0x0000FF may also be written as 0xFF (hexadecimal) or 255 (decimal). Pixels are specified from left to right, bottom to top. The first hexadecimal value is the lower left pixel and the last value is the upper right pixel.
is a 1 pixel wide by 2 pixel high by one pixel deep one-component (i.e., greyscale) image, with the bottom pixel white and the top pixel black.
Examples:
|
virtual |
Returns a new instance of this node type with the same state as this one.
Overridden in order to correctly copy the image as a string
deepCopy | If true then references to other nodes will also be cloned. Otherwise just the pointer is copied. |
deepCopyMap | A map from original nodes to their cloned versions. This parameter is normally not required by the root caller, but is passed down the call graph to ensure that nodes that appear multiple times will be assigned the same clone. |
Reimplemented from H3D::Node.
References H3D::Node::clone(), and H3D::H3DImageObject::image.