> > It fixes the file name but I still don't get any textures. I cannot see
> > where my "material_effect-sampler" is referenced.
> 
> It would properly be referenced by <diffuse> or one of the others (eg
> <ambient>, <specular>, etc.). They are defined by either a <color> or a
> <texture>. For your example, fix:
> 
> 
> <diffuse>
>   <texture texture="material_effect-sampler" texcoord="texcoord0"/>
> </diffuse>
> 
> ... on whichever of the shaders (eg <phong> is a conceptual shader) you
> want using the texture.
> 
> Regards,
> Marcus
> 

The dae file was generated by the OSG dae writer.

I tracked this problem down to the following code in
daeWriter::processMaterial

cot = daeSafeCast< domCommon_color_or_texture_type >( phong->createAndPlace(
"ambient" ) );

... (stuff deleted

//### check if we really have a texture
if ((tex == NULL) || (!cot->getTexture()))
{

cot->getTexture will always return NULL  because the texture if any has been
set on the <diffuse> element. This means that if you have a diffuse colour
set the diffuse element that has been setup is replaced with one which just
references the diffuse colour.

I removed the call to cot->getTexture and the code now generates

<diffuse>
   <texture texture="material_effect-sampler" texcoord="texcoord0">
      <extra type="color">
         <technique profile="SCEI">
            <color> 0 0 0 1</color>
         </technique>
      </extra>
   </texture>
</diffuse>

rather then the

<diffuse>
   <color>0.7 0.7 0.7 1 </color>
</diffuse>

generated previously.

Andy, can you tell me what the code was intended to do and what I should
replace the call to cot->getTexture with if anything.

Putting in a temporary hack has allowed me to see that I am still not
getting the file name generation right on Windows.

 
<init_from>../../../environ%20project/environ/terraindata/vtp-apps-data-and-
plantlib/buildingmodels/cement_block1_256.jpg</init_from>

C:\Temp\colladatest\models>osgviewer brantholme.dae
processTexture(./material_effect-sampler)
Warning: could not find file
"C:/environ%20project/environ/terraindata/vtp-apps-
data-and-plantlib/buildingmodels/cement_block1_256.jpg"
Time to load = 0.0273278

I guess it is back to reading RFCs again to see if % encoding should be
being done/undone.

Roger


_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to