Changeset 643
- Timestamp:
- 07/22/03 13:17:39 (5 years ago)
- Files:
-
- trunk/RBRapier/RBRapier/Formats/Attic/SVG.old/Renderers/Rapier.py (modified) (10 diffs)
- trunk/RBRapier/RBRapier/Formats/Attic/SVG.old/Renderers/RapierObjects.py (modified) (2 diffs)
- trunk/RBRapier/demo/Attic/SVG.old/display.py (modified) (4 diffs)
- trunk/RBRapier/demo/Cube/cubescene.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/RBRapier/RBRapier/Formats/Attic/SVG.old/Renderers/Rapier.py
r634 r643 89 89 90 90 def Display(self, ri): 91 self._debug_points = 0 91 92 rootsequence = self.SequenceFactory() 92 93 … … 109 110 del self.context 110 111 del self.contextstack 112 113 print self._debug_points 111 114 return rootsequence 112 115 … … 157 160 self.PushContext(ri_line) 158 161 try: 162 self._debug_points += 2 159 163 ro = RapierObjects.Line((ri_line.x1, ri_line.y1), (ri_line.x2, ri_line.y2)) 160 164 ro.SetColors(**self.context.GetColors()) … … 166 170 self.PushContext(ri_rect) 167 171 try: 172 self._debug_points += 4 168 173 ro = RapierObjects.Rect(ri_rect.width, ri_rect.height) 169 174 ro.SetColors(**self.context.GetColors()) … … 175 180 self.PushContext(ri_circle) 176 181 try: 182 self._debug_points += 4 177 183 ro = RapierObjects.Circle(ri_circle.cx, ri_circle.cy, ri_circle.r) 178 184 ro.SetColors(**self.context.GetColors()) … … 184 190 self.PushContext(ri_ellipse) 185 191 try: 192 self._debug_points += 4 186 193 ro = RapierObjects.Ellipse(ri_ellipse.cx, ri_ellipse.cy, ri_ellipse.rx, ri_ellipse.ry) 187 194 ro.SetColors(**self.context.GetColors()) … … 193 200 self.PushContext(ri_polygon) 194 201 try: 202 self._debug_points += len(ri_polygon.points)/2 195 203 ro = RapierObjects.Polygon(ri_polygon.points) 196 204 ro.SetColors(**self.context.GetColors()) … … 202 210 self.PushContext(ri_polyline) 203 211 try: 212 self._debug_points += len(ri_polyline.points)/2 204 213 ro = RapierObjects.Polyline(ri_polyline.points) 205 214 ro.SetColors(**self.context.GetColors()) … … 212 221 try: 213 222 pathlist = ri_path.path.RestoreTo(self.PathFactory()).pathlist 223 self._debug_points += reduce(int.__add__, [len(x) for x in pathlist], 0) 214 224 ro = RapierObjects.Path(pathlist) 215 225 ro.SetColors(**self.context.GetColors()) … … 221 231 self.PushContext(ri_text) 222 232 try: 233 self._debug_points += 4 223 234 ro = RapierObjects.Text() 224 235 ro.SetColors(**self.context.GetColors()) trunk/RBRapier/RBRapier/Formats/Attic/SVG.old/Renderers/RapierObjects.py
r634 r643 123 123 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 124 124 125 class Poly line(Base):125 class Polygon(Base): 126 126 __slots__ = 'verticies', 'listid' 127 127 … … 148 148 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 149 149 150 class Poly gon(Polyline):150 class Polyline(Polygon): 151 151 pass 152 152 trunk/RBRapier/demo/Attic/SVG.old/display.py
r631 r643 26 26 import logging 27 27 import sys 28 import time 28 29 29 30 from wxPython import wx … … 34 35 35 36 from RBRapier.Renderer import SequenceMgr 37 from RBRapier.Renderer import DisplayList 36 38 from RBRapier.Renderer.Environment import Buffers 37 39 from RBRapier.Renderer.View import Viewport 40 from RBRapier.Renderer.View import Transformations 41 from RBRapier.Renderer.View import TransformationSettings 38 42 39 43 from RBRapier.Formats import SVG … … 78 82 self.svgitems = [SVG.SVGSkinner.SkinFile(svgfile).object for svgfile in sys.argv[1:]] 79 83 80 self.viewsetup = GLViewSetup(self.glcanvas )84 self.viewsetup = GLViewSetup(self.glcanvas, 30) 81 85 self.viewsetup.OnRender.Add(self.Initialize) 82 86 self.viewsetup.OnRender.Add(self.Render) 87 self.viewsetup.OnRender.Add(self.PostRender) 83 88 self.viewsetup.StartRendering() 84 89 … … 93 98 self.root.AddElement(self.viewport, -2) 94 99 100 self.projection = Transformations.OrthographicMgd(GL.GL_PROJECTION, True, -1, 1, -1, 1, -1, 1) 101 self.root.AddElement(self.projection.Select) 102 self.root.AddPostElement(self.projection.Deselect) 103 104 self.svgs = SequenceMgr.Sequence() 95 105 svgrenderer = SVG.Renderers.Rapier.RapierRenderer() 96 106 while self.svgitems: 97 107 svg = self.svgitems.pop() 98 self.root.AddElement(svgrenderer.Display(svg)) 108 self.svgs.AddElement(svgrenderer.Display(svg)) 109 110 self.root.AddElement(self.Thing) 111 self.root.AddElement(self.svgs) 99 112 100 113 def Render(self, subject, canvas): 101 114 self.viewport.SetRectangle(canvas.GetClientRect().asTuple()) 115 self.projection.Dimensions = 2, 2, 2 116 self.projection.AspectRatio = self.viewport.AspectRatio 102 117 self.root.Execute(None) 103 118 104 maxfps = 40 105 realfps = self.root.Statistics['persecond'] 106 targetfps = self.viewsetup.GetTargetFPS() 107 if realfps < 2*targetfps: 108 newtarget = min(maxfps, realfps*0.45) 109 self.viewsetup.SetTargetFPS(newtarget) 110 print "Lowering fps to:", newtarget, "old target:", targetfps, "real:", realfps 119 #maxfps = 40 120 #realfps = self.root.Statistics['persecond'] 121 #targetfps = self.viewsetup.GetTargetFPS() 122 #if realfps < 2*targetfps: 123 # newtarget = min(maxfps, realfps*0.45) 124 # self.viewsetup.SetTargetFPS(newtarget) 125 # print "Lowering fps to:", newtarget, "old target:", targetfps, "real:", realfps 126 127 def Thing(self, *args): 128 GL.glRotated((3*time.clock())%360., 1, 0, 0) 129 GL.glRotated((2*time.clock())%360., 0, 1, 0) 130 GL.glRotated((1*time.clock())%360., 0, 0, 1) 131 132 def PostRender(self, glviewsetup, canvas): 133 glviewsetup.OnRender.Remove(self.PostRender) 134 DisplayList.DisplayList.InsertAspect(self.svgs) 111 135 112 136 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ trunk/RBRapier/demo/Cube/cubescene.py
r626 r643 33 33 from RBRapier.Renderer.Environment import Buffers 34 34 from RBRapier.Renderer.View import Viewport 35 from RBRapier.Renderer.View import Transformations 36 from RBRapier.Renderer.View import TransformationSettings 35 37 36 38 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 65 67 self.root.AddElement(self.viewport, -2) 66 68 69 self.projection = Transformations.OrthographicMgd(GL.GL_PROJECTION, True, -1, 1, -1, 1, -1, 1) 70 self.root.AddElement(self.projection.Select) 71 self.root.AddPostElement(self.projection.Deselect) 72 67 73 self.cube = Cube() 68 74 self.root.AddElement(self.cube.Draw) … … 70 76 def Render(self, subject, canvas): 71 77 self.viewport.SetRectangle(canvas.GetClientRect().asTuple()) 78 self.projection.Dimensions = 2, 2, 2 79 self.projection.AspectRatio = self.viewport.AspectRatio 72 80 self.root.Execute(None) 73 81
