media @ VU
shader-scenerender.vr
shader-scenerender.vr
(wrl
)
[ flux /
bitmanagement /
cortona /
octaga
]
Web3D/VR
render
PROTO SceneRender [
field SFInt32 width 1024
field SFInt32 height 768
exposedField SFNode vshader NULL
exposedField MFString pshader "local/shader/outline.phl"
exposedField MFString scene "@vr-object-dam.wrl"
]
{
GroupRenderToTexture {
# the scene to render
children DEF Scene Inline { url IS scene }
# scene is rendered to this texture
outputTexture DEF OUTPUT_TEXTURE CompositeTexture3D
{
pixelWidth IS width
pixelHeight IS height
}
# render the output image by using OUTPUT_TEXTURE
outputChildren Shape {
appearance DEF ShaderAppearance ShaderAppearance {
transparent FALSE
vertexShader VertexShader
{
url "hlsl:
float4x4 modelViewProjectionT;
struct VS_OUTPUT
{
float4 Pos : POSITION;
float2 Tex : TEXCOORD0;
};
VS_OUTPUT main (
float4 Pos : POSITION,
float3 Norm : NORMAL,
float2 Tex : TEXCOORD0
)
{
VS_OUTPUT Out;
Out.Pos = mul( Pos, modelViewProjectionT );
Out.Tex = float2( Tex.x, 1.0 - Tex.y ); // Y FLIP
return Out;
}
"
}
# Fragment shader aka Pixel shader
fragmentShader DEF pshader FragmentShader {
exposedField SFFloat time 1
field SFNode image USE OUTPUT_TEXTURE
url IS pshader
}
}
# The principle behind this is to map the outputtexture onto the
# following Rectangles.
geometry Rectangle {}
}
}
DEF _TimeSensor TimeSensor {
cycleInterval 1
loop TRUE
startTime 0
}
ROUTE _TimeSensor.fraction_changed TO pshader.time
}
##SceneRender { }
(C) A. Eliëns
2/9/2007
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.