Changeset 287 for Include


Ignore:
Timestamp:
Aug 12, 2007, 1:05:08 PM (17 years ago)
Author:
NoWest
Message:

ちょこちょこ改良というかエラーが出ない程度に修正しました。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Include/abgl.ab

    r157 r287  
    22#define _INC_ABGL
    33
    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
     7Enum VertexFormatsf
     8    PositionOnly
     9    PositionColoered
     10End Enum
     11
     12Enum VertexFormatsd
     13    PositionOnly
     14    PositionColoered
     15End Enum
     16
     17NameSpace 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
     35End NameSpace
     36
     37NameSpace 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
     55End NameSpace
     56
     57Class VertexBuffer
    1158Public
    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
    2264Public
     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
    2373End Class
    2474
     
    77127        Return Substract(This,SrcVec)
    78128    End Function
    79 /*  Function Operator * (SrcVec As Vector2f) As Vector2f
     129/*  Function Operator * (SrcVec As Vector2f) As GLfloat
    80130        Return Dot(This,SrcVec)
    81131    End Function*/
     
    124174    End Function
    125175    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()
    127180    End Function
    128181    Function Magnitude() As GLfloat
     
    150203    End Function
    151204
    152 Protected
     205Public /* 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
     217Protected /* Data */
    153218    xy As XY_FLOAT
    154219End Class
     
    198263        Return Substract(This,SrcVec)
    199264    End Function
    200 /*  Function Operator * (SrcVec As Vector2d) As Vector2d
     265/*  Function Operator * (SrcVec As Vector2d) As GLdouble
    201266        Return Dot(This,SrcVec)
    202267    End Function*/
     
    248313        Return SrcVec1.X*SrcVec2.X+SrcVec1.Y*SrcVec2.Y
    249314    End Function
     315    Function Empty() As Vector2d
     316        Return New Vector2d()
     317    End Function
    250318    Function Magnitude() As GLdouble
    251319        Return Math.Sqrt(This.X^2+This.Y^2) As GLdouble
     
    272340    End Function
    273341
    274 Public
     342Public /* 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
     354Public /* Data */
    275355    xz As XY_DOUBLE
    276356End Class
     
    342422        Return Substract(This,SrcVec)
    343423    End Function
    344 /*  Function Operator * (SrcVec As Vector3f) As Vector3f
     424/*  Function Operator * (SrcVec As Vector3f) As GLfloat
    345425        Return Dot(This,SrcVec)
    346426    End Function*/
     
    384464Public /* method */
    385465    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)
    387467        Return ret
    388468    End Function
     
    399479        Return SrcVec1.X*SrcVec2.X+SrcVec1.Y*SrcVec2.Y+SrcVec1.Z*SrcVec2.Z
    400480    End Function
     481    Function Empty() As Vector3f
     482        Return New Vector3f()
     483    End Function
    401484    Function Magnitude() As GLfloat
    402485        Return Math.Sqrt(This.X^2+This.Y^2+This.Z^2) As GLfloat
     
    423506    End Function
    424507
    425 Public
     508Public /* 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
     520Public /* Data */
    426521    xyz As XYZ_FLOAT
    427522End Class
     
    482577        Return Substract(This,SrcVec)
    483578    End Function
    484 /*  Function Operator * (SrcVec As Vector3d) As Vector3d
     579/*  Function Operator * (SrcVec As Vector3d) As GLdouble
    485580        Return Dot(This,SrcVec)
    486581    End Function*/
     
    525620Public /* method */
    526621    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)
    528623        Return ret
    529624    End Function
     
    540635        Return SrcVec1.X*SrcVec2.X+SrcVec1.Y*SrcVec2.Y+SrcVec1.Z*SrcVec2.Z
    541636    End Function
     637    Function Empty() As Vector3d
     638        Dim ret As Vector3d()
     639        Return ret
     640    End Function
    542641    Function Magnitude() As GLdouble
    543642        Return Math.Sqrt(This.X^2+This.Y^2+This.Z^2) As GLdouble
     
    564663    End Function
    565664
    566 Public
     665Public /* 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
     677Public /* Data */
    567678    xyz As XYZ_DOUBLE
    568679End Class
    569680
     681NameSpace 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
     693End NameSpace
    570694
    571695Type RGB_FLOAT
     
    9491073        Dim g As GLfloat
    9501074        Dim b As GLfloat
    951         Dim a As GLfloat
    9521075        If h<0 Then h+=360.0
    9531076        If h>360.0 Then h-=360.0
     
    12261349End Class
    12271350
    1228 Class Material
     1351Class LightsCollection
     1352Public
     1353    Function Item() As Light
     1354        Return
     1355    End Function
     1356End Class
     1357
     1358Class MaterialManager
    12291359Public
    12301360    Sub Ambient(red As GLfloat, green As GLfloat, blue As GLfloat, alpha As GLfloat)
     
    13181448End Class
    13191449
    1320 Class ModelView
     1450Class ModelViewMatrix
    13211451Public
    13221452    Sub LoadIdentity()
     
    13921522    Sub Translate(x As GLdouble, y As GLdouble, z As GLdouble)
    13931523        Dim mode As GLenum
    1394         glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
     1524        glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode) As *GLint)
    13951525        If mode<>GL_MODELVIEW Then glMatrixMode(GL_MODELVIEW)
    13961526        glTranslated(x, y, z)
     
    14061536End Class
    14071537
    1408 Class Projection
     1538Class ProjectionMatrix
    14091539Public
    14101540    Sub LoadIdentity()
     
    14171547    Sub Ortho2D(left As GLdouble, right As GLdouble, bottom As GLdouble, top As GLdouble)
    14181548        Dim mode As GLenum
    1419         glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode))
     1549        glGetIntegerv(GL_MATRIX_MODE,VarPtr(mode) As *Long)
    14201550        If mode<>GL_PROJECTION Then glMatrixMode(GL_PROJECTION)
    14211551        gluOrtho2D(left, right, bottom, top)
     
    14451575End Class
    14461576
    1447 Class Transform
     1577Class TransformMatrix
    14481578Public
    1449     Projection As Projection
    1450     ModelView As ModelView
     1579    Projection As ProjectionMatrix
     1580    ModelView As ModelViewMatrix
     1581
     1582Public
     1583    Sub Transform()
     1584        Projection=New ProjectionMatrix
     1585        ModelView=New ModelViewMatrix
     1586    End Sub
    14511587End Class
    14521588
    1453 Class LightModel
     1589Class LightModelManager
    14541590Public
    14551591    Function Ambient () As Color4f
     
    14911627Class RenderStateManager
    14921628Public /* Composiotion */
    1493     LightModel As LightModel
     1629    LightModel As LightModelManager
    14941630
    14951631Public
     1632    Sub RenderStateManager()
     1633        LightModel = New LightModelManager()
     1634    End Sub
    14961635    Function AlphaTestEnable() As GLboolean
    14971636        Dim alpha As GLboolean
     
    18101949Class RenderingContext
    18111950Public /* Composiotion */
    1812     Material As Material
     1951    Material As MaterialManager
    18131952    RenderState As RenderStateManager
    1814     Transform As Transform
    1815     Lights[ELM(8)] As Light
     1953    Transform As TransformMatrix
     1954    Lights As LightsCollection
    18161955
    18171956Public /* Constructor */
     
    18241963        End If
    18251964
    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()
    18341969    End Sub
    18351970    Sub RenderingContext(hdc As HDC, ByRef pfd As PIXELFORMATDESCRIPTOR)
     
    18511986        wglMakeCurrent(hdc,hrc)
    18521987    End Sub
    1853     Sub RenderingContext(hdc As HDC, ByRef ctype As ColorType, ByRef btype As BufferType)
     1988    Sub RenderingContext(hdc As HDC, ctype As ColorType, btype As BufferType)
    18541989        RenderingContext()
    18551990
     
    18571992        pfd.nSize=SizeOf(PIXELFORMATDESCRIPTOR) As Word
    18581993        pfd.nVersion=GL_VERSION_1_1
    1859         If btype=BufferType.DoubleBuffer As Long Then
     1994        If btype=BufferType.DoubleBuffer Then
    18601995            pfd.dwFlags or=PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL or PFD_DOUBLEBUFFER
    18611996        Else
    18621997            pfd.dwFlags or=PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL
    18631998        End If
    1864         If ctype=ColorType.RgbColor As Long Then
     1999        If ctype=ColorType.RgbColor Then
    18652000            pfd.iPixelType=PFD_TYPE_RGBA
    18662001        Else
     
    20252160End Class
    20262161
    2027 
    2028 
    20292162#endif
Note: See TracChangeset for help on using the changeset viewer.