On 23 May 2004, Gerrit Voss wrote:
Hi!
> > Short question: Does the current VRML97 loader accept SFStrings (or
> > MFStrings)?. While the OSGScanParseSkel.{y,lpp} certainly look that way,
> > I always get "WARNING: -----> parse error in Line" errors for the
> > strings...
>
> it should could you send an example ?
With pleasure.
I've added a ShaderAppearance node, which is derived from Appearance.
Looks like this:
PROTO ShaderAppearance [
exposedField SFNode material NULL
exposedField SFNode texture NULL
exposedField SFNode textureTransform NULL
exposedField SFString vertexShader ""
exposedField SFString fragmentShader ""
] { }
As a test .wrl I use the TIE, which has a ShaderAppearance node instead of
the usual Appearance one:
Shape {
appearance ShaderAppearance {
material Material {
diffuseColor 0.647059 0.647059 0.647059
specularColor 0.498039 0.498039 0.498039
emissiveColor 0 0 0
shininess 0.078125
transparency 0.000000
}
vertexShader
"cg: struct appin
{
float4 Position : POSITION;
float4 Normal : NORMAL;
float4 Color : COLOR0;
};
struct V2FI
{
float4 HPosition : POSITION;
float3 Color : TEXCOORD0;
float3 Normal : TEXCOORD1;
float3 ViewVector : TEXCOORD2;
float3 LightVector : TEXCOORD3;
};
V2FI main(appin IN)
{
V2FI OUT;
float4 pos = mul(glstate.matrix.modelview[0], IN.Position);
OUT.ViewVector = -pos.xyz;
OUT.LightVector = normalize(glstate.light[0].position.xyz);
OUT.HPosition = mul(glstate.matrix.projection, pos);
OUT.Normal =
normalize(mul(glstate.matrix.invtrans.modelview[0], IN.Normal).xyz);
OUT.Color = IN.Color.rgb;
return OUT;
}
"
fragmentShader
"cg: struct V2FI
{
float4 HPosition : POSITION;
float3 Color : TEXCOORD0;
float3 Normal : TEXCOORD1;
float3 ViewVector : TEXCOORD2;
float3 LightVector : TEXCOORD3;
};
fragout main(V2FI IN)
{
float3 n=normalize(IN.Normal);
float3 v=normalize(IN.ViewVector);
float3 l=IN.LightVector;
float3 r=reflect(-v,n);
float spec=pow(saturate(dot(l,r)),30.0);
float diff=clamp(dot(n,l),0.3,1.0);
float3 color=IN.Color*diff+(spec*IN.Color);
fragout OUT;
OUT.col.rgb = color;
OUT.col.a=1.0;
return OUT;
}"
}
}
If you want the actual code, I could send you a tarball. At least from
my experimentation, it seems as if the ShaderAppearanceDesc-code is not
visited before the error appears, though.
Tobias
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users