- Timestamp:
- Aug 12, 2007, 1:05:08 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/abgl.ab
r157 r287 2 2 #define _INC_ABGL 3 3 4 #include <GL/gl.sbp> 5 #include <GL/glu.sbp> 6 7 Class PositionOnly 8 x As GLfloat 9 y As GLfloat 10 z As GLfloat 4 #require <GL/gl.sbp> 5 #require <GL/glu.sbp> 6 7 Enum VertexFormatsf 8 PositionOnly 9 PositionColoered 10 End Enum 11 12 Enum VertexFormatsd 13 PositionOnly 14 PositionColoered 15 End Enum 16 17 NameSpace CustomVertexf 18 Type PositionOnly 19 x As GLfloat 20 y As GLfloat 21 z As GLfloat 22 Public 23 End Type 24 25 Type PositionColoered 26 Public 27 x As GLfloat 28 y As GLfloat 29 z As GLfloat 30 r As GLfloat 31 g As GLfloat 32 b As GLfloat 33 a As GLfloat 34 End Type 35 End NameSpace 36 37 NameSpace CustomVertexd 38 Type PositionOnly 39 Public 40 x As GLdouble 41 y As GLdouble 42 z As GLdouble 43 End Type 44 45 Type PositionColoered 46 Public 47 x As GLdouble 48 y As GLdouble 49 z As GLdouble 50 r As GLdouble 51 g As GLdouble 52 b As GLdouble 53 a As GLdouble 54 End Type 55 End NameSpace 56 57 Class VertexBuffer 11 58 Public 12 End Class 13 14 Class PositionColoered 15 x As GLfloat 16 y As GLfloat 17 z As GLfloat 18 r As GLfloat 19 g As GLfloat 20 b As GLfloat 21 a As GLfloat 59 Sub VertexBuffer() 60 End Sub 61 Sub ~VertexBuffer() 62 End Sub 63 22 64 Public 65 Function Size() As GLuint 66 Return 0 67 End Function 68 Function Lock() As VoidPtr 69 Return NULL 70 End Function 71 Sub Unlock() 72 End Sub 23 73 End Class 24 74 … … 77 127 Return Substract(This,SrcVec) 78 128 End Function 79 /* Function Operator * (SrcVec As Vector2f) As Vector2f129 /* Function Operator * (SrcVec As Vector2f) As GLfloat 80 130 Return Dot(This,SrcVec) 81 131 End Function*/ … … 124 174 End Function 125 175 Function Dot(SrcVec1 As Vector2f, SrcVec2 As Vector2f) As GLfloat 126 Return SrcVec1.X*SrcVec2.X+SrcVec1.Y*SrcVec2.Y 176 Return (SrcVec1.X*SrcVec2.X)+(SrcVec1.Y*SrcVec2.Y) 177 End Function 178 Function Empty() As Vector2f 179 Return New Vector2f() 127 180 End Function 128 181 Function Magnitude() As GLfloat … … 150 203 End Function 151 204 152 Protected 205 Public /* Object Class Override */ 206 Override Function Equals( object As Object ) As Boolean 207 If This.GetHashCode() = object.GetHashCode() Then 208 Return True 209 Else 210 Return False 211 End If 212 End Function 213 Override Function ToString() As String 214 Return GetType().Name 215 End Function 216 217 Protected /* Data */ 153 218 xy As XY_FLOAT 154 219 End Class … … 198 263 Return Substract(This,SrcVec) 199 264 End Function 200 /* Function Operator * (SrcVec As Vector2d) As Vector2d265 /* Function Operator * (SrcVec As Vector2d) As GLdouble 201 266 Return Dot(This,SrcVec) 202 267 End Function*/ … … 248 313 Return SrcVec1.X*SrcVec2.X+SrcVec1.Y*SrcVec2.Y 249 314 End Function 315 Function Empty() As Vector2d 316 Return New Vector2d() 317 End Function 250 318 Function Magnitude() As GLdouble 251 319 Return Math.Sqrt(This.X^2+This.Y^2) As GLdouble … … 272 340 End Function 273 341 274 Public 342 Public /* Object Class Override */ 343 Override Function Equals( object As Object ) As Boolean 344 If This.GetHashCode() = object.GetHashCode() Then 345 Return True 346 Else 347 Return False 348 End If 349 End Function 350 Override Function ToString() As String 351 Return GetType().Name 352 End Function 353 354 Public /* Data */ 275 355 xz As XY_DOUBLE 276 356 End Class … … 342 422 Return Substract(This,SrcVec) 343 423 End Function 344 /* Function Operator * (SrcVec As Vector3f) As Vector3f424 /* Function Operator * (SrcVec As Vector3f) As GLfloat 345 425 Return Dot(This,SrcVec) 346 426 End Function*/ … … 384 464 Public /* method */ 385 465 Function Add(SrcVec1 As Vector3f, SrcVec2 As Vector3f) As Vector3f 386 Dim ret As Vector3f(SrcVec1.X+SrcVec2.X,SrcVec1.Y+SrcVec2.Y,SrcVec1.Z -SrcVec2.Z)466 Dim ret As Vector3f(SrcVec1.X+SrcVec2.X,SrcVec1.Y+SrcVec2.Y,SrcVec1.Z+SrcVec2.Z) 387 467 Return ret 388 468 End Function … … 399 479 Return SrcVec1.X*SrcVec2.X+SrcVec1.Y*SrcVec2.Y+SrcVec1.Z*SrcVec2.Z 400 480 End Function 481 Function Empty() As Vector3f 482 Return New Vector3f() 483 End Function 401 484 Function Magnitude() As GLfloat 402 485 Return Math.Sqrt(This.X^2+This.Y^2+This.Z^2) As GLfloat … … 423 506 End Function 424 507 425 Public 508 Public /* Object Class Override */ 509 Override Function Equals( object As Object ) As Boolean 510 If This.GetHashCode() = object.GetHashCode() Then 511 Return True 512 Else 513 Return False 514 End If 515 End Function 516 Override Function ToString() As String 517 Return GetType().Name 518 End Function 519 520 Public /* Data */ 426 521 xyz As XYZ_FLOAT 427 522 End Class … … 482 577 Return Substract(This,SrcVec) 483 578 End Function 484 /* Function Operator * (SrcVec As Vector3d) As Vector3d579 /* Function Operator * (SrcVec As Vector3d) As GLdouble 485 580 Return Dot(This,SrcVec) 486 581 End Function*/ … … 525 620 Public /* method */ 526 621 Function Add(SrcVec1 As Vector3d, SrcVec2 As Vector3d) As Vector3d 527 Dim ret As Vector3d(SrcVec1.X+SrcVec2.X,SrcVec1.Y+SrcVec2.Y,SrcVec1.Z -SrcVec2.Z)622 Dim ret As Vector3d(SrcVec1.X+SrcVec2.X,SrcVec1.Y+SrcVec2.Y,SrcVec1.Z+SrcVec2.Z) 528 623 Return ret 529 624 End Function … … 540 635 Return SrcVec1.X*SrcVec2.X+SrcVec1.Y*SrcVec2.Y+SrcVec1.Z*SrcVec2.Z 541 636 End Function 637 Function Empty() As Vector3d 638 Dim ret As Vector3d() 639 Return ret 640 End Function 542 641 Function Magnitude() As GLdouble 543 642 Return Math.Sqrt(This.X^2+This.Y^2+This.Z^2) As GLdouble … … 564 663 End Function 565 664 566 Public 665 Public /* Object Class Override */ 666 Override Function Equals( object As Object ) As Boolean 667 If This.GetHashCode() = object.GetHashCode() Then 668 Return True 669 Else 670 Return False 671 End If 672 End Function 673 Override Function ToString() As String 674 Return GetType().Name 675 End Function 676 677 Public /* Data */ 567 678 xyz As XYZ_DOUBLE 568 679 End Class 569 680 681 NameSpace Matrix 682 Class Matrix3x3f 683 End Class 684 685 Class Matrix3x3d 686 End Class 687 688 Class Matrix4x4f 689 End Class 690 691 Class Matrix4x4d 692 End Class 693 End NameSpace 570 694 571 695 Type RGB_FLOAT … … 949 1073 Dim g As GLfloat 950 1074 Dim b As GLfloat 951 Dim a As GLfloat952 1075 If h<0 Then h+=360.0 953 1076 If h>360.0 Then h-=360.0 … … 1226 1349 End Class 1227 1350 1228 Class Material 1351 Class LightsCollection 1352 Public 1353 Function Item() As Light 1354 Return 1355 End Function 1356 End Class 1357 1358 Class MaterialManager 1229 1359 Public 1230 1360 Sub Ambient(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat) … … 1318 1448 End Class 1319 1449 1320 Class ModelView 1450 Class ModelViewMatrix 1321 1451 Public 1322 1452 Sub LoadIdentity() … … 1392 1522 Sub Translate(x As GLdouble, y As GLdouble, z As GLdouble) 1393 1523 Dim mode As GLenum 1394 glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode) )1524 glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode) As *GLint) 1395 1525 If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW) 1396 1526 glTranslated(x, y, z) … … 1406 1536 End Class 1407 1537 1408 Class Projection 1538 Class ProjectionMatrix 1409 1539 Public 1410 1540 Sub LoadIdentity() … … 1417 1547 Sub Ortho2D(left As GLdouble, right As GLdouble, bottom As GLdouble, top As GLdouble) 1418 1548 Dim mode As GLenum 1419 glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode) )1549 glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode) As *Long) 1420 1550 If mode<>GL_PROJECTION Then glMatrixMode(GL_PROJECTION) 1421 1551 gluOrtho2D(left, right, bottom, top) … … 1445 1575 End Class 1446 1576 1447 Class Transform 1577 Class TransformMatrix 1448 1578 Public 1449 Projection As Projection 1450 ModelView As ModelView 1579 Projection As ProjectionMatrix 1580 ModelView As ModelViewMatrix 1581 1582 Public 1583 Sub Transform() 1584 Projection=New ProjectionMatrix 1585 ModelView=New ModelViewMatrix 1586 End Sub 1451 1587 End Class 1452 1588 1453 Class LightModel 1589 Class LightModelManager 1454 1590 Public 1455 1591 Function Ambient () As Color4f … … 1491 1627 Class RenderStateManager 1492 1628 Public /* Composiotion */ 1493 LightModel As LightModel 1629 LightModel As LightModelManager 1494 1630 1495 1631 Public 1632 Sub RenderStateManager() 1633 LightModel = New LightModelManager() 1634 End Sub 1496 1635 Function AlphaTestEnable() As GLboolean 1497 1636 Dim alpha As GLboolean … … 1810 1949 Class RenderingContext 1811 1950 Public /* Composiotion */ 1812 Material As Material 1951 Material As MaterialManager 1813 1952 RenderState As RenderStateManager 1814 Transform As Transform 1815 Lights [ELM(8)] As Light1953 Transform As TransformMatrix 1954 Lights As LightsCollection 1816 1955 1817 1956 Public /* Constructor */ … … 1824 1963 End If 1825 1964 1826 Lights[0].Light(GL_LIGHT0) 1827 Lights[1].Light(GL_LIGHT1) 1828 Lights[2].Light(GL_LIGHT2) 1829 Lights[3].Light(GL_LIGHT3) 1830 Lights[4].Light(GL_LIGHT4) 1831 Lights[5].Light(GL_LIGHT5) 1832 Lights[6].Light(GL_LIGHT6) 1833 Lights[7].Light(GL_LIGHT7) 1965 Material = New MaterialManager() 1966 RenderState = New RenderStateManager() 1967 Transform = New TransformMatrix() 1968 Lights = New LightsCollection() 1834 1969 End Sub 1835 1970 Sub RenderingContext(hdc As HDC, ByRef pfd As PIXELFORMATDESCRIPTOR) … … 1851 1986 wglMakeCurrent(hdc,hrc) 1852 1987 End Sub 1853 Sub RenderingContext(hdc As HDC, ByRef ctype As ColorType, ByRefbtype As BufferType)1988 Sub RenderingContext(hdc As HDC, ctype As ColorType, btype As BufferType) 1854 1989 RenderingContext() 1855 1990 … … 1857 1992 pfd.nSize=SizeOf(PIXELFORMATDESCRIPTOR) As Word 1858 1993 pfd.nVersion=GL_VERSION_1_1 1859 If btype=BufferType.DoubleBuffer As LongThen1994 If btype=BufferType.DoubleBuffer Then 1860 1995 pfd.dwFlags or=PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL or PFD_DOUBLEBUFFER 1861 1996 Else 1862 1997 pfd.dwFlags or=PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL 1863 1998 End If 1864 If ctype=ColorType.RgbColor As LongThen1999 If ctype=ColorType.RgbColor Then 1865 2000 pfd.iPixelType=PFD_TYPE_RGBA 1866 2001 Else … … 2025 2160 End Class 2026 2161 2027 2028 2029 2162 #endif
Note:
See TracChangeset
for help on using the changeset viewer.