|
From: James W. <ja...@fr...> - 2007-02-01 22:44:07
|
Roger Holmes wrote: > On 1 Feb, 2007, at 17:27, James W. Walker wrote: >> It still seems to me that the view could have a single concept of >> current surface shader (as the IR does), which is the most recently >> seen surface shader, subject to pushing and popping when you enter/ >> leave a group and when you start/finish a geometry. > > But pushing and popping the graphics state is a slow operation, you > would > not want to do it for every geometry, and certainly not for every > part of > a geometry (you can have an attribute set on every vertex, edge and > triangle for some geometries, though what a surface shader does for > a point I wouldn't care to guess, but I think I have seen them on edges > when we were first developing 3DWorld). We're already pushing/popping for retained geometries that have attribute sets containing surface shaders. See E3Renderer_Method_SubmitGeometry. Pushing/popping the view state does not update everything, the view does make an effort to update only aspects that have changed, using the stackState mask. The test file that I was getting incorrect results with, texture-interference.3dmf, contains an attribute set containing a surface shader. I added another test file, texture-interference-2.3dmf, that has a free-floating texture shader. The second file was working correctly. However... In IRGeometry_Attribute_Handler, the shader contained in an attribute set attached to the geometry was being submitted using Q3Object_Submit( *theShader, theView ); As a test, I changed that to say TQ3AttributeSet tempAtts = Q3AttributeSet_New(); Q3AttributeSet_Add( tempAtts, kQ3AttributeTypeSurfaceShader, theShader ); Q3Object_Submit( tempAtts, theView ); Q3Object_Dispose( tempAtts ); With that change, texture-interference.3dmf worked correctly, but texture-interference-2.3dmf failed. This makes me more convinced that it's just causing confusion having two surface shaders in the view state. I have removed the second surface shader from E3View.c. Now both of my test files work, and I haven't seen any other problems. Of course, let me know if you see any bugs. -- James W. Walker, Innoventive Software LLC <http://www.frameforge3d.com/> |