root/trunk/RBRapier/RBRapier/Renderer/Appearance/LineRasterization.py

Revision 702, 3.0 kB (checked in by sholloway, 5 years ago)

Added GL prefix to Execute/Select/Deselect

Line 
1 #!/usr/bin/env python
2 ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 ##~ License
4 ##~
5 ##- The RuneBlade Foundation library is intended to ease some
6 ##- aspects of writing intricate Jabber, XML, and User Interface (wxPython, etc.)
7 ##- applications, while providing the flexibility to modularly change the
8 ##- architecture. Enjoy.
9 ##~
10 ##~ Copyright (C) 2002  TechGame Networks, LLC.
11 ##~
12 ##~ This library is free software; you can redistribute it and/or
13 ##~ modify it under the terms of the BSD style License as found in the
14 ##~ LICENSE file included with this distribution.
15 ##~
16 ##~ TechGame Networks, LLC can be reached at:
17 ##~ 3578 E. Hartsel Drive #211
18 ##~ Colorado Springs, Colorado, USA, 80920
19 ##~
20 ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21
22 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23 #~ Imports
24 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25
26 from OpenGL import GL
27 from RBRapier.Renderer.AttributeMgr import AttributeChangeElement
28
29 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30 #~ Definitions
31 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32
33 class LineSize(object):
34     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35     #~ Sub classes
36     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37
38     AttributeChange = AttributeChangeElement(GL.GL_LINE_BIT)
39     Size = 1.
40
41     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
42     #~ Public Methods
43     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
44
45     def __init__(self, Size=1.):
46         self.Size = Size
47
48     def GLSelect(self, context):
49         GL.glLineWidth(self.Size)
50
51     def GLDeselect(self, context):
52         GL.glLineWidth(1.)
53
54 class LineStipple(object):
55     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
56     #~ Constants / Variables / Etc.
57     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
58
59     AttributeChange = AttributeChangeElement(GL.GL_LINE_BIT)
60     Repeat = 1
61     Pattern = -1
62
63     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
64     #~ Public Methods
65     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66
67     def __init__(self, Repeat=1., Pattern=-1):
68         self.Repeat = Repeat
69         self.Pattern = Pattern
70
71     def GLSelect(self, context):
72         context.StateMgr.Enable(GL.GL_LINE_STIPPLE)
73         GL.glLineStipple(self.Repeat, self.Pattern)
74
75     def GLDeselect(self, context):
76         context.StateMgr.Disable(GL.GL_LINE_STIPPLE)
77
78 class LineSmooth(object):
79     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
80     #~ Constants / Variables / Etc.
81     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
82
83     AttributeChange = AttributeChangeElement(GL.GL_LINE_BIT | GL.GL_HINT_BIT)
84     SmoothHint = GL.GL_DONT_CARE
85
86     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
87     #~ Public Methods
88     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
89
90     def GLSelect(self, context):
91         GL.glHint(GL.GL_POLYGON_SMOOTH_HINT, self.SmoothHint)
92         context.StateMgr.Enable(GL.GL_LINE_SMOOTH)
93
94     def GLDeselect(self, context):
95         context.StateMgr.Disable(GL.GL_LINE_SMOOTH)
96
Note: See TracBrowser for help on using the browser.