Changeset 340
- Timestamp:
- 10/29/02 23:52:46 (6 years ago)
- Files:
-
- trunk/RBRapier/RBRapier/Renderer/DisplayList.py (modified) (3 diffs)
- trunk/RBRapier/RBRapier/Renderer/Geometry/ArrayTraversal.py (modified) (2 diffs)
- trunk/RBRapier/RBRapier/Renderer/Geometry/VertexArrays.py (modified) (1 diff)
- trunk/RBRapier/RBRapier/Renderer/SequenceMgr.py (modified) (1 diff)
- trunk/RBRapier/RBRapier/Renderer/View/ClippingPlane.py (modified) (3 diffs)
- trunk/RBRapier/RBRapier/Tools/Quaternion.py (modified) (1 diff)
- trunk/RBRapier/RBRapier/Tools/Vector.py (modified) (2 diffs)
- trunk/RBRapier/doc/DesignLayout.xml (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/RBRapier/RBRapier/Renderer/DisplayList.py
r338 r340 25 25 26 26 from OpenGL import GL 27 from Foundation.AspectOriented import Aspect 27 28 import time 28 29 … … 31 32 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 32 33 33 class DisplayList( object):34 class DisplayList(Aspect.Aspect): 34 35 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 35 36 #~ Constants / Variables / Etc. 36 37 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 38 38 Active = 1 39 RecreateCache = 1 40 ListId = None 39 __RecreateCache = 1 40 __ListId = None 41 41 42 42 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 44 44 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 45 45 46 def __init__(self, CachedObj): 47 self.CachedObj = CachedObj 48 49 def Draw(self, context): 50 if not self.Active: return 51 if self.RecreateCache and self.CachedObj is not None: 52 if __debug__: 53 print "Caching %r..." % self.CachedObj, 46 def Execute(self, context): 47 if self.__RecreateCache: 48 if __debug__: 49 print "Caching %r..." % self.__CachedObj, 54 50 StartTime = time.clock() 55 if self.ListId is None: 56 self.ListId = GL.glGenLists(1) 57 GL.glNewList(self.ListId, GL.GL_COMPILE) 58 self.CachedObj.Setup(context) 59 self.CachedObj.Draw(context) 51 if self.__ListId is None: 52 self.__ListId = GL.glGenLists(1) 53 GL.glNewList(self.__ListId, GL.GL_COMPILE) 54 super(DisplayList, self).Execute(context) 60 55 GL.glEndList() 61 56 if __debug__: 62 57 EndTime = time.clock() 63 58 print "Done (%1.4f)" % (EndTime-StartTime) 64 self. RecreateCache = 059 self.__RecreateCache = 0 65 60 66 if self. ListId is not None:67 GL.glCallList(self. ListId)61 if self.__ListId is not None: 62 GL.glCallList(self.__ListId) 68 63 trunk/RBRapier/RBRapier/Renderer/Geometry/ArrayTraversal.py
r338 r340 42 42 self.rangecollection = rangecollection 43 43 44 def Draw(self, context):44 def Execute(self, context): 45 45 for range in self.rangecollection: 46 46 GL.glDrawArrays(self.primitive, range) … … 72 72 self._glDrawElements = self._glDrawElementsCall[format] 73 73 74 def Draw(self, context):74 def Execute(self, context): 75 75 for data in self.datacollection: 76 76 self._glDrawElements(self.primitive, self.data) trunk/RBRapier/RBRapier/Renderer/Geometry/VertexArrays.py
r338 r340 49 49 self._glArrayPointer = self._glArrayPointers[format] 50 50 51 def Select(self ):51 def Select(self, context): 52 52 self._glArrayPointer(self.data) 53 GL.glEnableClientState(self._glArrayType)53 context.ClientStateMgr.Enable(self._glArrayType) 54 54 55 def Deselct(self ):56 GL.glDisableClientState(self._glArrayType)55 def Deselct(self, context): 56 context.ClientStateMgr.Disable(self._glArrayType) 57 57 58 58 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ trunk/RBRapier/RBRapier/Renderer/SequenceMgr.py
r338 r340 70 70 self.OnBeginExecute.Update(context) 71 71 for priority, element in self.Elements: 72 element.Execute(context) 72 if getattr(element, 'Active', 1): 73 element.Execute(context) 73 74 self.OnEndExecute.Update(context) 74 75 trunk/RBRapier/RBRapier/Renderer/View/ClippingPlane.py
r338 r340 25 25 26 26 from OpenGL import GL 27 from RBRapier.Tools import Vector 27 28 28 29 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 35 36 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 36 37 37 Active = 1 38 PlaneNumber = None 39 Equation = Vector.Vector4Property('Equation') 38 40 39 PlaneNumber = None 40 Enabled = None 41 Equation = Vector.Vector4Property('Equation') 41 # TODO: hook up this attribute change thingy 42 context.AttributeMgr.Save(GL.GL_TRANSFORM_BIT) 42 43 43 44 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 45 46 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 46 47 47 def __init__(self, PlaneNumber=None, E nabled=None, Equation=None):48 def __init__(self, PlaneNumber=None, Equation=None): 48 49 self.PlaneNumber = PlaneNumber 49 self.Enabled = Enabled50 50 if Equation is not None: 51 51 self.Equation = Equation 52 52 53 def Setup(self, context): 54 if not self.Active: return 55 if self.PlaneNumber is not None: 56 context.AttributeMgr.Save(GL.GL_TRANSFORM_BIT) 57 if self.Enabled is not None: 58 context.StateMgr.SetState(self.Enabled, GL.GL_CLIP_PLANE0 + self.PlaneNumber) 59 60 def Draw(self, context): 61 if not self.Active: return 53 def Select(self, context): 62 54 if self.PlaneNumber is not None: 63 55 GL.glClipPlane(GL.GL_CLIP_PLANE0 + self.PlaneNumber, self.Equation.tolist()) 56 context.StateMgr.Enable(GL.GL_CLIP_PLANE0 + self.PlaneNumber) 64 57 58 def Deselect(self, context): 59 if self.PlaneNumber is not None: 60 context.StateMgr.Disable(GL.GL_CLIP_PLANE0 + self.PlaneNumber) 65 61 66 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~67 trunk/RBRapier/RBRapier/Tools/Quaternion.py
r337 r340 417 417 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 418 419 def asarray(self): 420 return self._array 421 422 def tolist(self): 423 return self._array 424 419 425 def _SVfromRadianAxis(Klass, Radians, Axis): 420 426 Radians *= .5 trunk/RBRapier/RBRapier/Tools/Vector.py
r337 r340 222 222 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 223 223 224 def asarray(self): 225 return self._array 226 224 227 def tolist(self): 225 228 return self._array.tolist() … … 402 405 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 406 407 def asarray(self): 408 return self._arrayh 409 404 410 def tolist(self): 405 411 return self._arrayh.tolist() trunk/RBRapier/doc/DesignLayout.xml
r337 r340 1 1 <?xml version='1.0'?> 2 2 <project name='RuneBlade Rendering Project'> 3 <package name='Renderer'> 4 <package name='Geometry'> 5 NOTE: Don't forget support for selection and picking 6 7 <module name='Data'> 8 <object name='VertexArray'/> 9 <object name='NormalArray'/> 10 <object name='ColorArray'/> 11 <object name='TexCoordArray'/> 12 <object name='EdgeFlagArray'/> 13 <object name='WeightArray'/> 14 </module> 15 16 <module name='Traversal'> 17 <object name='Array Traversal'/> 18 Outstanding issues: 19 * NV_element_array and NV_vertex_array_range 20 * ATI_element_array and ATI_vertex_array_object 21 * EXT_multi_draw_array 22 * NV_primitive_restart 23 </module> 24 25 <object name='Immediate Mode'> 26 Provide something to derive from/implement so that 27 immediate mode tests are possible and simple. 28 29 Not really intended for production usage. 30 </object> 31 </package> 32 33 <package name='Image and Raster'> 34 <module name='Image Bitmaps'> 35 To be explored 36 </module> 37 <module name='Texture Objects'> 38 To be explored 39 </module> 40 To be explored 41 42 Look at: 43 Standard/simple 44 Multitexturing 45 Dot/Bump/Blend/Specular/Min/Max etc... 46 Spherical/Cubic environment mapping 47 </package> 48 49 <package name='Transformations'> 50 Model View (multiple) 51 Projection 52 Color 53 Texture (multiple?) 54 </package> 55 56 <package name='Appearance'> 57 <module name='Lighting and Lights' /> 58 <module name='LogicOp'> 59 NOTE: Avoid using -- slow 60 </module> 61 <module name='Fog'> 62 Outstanding issues: 63 height fog 64 </module> 65 <module name='Blending'> 66 Blend seperation 67 </module> 68 <module name='Materials'> 69 Normal 70 Colored Materials 71 </module> 72 </package> 73 74 <package name='Environment'> 75 <module name='Accumulation' /> 76 77 <module name='Selection and Picking'> 78 Don't Forget this! 79 </module> 80 81 <module name='Stenciling'> 82 Outstanding issues: 83 stencil wraping 84 EXT_stencil_two_side 85 </module> 86 87 <module name='Fragment Tests' > 88 Scissor 89 Alpha 90 Stencil 91 Depth 92 See fragment programs and Cg as well 93 </module> 94 95 <module name='Buffers' > 96 Color 97 Accumulation 98 Depth 99 Stencil 100 Aux[] 101 PBuffer? 102 </module> 103 </package> 104 105 <package name='Programable Operations'> 106 Placeholder for Vertex, Fragment, and Texture programs 107 Cg also might here? Not sure. 108 </package> 109 110 <package name='Managers'> 111 <module name='States'> 112 Both client and global states 113 Uses a checkpoint model 114 </module> 115 <module name='Attributes'> 116 Uses a checkpoint model 117 </module> 118 <module name='BufferClearing'> 119 Most effecient when clearing multiple buffers together... 120 </module> 121 <module name='Display List Cache' /> 122 </package> 123 </package> 124 3 125 <package name='Tools'> 4 126 <module name='Vector Library'/> … … 57 179 <module name='Mass-spring interpolation'/> 58 180 <module name='Other physics-based interpolation'/> 59 </package>60 </package>61 62 <package name='Renderer'>63 <package name='Geometry'>64 NOTE: Don't forget support for selection and picking65 66 <module name='Data'>67 <object name='VertexArray'/>68 <object name='NormalArray'/>69 <object name='ColorArray'/>70 <object name='TexCoordArray'/>71 <object name='EdgeFlagArray'/>72 <object name='WeightArray'/>73 </module>74 75 <module name='Traversal'>76 <object name='Array Traversal'/>77 Outstanding issues:78 * NV_element_array and NV_vertex_array_range79 * ATI_element_array and ATI_vertex_array_object80 * EXT_multi_draw_array81 * NV_primitive_restart82 </module>83 84 <object name='Immediate Mode'>85 Provide something to derive from/implement so that86 immediate mode tests are possible and simple.87 88 Not really intended for production usage.89 </object>90 </package>91 92 <package name='Image and Raster'>93 <module name='Image Bitmaps'>94 To be explored95 </module>96 <module name='Texture Objects'>97 To be explored98 </module>99 To be explored100 101 Look at:102 Standard/simple103 Multitexturing104 Dot/Bump/Blend/Specular/Min/Max etc...105 Spherical/Cubic environment mapping106 </package>107 108 <package name='Environment and Misc'>109 <module name='Selection and Picking'>110 Don't Forget this!111 </module>112 113 <module name='Transformations'>114 Model View (multiple)115 Projection116 Color117 Texture (multiple?)118 </module>119 <module name='Lighting and Lights' />120 <module name='LogicOp'>121 NOTE: Avoid using -- slow122 </module>123 <module name='Fog'>124 Outstanding issues:125 height fog126 </module>127 <module name='Blending'>128 Blend seperation129 </module>130 <module name='Stenciling'>131 Outstanding issues:132 stencil wraping133 EXT_stencil_two_side134 </module>135 <module name='Accumulation' />136 <module name='Fragment Tests' >137 Scissor138 Alpha139 Stencil140 Depth141 See fragment programs and Cg as well142 </module>143 <module name='Buffers' >144 Color145 Accumulation146 Depth147 Stencil148 Aux[]149 PBuffer?150 </module>151 </package>152 153 <package name='Programable Operations'>154 Placeholder for Vertex, Fragment, and Texture programs155 Cg also might here? Not sure.156 </package>157 158 <package name='Managers'>159 <module name='States'>160 Both client and global states161 Uses a checkpoint model162 </module>163 <module name='Attributes'>164 Uses a checkpoint model165 </module>166 <module name='BufferClearing'>167 Most effecient when clearing multiple buffers together...168 </module>169 <module name='Display List Cache' />170 181 </package> 171 182 </package>
