Skip to content

Instantly share code, notes, and snippets.

@cecilemuller
Last active December 15, 2015 20:19
Show Gist options
  • Save cecilemuller/5317383 to your computer and use it in GitHub Desktop.
Save cecilemuller/5317383 to your computer and use it in GitHub Desktop.
X3D: MultiTexture (2 textures)
#X3D V3.1 utf8
PROFILE Immersive
PROTO Square [
exposedField SFVec3f translation 0 0 0
exposedField MFNode texture []
exposedField MFString mode []
exposedField MFString function []
exposedField MFString source []
]{
Transform {
translation IS translation
children Shape {
appearance Appearance {
texture MultiTexture {
# Warning: this field is non-standard but Contact needs this
# when the result is meant to have transparency
transparent TRUE
texture IS texture
mode IS mode
function IS function
source IS source
}
}
geometry IndexedFaceSet {
coordIndex [0 1 2 3 0 -1]
coord Coordinate {
point [-1 -1 0, 1 -1 0, 1 1 0, -1 1 0]
}
texCoord MultiTextureCoordinate {
coord [
TextureCoordinate {point [0 0, 1 0, 1 1, 0 1]}
TextureCoordinate {point [0 0, 2 0, 2 2, 0 2]}
]
}
}
}
}
}
PROTO Modes [
exposedField SFVec3f translation 0 0 0
exposedField MFNode texture []
exposedField MFString function []
exposedField MFString source []
]{
Transform {
translation IS translation
children [
Square {
translation 0 0 0
texture IS texture
function IS function
source IS source
}
Square {
translation 2.5 0 0
texture IS texture
function IS function
source IS source
mode [
"MODULATE"
"MODULATE"
]
}
Square {
translation 5 0 0
texture IS texture
function IS function
source IS source
mode [
"MODULATE"
"REPLACE"
]
}
Square {
translation 7.5 0 0
texture IS texture
function IS function
source IS source
mode [
"MODULATE"
"MODULATE2X"
]
}
Square {
translation 10 0 0
texture IS texture
function IS function
source IS source
mode [
"MODULATE"
"MODULATE4X"
]
}
Square {
translation 12.5 0 0
texture IS texture
function IS function
source IS source
mode [
"MODULATE"
"ADD"
]
}
Square {
translation 15 0 0
texture IS texture
function IS function
source IS source
mode [
"MODULATE"
"ADDSIGNED"
]
}
Square {
translation 17.5 0 0
texture IS texture
function IS function
source IS source
mode [
"MODULATE"
"ADDSIGNED2X"
]
}
Square {
translation 20 0 0
texture IS texture
function IS function
source IS source
mode [
"MODULATE"
"SUBTRACT"
]
}
Square {
translation 22.5 0 0
texture IS texture
function IS function
source IS source
mode [
"MODULATE"
"ADDSMOOTH"
]
}
Square {
translation 25 0 0
texture IS texture
function IS function
source IS source
mode [
"MODULATE"
"BLENDDIFFUSEALPHA"
]
}
Square {
translation 27.5 0 0
texture IS texture
function IS function
source IS source
mode [
"MODULATE"
"BLENDTEXTUREALPHA"
]
}
Square {
translation 30 0 0
texture IS texture
function IS function
source IS source
mode [
"MODULATE"
"BLENDFACTORALPHA"
]
}
Square {
translation 32.5 0 0
texture IS texture
function IS function
source IS source
mode [
"MODULATE"
"BLENDCURRENTALPHA"
]
}
Square {
translation 35 0 0
texture IS texture
function IS function
source IS source
mode [
"MODULATE"
"MODULATEALPHA_ADDCOLOR"
]
}
Square {
translation 37.5 0 0
texture IS texture
function IS function
source IS source
mode [
"MODULATE"
"MODULATEINVALPHA_ADDCOLOR"
]
}
Square {
translation 40 0 0
texture IS texture
function IS function
source IS source
mode [
"MODULATE"
"MODULATEINVCOLOR_ADDALPHA"
]
}
Square {
translation 42.5 0 0
texture IS texture
function IS function
source IS source
mode [
"MODULATE"
"OFF"
]
}
Square {
translation 45 0 0
texture IS texture
function IS function
source IS source
mode [
"MODULATE"
"SELECTARG1"
]
}
Square {
translation 47.5 0 0
texture IS texture
function IS function
source IS source
mode [
"MODULATE"
"SELECTARG2"
]
}
Square {
translation 50 0 0
texture IS texture
function IS function
mode ""
mode [
"MODULATE"
"DOTPRODUCT3"
]
}
]
}
}
Modes {
texture [
ImageTexture {url "without-transparency.jpg"}
ImageTexture {url "with-transparency.png"}
]
function [
""
""
]
}
Modes {
translation 0 2.5 0
texture [
ImageTexture {url "without-transparency.jpg"}
ImageTexture {url "with-transparency.png"}
]
function [
""
"COMPLEMENT"
]
}
Modes {
translation 0 5 0
texture [
ImageTexture {url "without-transparency.jpg"}
ImageTexture {url "with-transparency.png"}
]
function [
""
"ALPHAREPLICATE"
]
}
Modes {
translation 0 10 0
texture [
ImageTexture {url "with-transparency.png"}
ImageTexture {url "without-transparency.jpg"}
]
function [
""
""
]
}
Modes {
translation 0 12.5 0
texture [
ImageTexture {url "with-transparency.png"}
ImageTexture {url "without-transparency.jpg"}
]
function [
""
"COMPLEMENT"
]
}
Modes {
translation 0 15 0
texture [
ImageTexture {url "with-transparency.png"}
ImageTexture {url "without-transparency.jpg"}
]
function [
""
"ALPHAREPLICATE"
]
}
Viewpoint {
position 25 7.5 45
}
Background {
skyColor .2 .2 .2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment