Changeset 643

Show
Ignore:
Timestamp:
07/22/03 13:17:39 (5 years ago)
Author:
sholloway
Message:

*** empty log message ***

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/RBRapier/RBRapier/Formats/Attic/SVG.old/Renderers/Rapier.py

    r634 r643  
    8989 
    9090    def Display(self, ri): 
     91        self._debug_points = 0 
    9192        rootsequence = self.SequenceFactory() 
    9293 
     
    109110            del self.context 
    110111            del self.contextstack 
     112 
     113        print self._debug_points 
    111114        return rootsequence 
    112115 
     
    157160        self.PushContext(ri_line) 
    158161        try: 
     162            self._debug_points += 2 
    159163            ro = RapierObjects.Line((ri_line.x1, ri_line.y1), (ri_line.x2, ri_line.y2)) 
    160164            ro.SetColors(**self.context.GetColors()) 
     
    166170        self.PushContext(ri_rect) 
    167171        try: 
     172            self._debug_points += 4 
    168173            ro = RapierObjects.Rect(ri_rect.width, ri_rect.height) 
    169174            ro.SetColors(**self.context.GetColors()) 
     
    175180        self.PushContext(ri_circle) 
    176181        try: 
     182            self._debug_points += 4 
    177183            ro = RapierObjects.Circle(ri_circle.cx, ri_circle.cy, ri_circle.r) 
    178184            ro.SetColors(**self.context.GetColors()) 
     
    184190        self.PushContext(ri_ellipse) 
    185191        try: 
     192            self._debug_points += 4 
    186193            ro = RapierObjects.Ellipse(ri_ellipse.cx, ri_ellipse.cy, ri_ellipse.rx, ri_ellipse.ry) 
    187194            ro.SetColors(**self.context.GetColors()) 
     
    193200        self.PushContext(ri_polygon) 
    194201        try: 
     202            self._debug_points += len(ri_polygon.points)/2 
    195203            ro = RapierObjects.Polygon(ri_polygon.points) 
    196204            ro.SetColors(**self.context.GetColors()) 
     
    202210        self.PushContext(ri_polyline) 
    203211        try: 
     212            self._debug_points += len(ri_polyline.points)/2 
    204213            ro = RapierObjects.Polyline(ri_polyline.points) 
    205214            ro.SetColors(**self.context.GetColors()) 
     
    212221        try: 
    213222            pathlist = ri_path.path.RestoreTo(self.PathFactory()).pathlist 
     223            self._debug_points += reduce(int.__add__, [len(x) for x in pathlist], 0) 
    214224            ro = RapierObjects.Path(pathlist) 
    215225            ro.SetColors(**self.context.GetColors()) 
     
    221231        self.PushContext(ri_text) 
    222232        try: 
     233            self._debug_points += 4 
    223234            ro = RapierObjects.Text() 
    224235            ro.SetColors(**self.context.GetColors()) 
  • trunk/RBRapier/RBRapier/Formats/Attic/SVG.old/Renderers/RapierObjects.py

    r634 r643  
    123123#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    124124 
    125 class Polyline(Base): 
     125class Polygon(Base): 
    126126    __slots__ = 'verticies', 'listid' 
    127127 
     
    148148#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    149149 
    150 class Polygon(Polyline): 
     150class Polyline(Polygon): 
    151151    pass 
    152152 
  • trunk/RBRapier/demo/Attic/SVG.old/display.py

    r631 r643  
    2626import logging 
    2727import sys 
     28import time 
    2829 
    2930from wxPython import wx 
     
    3435 
    3536from RBRapier.Renderer import SequenceMgr 
     37from RBRapier.Renderer import DisplayList 
    3638from RBRapier.Renderer.Environment import Buffers 
    3739from RBRapier.Renderer.View import Viewport 
     40from RBRapier.Renderer.View import Transformations 
     41from RBRapier.Renderer.View import TransformationSettings 
    3842 
    3943from RBRapier.Formats import SVG 
     
    7882        self.svgitems = [SVG.SVGSkinner.SkinFile(svgfile).object for svgfile in sys.argv[1:]] 
    7983 
    80         self.viewsetup = GLViewSetup(self.glcanvas
     84        self.viewsetup = GLViewSetup(self.glcanvas, 30
    8185        self.viewsetup.OnRender.Add(self.Initialize) 
    8286        self.viewsetup.OnRender.Add(self.Render) 
     87        self.viewsetup.OnRender.Add(self.PostRender) 
    8388        self.viewsetup.StartRendering() 
    8489 
     
    9398        self.root.AddElement(self.viewport, -2) 
    9499 
     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() 
    95105        svgrenderer = SVG.Renderers.Rapier.RapierRenderer() 
    96106        while self.svgitems: 
    97107            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) 
    99112 
    100113    def Render(self, subject, canvas): 
    101114        self.viewport.SetRectangle(canvas.GetClientRect().asTuple()) 
     115        self.projection.Dimensions = 2, 2, 2 
     116        self.projection.AspectRatio = self.viewport.AspectRatio 
    102117        self.root.Execute(None) 
    103118 
    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) 
    111135 
    112136#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  • trunk/RBRapier/demo/Cube/cubescene.py

    r626 r643  
    3333from RBRapier.Renderer.Environment import Buffers 
    3434from RBRapier.Renderer.View import Viewport 
     35from RBRapier.Renderer.View import Transformations 
     36from RBRapier.Renderer.View import TransformationSettings 
    3537 
    3638#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     
    6567        self.root.AddElement(self.viewport, -2) 
    6668 
     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 
    6773        self.cube = Cube() 
    6874        self.root.AddElement(self.cube.Draw) 
     
    7076    def Render(self, subject, canvas): 
    7177        self.viewport.SetRectangle(canvas.GetClientRect().asTuple()) 
     78        self.projection.Dimensions = 2, 2, 2 
     79        self.projection.AspectRatio = self.viewport.AspectRatio 
    7280        self.root.Execute(None) 
    7381