#X3D V3.2 utf8 PROFILE Interchange COMPONENT Texturing:2 COMPONENT CADGeometry:1 # Test MultiTexture together with IndexedQuadSet from CAD component. # This is very similar to transform_and_coordinates_faces.x3dv # (in fact the result should look *exactly* the same) # but now uses IndexedQuadSet instead of IndexedFaceSet. # ---------------------------------------------------------------------------- # Use MultiTexture with 1 texture, normal TextureTransform and TextureCoordinate. # Should look just normal, like without multitexturing. # Texture transform will be ignored. Shape { appearance Appearance { texture MultiTexture { texture ImageTexture { url "data/squirrel.png" } } # This texture transform will be ignored: X3D spec says that # # "If using a MultiTexture node with a geometry node without # a MultiTextureTransform node, identity matrices are assumed # for all channels." # # IOW, direct TextureTransform is ignored when using MultiTexture. # Only MultiTextureTransform is taken into account. textureTransform TextureTransform { scale 2 2 } material Material { } } geometry IndexedQuadSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 0, 0 2 0, 1 2 0, 1 3 0, 0 3 0 ] } index [ 0 1 2 3, 4 5 6 7 ] texCoord TextureCoordinate { point [ 0 0, 1 0, 1 1, 0 1, 0 0, 1 0, 1 1, 0 1, ] } solid FALSE } } # ---------------------------------------------------------------------------- # Use MultiTexture, MultiTextureTransform, MultiTextureCoordinate with 1 texture. # Should look just normal, like without multitexturing. Transform { translation 2 0 0 children Shape { appearance Appearance { texture MultiTexture { texture ImageTexture { url "data/squirrel.png" } } textureTransform MultiTextureTransform { textureTransform TextureTransform { scale 2 2 } } material Material { } } geometry IndexedQuadSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 0, 0 2 0, 1 2 0, 1 3 0, 0 3 0 ] } index [ 0 1 2 3, 4 5 6 7 ] texCoord MultiTextureCoordinate { texCoord TextureCoordinate { point [ 0 0, 1 0, 1 1, 0 1, 0 0, 1 0, 1 1, 0 1, ] } } solid FALSE } } } # ---------------------------------------------------------------------------- # Simple 2 textures test. Transform { translation 4 0 0 children Shape { appearance Appearance { texture MultiTexture { texture [ ImageTexture { url "data/squirrel.png" } ImageTexture { url "data/bricks.jpg" } ] } # This TextureTransform *should* be ignored (that is, both # texture units should have idenity transform) following X3D spec: # "If using a MultiTexture node with a geometry node without # a MultiTextureTransform node, identity matrices are assumed for all channels." textureTransform TextureTransform { scale 2 2 } material Material { } } geometry IndexedQuadSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 0, 0 2 0, 1 2 0, 1 3 0, 0 3 0 ] } index [ 0 1 2 3, 4 5 6 7 ] texCoord TextureCoordinate { point [ 0 0, 1 0, 1 1, 0 1, 0 0, 1 0, 1 1, 0 1, ] } solid FALSE } } } # ---------------------------------------------------------------------------- # Simple 2 textures with different transforms test. Transform { translation 6 0 0 children Shape { appearance Appearance { texture MultiTexture { texture [ ImageTexture { url "data/squirrel.png" } ImageTexture { url "data/bricks.jpg" } ] } textureTransform MultiTextureTransform { textureTransform [ TextureTransform { scale 2 2 } TextureTransform { scale 4 4 } ] } material Material { } } geometry IndexedQuadSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 0, 0 2 0, 1 2 0, 1 3 0, 0 3 0 ] } index [ 0 1 2 3, 4 5 6 7 ] texCoord TextureCoordinate { point [ 0 0, 1 0, 1 1, 0 1, 0 0, 1 0, 1 1, 0 1, ] } solid FALSE } } } # ---------------------------------------------------------------------------- # Simple 2 textures with different coords test. # Brick texture will be unnaturally stretched vertically. Transform { translation 8 0 0 children Shape { appearance Appearance { texture MultiTexture { texture [ ImageTexture { url "data/squirrel.png" } ImageTexture { url "data/bricks.jpg" } ] } textureTransform MultiTextureTransform { textureTransform [ TextureTransform { scale 2 2 } ] } material Material { } } geometry IndexedQuadSet { coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0 1 0, 0 2 0, 1 2 0, 1 3 0, 0 3 0 ] } index [ 0 1 2 3, 4 5 6 7 ] texCoord MultiTextureCoordinate { texCoord [ TextureCoordinate { point [ 0 0, 1 0, 1 1, 0 1, 0 0, 1 0, 1 1, 0 1, ] } TextureCoordinate { point [ 0 0.8, 1 0.8, 1 1, 0 1, 0 0.8, 1 0.8, 1 1, 0 1, ] } ] } solid FALSE } } } # Viewpoint ------------------------------------------------------------------ # Camera settings "encoded" in the VRML/X3D declaration below : # direction 0 0 -1 # up 0 1 0 # gravityUp 0 1 0 Viewpoint { position 4.5 1.5 9.4200115203857422 orientation 0 0 1 0 }