| 1 | # PySoy Scenes Declarations |
|---|
| 2 | # |
|---|
| 3 | # Copyright (C) 2006,2007,2008 PySoy Group |
|---|
| 4 | # |
|---|
| 5 | # This program is free software; you can redistribute it and/or modify |
|---|
| 6 | # it under the terms of the GNU Affero General Public License as published |
|---|
| 7 | # by the Free Software Foundation, either version 3 of the License, or |
|---|
| 8 | # (at your option) any later version. |
|---|
| 9 | # |
|---|
| 10 | # This program is distributed in the hope that it will be useful, |
|---|
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | # GNU Affero General Public License for more details. |
|---|
| 14 | # |
|---|
| 15 | # You should have received a copy of the GNU Affero General Public License |
|---|
| 16 | # along with this program; if not, see http://www.gnu.org/licenses |
|---|
| 17 | # |
|---|
| 18 | # $Id$ |
|---|
| 19 | |
|---|
| 20 | cimport gl |
|---|
| 21 | cimport glib |
|---|
| 22 | cimport ode |
|---|
| 23 | cimport py |
|---|
| 24 | cimport math |
|---|
| 25 | cimport soy._internals |
|---|
| 26 | cimport soy._datatypes |
|---|
| 27 | cimport soy.colors |
|---|
| 28 | cimport soy.materials |
|---|
| 29 | |
|---|
| 30 | cdef : |
|---|
| 31 | struct Face : |
|---|
| 32 | unsigned short a |
|---|
| 33 | unsigned short b |
|---|
| 34 | unsigned short c |
|---|
| 35 | |
|---|
| 36 | struct Quad : |
|---|
| 37 | unsigned int a |
|---|
| 38 | unsigned int b |
|---|
| 39 | unsigned int c |
|---|
| 40 | unsigned int d |
|---|
| 41 | |
|---|
| 42 | struct Vert : |
|---|
| 43 | float px |
|---|
| 44 | float py |
|---|
| 45 | float pz |
|---|
| 46 | float nx |
|---|
| 47 | float ny |
|---|
| 48 | float nz |
|---|
| 49 | float tx |
|---|
| 50 | float ty |
|---|
| 51 | float tz |
|---|
| 52 | float ux |
|---|
| 53 | float uy |
|---|
| 54 | float uz |
|---|
| 55 | |
|---|
| 56 | cdef void _prerunField(void*, void*, void*) nogil |
|---|
| 57 | cdef void _runField(void*, void*, void*) nogil |
|---|
| 58 | |
|---|
| 59 | cdef class Scene (soy._internals.Loopable) : |
|---|
| 60 | cdef ode.dWorldID _worldID |
|---|
| 61 | cdef ode.dSpaceID _spaceID |
|---|
| 62 | cdef ode.dJointGroupID _contactGroup |
|---|
| 63 | cdef soy._internals.Children _bodies |
|---|
| 64 | cdef soy._internals.Children _fields |
|---|
| 65 | cdef soy._internals.Children _joints |
|---|
| 66 | cdef soy._internals.Children _lights |
|---|
| 67 | cdef soy._internals.PointerSet _giveFields |
|---|
| 68 | cdef soy._internals.PointerSet _callFields |
|---|
| 69 | cdef soy.colors.Color _ambient |
|---|
| 70 | cdef float _fogDensity |
|---|
| 71 | cdef void* _stepMutex |
|---|
| 72 | cdef void _stepLock ( self ) nogil |
|---|
| 73 | cdef int _stepTryLock ( self ) nogil |
|---|
| 74 | cdef void _stepUnLock ( self ) nogil |
|---|
| 75 | cdef ode.dReal _stepSize |
|---|
| 76 | cdef ode.dReal _friction |
|---|
| 77 | cdef double _prevTime |
|---|
| 78 | cdef double _time |
|---|
| 79 | # _coreloop methods |
|---|
| 80 | cdef void _render ( self, |
|---|
| 81 | gl.GLdouble, gl.GLdouble, |
|---|
| 82 | gl.GLdouble, gl.GLdouble ) |
|---|
| 83 | cdef int _steps ( self ) nogil |
|---|
| 84 | cdef void _callback ( self, |
|---|
| 85 | ode.dGeomID, |
|---|
| 86 | ode.dGeomID ) nogil |
|---|
| 87 | |
|---|
| 88 | |
|---|
| 89 | cdef class Landscape (Scene) : |
|---|
| 90 | cdef ode.dGeomID _geomID |
|---|
| 91 | cdef ode.dHeightfieldDataID _heightfieldDataID |
|---|
| 92 | cdef float _position[3] |
|---|
| 93 | cdef float _width |
|---|
| 94 | cdef float _height |
|---|
| 95 | cdef float _depth |
|---|
| 96 | cdef soy.textures.Texture _pyMap |
|---|
| 97 | cdef soy.textures.Texture _tzMap |
|---|
| 98 | cdef soy.materials.Material _material |
|---|
| 99 | cdef Vert* _vertArray |
|---|
| 100 | cdef gl.GLuint _vertBuffer |
|---|
| 101 | cdef Vert* _backArray |
|---|
| 102 | cdef gl.GLuint _backBuffer |
|---|
| 103 | cdef Quad* _faceArray |
|---|
| 104 | cdef gl.GLuint _faceBuffer |
|---|
| 105 | cdef void _createBuffer ( self ) |
|---|
| 106 | cdef void _createArrays ( self ) |
|---|
| 107 | |
|---|
| 108 | cdef class Planar (Scene) : |
|---|
| 109 | cdef ode.dGeomID _planeID |
|---|
| 110 | cdef float _offset |
|---|
| 111 | cdef soy.materials.Material _material |
|---|
| 112 | cdef Vert _verts[60] |
|---|
| 113 | cdef Face _faces[40] |
|---|
| 114 | cdef Vert _midpoint(self, Vert, Vert) |
|---|