Here are some patches to help Soya 0.13 compile cleanly
with Pyrex 0.9.6.1, and to fix a couple of bugs.
Notes about the patches:
#U# marks code that I commented out because it was
generating unused code warnings.
I found a few places where local variables were not
initialised. It wasn't always clear what the correct
initial value should be, so I marked these with
POSSIBLE BUG.
--
Greg
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/base.pyx Soya-0.13-new/base.pyx
--- Soya-0.13/base.pyx 2007-01-16 10:43:07.000000000 +1300
+++ Soya-0.13-new/base.pyx 2007-10-09 19:15:51.000000000 +1300
@@ -60,7 +60,7 @@ CAN_USE_TEX_BORDER = 1
cdef Renderer renderer
-cdef int MAX_LIGHTS, MAX_CLIP_PLANES, MAX_TEXTURES, MAX_TEXTURE_SIZE
+cdef GLint MAX_LIGHTS, MAX_CLIP_PLANES, MAX_TEXTURES, MAX_TEXTURE_SIZE
def get_max_texture_size():
return MAX_TEXTURE_SIZE
@@ -113,8 +113,13 @@ cdef class _CObj:
pass
def __getstate__(self):
- if getattr(self, "__dict__", 0): return self.__getcstate__(),
self.__dict__
- else: return self.__getcstate__(),
+ cdef object d
+ try:
+ d = getattr(self, "__dict__")
+ except:
+ return self.__getcstate__()
+ else:
+ return self.__getcstate__(), d
def __setstate__(self, state):
self.__setcstate__(state[0])
@@ -136,8 +141,8 @@ cdef class _CObj:
return clone
-cdef chunk_to_string(Chunk* chunk):
- return PyString_FromStringAndSize(<char*> chunk.content, chunk.nb)
+#U#cdef chunk_to_string(Chunk* chunk):
+#U# return PyString_FromStringAndSize(<char*> chunk.content, chunk.nb)
cdef drop_chunk_to_string(Chunk* chunk):
cdef string
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/c.pxd Soya-0.13-new/c.pxd
--- Soya-0.13/c.pxd 2006-07-12 08:06:18.000000000 +1200
+++ Soya-0.13-new/c.pxd 2007-03-30 14:01:41.000000000 +1200
@@ -34,7 +34,7 @@ cdef extern from "math.h":
float sin (float x)
float tan (float x)
float exp (float x)
- float pow (float x, int n)
+ float pow (float x, float n)
float ceil (float x)
float floor (float x)
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/cal3d/model.pyx Soya-0.13-new/cal3d/model.pyx
--- Soya-0.13/cal3d/model.pyx 2006-11-21 12:26:39.000000000 +1300
+++ Soya-0.13-new/cal3d/model.pyx 2007-03-30 14:01:41.000000000 +1200
@@ -677,8 +677,11 @@ cdef class _AnimatedModel(_Model):
CalCoreModel_CreateCoreMaterialThread(self._core_model,
i)
CalCoreModel_SetCoreMaterialId(self._core_model, i, 0,
i)
CalCoreMaterial_SetUserData(material, <CalUserData> i)
-
- CalRenderer_GetMapUserData
+
+ # Greg Ewing, March 2007 ([EMAIL PROTECTED])
+ # Following line commented out as it wasn't doing anything and
was causing
+ # a compiler warning. POSSIBLE BUG.
+ #CalRenderer_GetMapUserData
# This method is split in 3 ; this is a work-around for a bug in Pyrex
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/cal3d_wrapper.h Soya-0.13-new/cal3d_wrapper.h
--- Soya-0.13/cal3d_wrapper.h 2006-05-21 10:43:18.000000000 +1200
+++ Soya-0.13-new/cal3d_wrapper.h 2007-03-30 14:01:41.000000000 +1200
@@ -188,7 +188,7 @@ extern "C"
// CalCoreAnimation wrapper functions declaration
//
//****************************************************************************//
- CAL3D_WRAPPER_API struct CalCoreAnimation *CalCoreAnimation_New();
+ CAL3D_WRAPPER_API struct CalCoreAnimation *CalCoreAnimation_New(void);
CAL3D_WRAPPER_API void CalCoreAnimation_Delete(struct CalCoreAnimation
*self);
CAL3D_WRAPPER_API void CalCoreAnimation_AddCoreTrack(struct CalCoreAnimation
*self, struct CalCoreTrack *pCoreTrack);
@@ -231,7 +231,7 @@ extern "C"
CAL3D_WRAPPER_API struct CalQuaternion *CalCoreKeyframe_GetRotation(struct
CalCoreKeyframe *self);
CAL3D_WRAPPER_API float CalCoreKeyframe_GetTime(struct CalCoreKeyframe
*self);
CAL3D_WRAPPER_API struct CalVector *CalCoreKeyframe_GetTranslation(struct
CalCoreKeyframe *self);
- CAL3D_WRAPPER_API struct CalCoreKeyframe *CalCoreKeyframe_New();
+ CAL3D_WRAPPER_API struct CalCoreKeyframe *CalCoreKeyframe_New(void);
CAL3D_WRAPPER_API void CalCoreKeyframe_SetRotation(struct CalCoreKeyframe
*self, struct CalQuaternion *pRotation);
CAL3D_WRAPPER_API void CalCoreKeyframe_SetTime(struct CalCoreKeyframe *self,
float time);
CAL3D_WRAPPER_API void CalCoreKeyframe_SetTranslation(struct CalCoreKeyframe
*self, struct CalVector *pTranslation);
@@ -240,7 +240,7 @@ extern "C"
// CalCoreMaterial wrapper functions declaration
//
//****************************************************************************//
- CAL3D_WRAPPER_API struct CalCoreMaterial *CalCoreMaterial_New();
+ CAL3D_WRAPPER_API struct CalCoreMaterial *CalCoreMaterial_New(void);
CAL3D_WRAPPER_API void CalCoreMaterial_Delete(struct CalCoreMaterial *self);
// CAL3D_WRAPPER_API CalCoreMaterial::Color
*CalCoreMaterial_GetAmbientColor(struct CalCoreMaterial *self);
@@ -265,7 +265,7 @@ extern "C"
// CalCoreMesh wrapper functions declaration
//
//****************************************************************************//
- CAL3D_WRAPPER_API struct CalCoreMesh *CalCoreMesh_New();
+ CAL3D_WRAPPER_API struct CalCoreMesh *CalCoreMesh_New(void);
CAL3D_WRAPPER_API void CalCoreMesh_Delete(struct CalCoreMesh *self);
CAL3D_WRAPPER_API int CalCoreMesh_AddCoreSubmesh(struct CalCoreMesh *self,
struct CalCoreSubmesh *pCoreSubmesh);
@@ -308,7 +308,7 @@ extern "C"
// CalCoreSkeleton wrapper functions declaration
//
//****************************************************************************//
- CAL3D_WRAPPER_API struct CalCoreSkeleton *CalCoreSkeleton_New();
+ CAL3D_WRAPPER_API struct CalCoreSkeleton *CalCoreSkeleton_New(void);
CAL3D_WRAPPER_API void CalCoreSkeleton_Delete(struct CalCoreSkeleton* self);
CAL3D_WRAPPER_API int CalCoreSkeleton_AddCoreBone(struct CalCoreSkeleton
*self, struct CalCoreBone *pCoreBone);
@@ -334,7 +334,7 @@ extern "C"
// CAL3D_WRAPPER_API
std::vector<std::vector<CalCoreSubmesh::TextureCoordinate> >&
CalCoreSubmesh_GetVectorVectorTextureCoordinate(struct CalCoreSubmesh *self);
// CAL3D_WRAPPER_API std::vector<CalCoreSubmesh::Vertex>&
CalCoreSubmesh_GetVectorVertex(struct CalCoreSubmesh *self);
CAL3D_WRAPPER_API int CalCoreSubmesh_GetVertexCount(struct CalCoreSubmesh
*self);
- CAL3D_WRAPPER_API struct CalCoreSubmesh *CalCoreSubmesh_New();
+ CAL3D_WRAPPER_API struct CalCoreSubmesh *CalCoreSubmesh_New(void);
CAL3D_WRAPPER_API enum Boolean CalCoreSubmesh_Reserve(struct CalCoreSubmesh
*self, int vertexCount, int textureCoordinateCount, int faceCount, int
springCount);
CAL3D_WRAPPER_API void CalCoreSubmesh_SetCoreMaterialThreadId(struct
CalCoreSubmesh *self, int coreMaterialThreadId);
// CAL3D_WRAPPER_API enum Boolean CalCoreSubmesh_SetFace(struct
CalCoreSubmesh *self, int faceId, struct CalCoreSubmesh::Face *pFace);
@@ -355,7 +355,7 @@ CAL3D_WRAPPER_API enum Boolean CalCoreS
CAL3D_WRAPPER_API int CalCoreTrack_GetCoreBoneId(struct CalCoreTrack *self);
// CAL3D_WRAPPER_API std::map<float, CalCoreKeyframe *>&
CalCoreTrack_GetMapCoreKeyframe(struct CalCoreTrack *self);
CAL3D_WRAPPER_API enum Boolean CalCoreTrack_GetState(struct CalCoreTrack
*self, float time, struct CalVector *pTranslation, struct CalQuaternion
*pRotation);
- CAL3D_WRAPPER_API struct CalCoreTrack *CalCoreTrack_New();
+ CAL3D_WRAPPER_API struct CalCoreTrack *CalCoreTrack_New(void);
CAL3D_WRAPPER_API enum Boolean CalCoreTrack_SetCoreBoneId(struct
CalCoreTrack *self, int coreBoneId);
//****************************************************************************//
@@ -385,19 +385,19 @@ CAL3D_WRAPPER_API enum Boolean CalCoreS
ERROR_CODE_MAX_ERROR_CODE
};
- CAL3D_WRAPPER_API enum CalErrorCode CalError_GetLastErrorCode();
- CAL3D_WRAPPER_API char *CalError_GetLastErrorDescription();
- CAL3D_WRAPPER_API char *CalError_GetLastErrorFile();
- CAL3D_WRAPPER_API int CalError_GetLastErrorLine();
- CAL3D_WRAPPER_API char *CalError_GetLastErrorText();
- CAL3D_WRAPPER_API void CalError_PrintLastError();
+ CAL3D_WRAPPER_API enum CalErrorCode CalError_GetLastErrorCode(void);
+ CAL3D_WRAPPER_API char *CalError_GetLastErrorDescription(void);
+ CAL3D_WRAPPER_API char *CalError_GetLastErrorFile(void);
+ CAL3D_WRAPPER_API int CalError_GetLastErrorLine(void);
+ CAL3D_WRAPPER_API char *CalError_GetLastErrorText(void);
+ CAL3D_WRAPPER_API void CalError_PrintLastError(void);
// CAL3D_WRAPPER_API void CalError_SetLastError(enum CalErrorCode code, char
*strFile, int line, char *strText);
//****************************************************************************//
// CalLoader wrapper functions declaration
//
//****************************************************************************//
- CAL3D_WRAPPER_API struct CalLoader *CalLoader_New();
+ CAL3D_WRAPPER_API struct CalLoader *CalLoader_New(void);
CAL3D_WRAPPER_API void CalLoader_Delete(struct CalLoader *self);
CAL3D_WRAPPER_API struct CalCoreAnimation
*CalLoader_LoadCoreAnimation(struct CalLoader *self, char *strFilename);
CAL3D_WRAPPER_API struct CalCoreMaterial *CalLoader_LoadCoreMaterial(struct
CalLoader *self, char *strFilename);
@@ -481,7 +481,7 @@ CAL3D_WRAPPER_API enum Boolean CalCoreS
CAL3D_WRAPPER_API float *CalQuaternion_Get(struct CalQuaternion *self);
CAL3D_WRAPPER_API void CalQuaternion_Multiply(struct CalQuaternion *self,
struct CalQuaternion *pQ);
CAL3D_WRAPPER_API void CalQuaternion_MultiplyVector(struct CalQuaternion
*self, struct CalVector *pV);
- CAL3D_WRAPPER_API struct CalQuaternion *CalQuaternion_New();
+ CAL3D_WRAPPER_API struct CalQuaternion *CalQuaternion_New(void);
CAL3D_WRAPPER_API void CalQuaternion_Op_Multiply(struct CalQuaternion
*pResult, struct CalQuaternion *pQ, struct CalQuaternion *pR);
CAL3D_WRAPPER_API void CalQuaternion_Set(struct CalQuaternion *self, float
qx, float qy, float qz, float qw);
@@ -518,7 +518,7 @@ CAL3D_WRAPPER_API enum Boolean CalCoreS
//****************************************************************************//
CAL3D_WRAPPER_API void CalSaver_Delete(struct CalSaver *self);
- CAL3D_WRAPPER_API struct CalSaver *CalSaver_New();
+ CAL3D_WRAPPER_API struct CalSaver *CalSaver_New(void);
CAL3D_WRAPPER_API enum Boolean CalSaver_SaveCoreAnimation(struct CalSaver
*self, char *strFilename, struct CalCoreAnimation *pCoreAnimation);
CAL3D_WRAPPER_API enum Boolean CalSaver_SaveCoreMaterial(struct CalSaver
*self, char *strFilename, struct CalCoreMaterial *pCoreMaterial);
CAL3D_WRAPPER_API enum Boolean CalSaver_SaveCoreMesh(struct CalSaver *self,
char *strFilename, struct CalCoreMesh *pCoreMesh);
@@ -584,7 +584,7 @@ CAL3D_WRAPPER_API enum Boolean CalCoreS
CAL3D_WRAPPER_API void CalVector_InverseScale(struct CalVector *self, float
d);
CAL3D_WRAPPER_API float *CalVector_Get(struct CalVector *self);
CAL3D_WRAPPER_API float CalVector_Length(struct CalVector *self);
- CAL3D_WRAPPER_API struct CalVector *CalVector_New();
+ CAL3D_WRAPPER_API struct CalVector *CalVector_New(void);
CAL3D_WRAPPER_API float CalVector_Normalize(struct CalVector *self);
CAL3D_WRAPPER_API void CalVector_Op_Add(struct CalVector *pResult, struct
CalVector *pV, struct CalVector *pU);
CAL3D_WRAPPER_API void CalVector_Op_Subtract(struct CalVector *pResult,
struct CalVector *pV, struct CalVector *pU);
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/chunk.c Soya-0.13-new/chunk.c
--- Soya-0.13/chunk.c 2006-06-26 00:41:13.000000000 +1200
+++ Soya-0.13-new/chunk.c 2007-03-30 14:01:41.000000000 +1200
@@ -472,4 +472,3 @@ float chunk_swap_float(float f) {
dat2.b[3] = dat1.b[0];
return dat2.f;
}
-
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/chunk.pxd Soya-0.13-new/chunk.pxd
--- Soya-0.13/chunk.pxd 2006-07-02 20:40:41.000000000 +1200
+++ Soya-0.13-new/chunk.pxd 2007-10-08 00:48:14.000000000 +1300
@@ -17,19 +17,13 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-ctypedef struct Chunk:
- void* content
- int nb
- int max
-
cdef extern from "chunk.h":
-# cdef struct _Chunk:
-# void* content
-# int nb
-# int max
-
-# ctypedef _Chunk Chunk
-
+
+ ctypedef struct Chunk:
+ void* content
+ int nb
+ int max
+
Chunk* chunk_new ()
int chunk_dealloc (Chunk*)
int chunk_check_error ()
@@ -50,8 +44,8 @@ cdef extern from "chunk.h":
int drop_chunk (Chunk*)
- int chunk_add_chars_endian_safe (Chunk*, char* , int)
- int chunk_get_chars_endian_safe (Chunk*, char* , int)
+ int chunk_add_chars_endian_safe (Chunk*, void* , int)
+ int chunk_get_chars_endian_safe (Chunk*, void* , int)
int chunk_add_ints_endian_safe (Chunk*, int* , int)
int chunk_get_ints_endian_safe (Chunk*, int* , int)
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/definitions/base.pxd
Soya-0.13-new/definitions/base.pxd
--- Soya-0.13/definitions/base.pxd 2006-08-24 05:23:35.000000000 +1200
+++ Soya-0.13-new/definitions/base.pxd 2007-03-30 14:01:41.000000000 +1200
@@ -237,29 +237,30 @@ cdef enum:
NETWORK_STATE_HAS_POSITION = 1 << 0
NETWORK_STATE_HAS_SCALING = 1 << 1
-ctypedef struct Frustum:
-## Frustum
-## points :
-## 15-------12
-## |\ /|
-## | \ / |
-## | 3---0 |
-## | | | |
-## | 6---9 |
-## | / \ |
-## |/ \|
-## 18-------21
-##
-## plane[ 0] : front plane
-## plane[ 4] : top plane
-## plane[ 8] : bottom plane
-## plane[12] : right plane
-## plane[16] : left plane
-## plane[20] : back plane
-## plane normals are oriented toward the exterior of the frustum
- float position[3] # camera position (x,y,z)
- float points [24] # points : (x,y,z) * 8
- float planes [24] # planes equation : (a,b,c,d) * 6
+cdef extern from "matrix.h":
+ ctypedef struct Frustum:
+ ## Frustum
+ ## points :
+ ## 15-------12
+ ## |\ /|
+ ## | \ / |
+ ## | 3---0 |
+ ## | | | |
+ ## | 6---9 |
+ ## | / \ |
+ ## |/ \|
+ ## 18-------21
+ ##
+ ## plane[ 0] : front plane
+ ## plane[ 4] : top plane
+ ## plane[ 8] : bottom plane
+ ## plane[12] : right plane
+ ## plane[16] : left plane
+ ## plane[20] : back plane
+ ## plane normals are oriented toward the exterior of the frustum
+ float position[3] # camera position (x,y,z)
+ float points [24] # points : (x,y,z) * 8
+ float planes [24] # planes equation : (a,b,c,d) * 6
cdef struct _Pack: # See material.pyx for doc and comments
int option
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/definitions/model/terrain.pxd
Soya-0.13-new/definitions/model/terrain.pxd
--- Soya-0.13/definitions/model/terrain.pxd 2006-08-24 05:23:34.000000000
+1200
+++ Soya-0.13-new/definitions/model/terrain.pxd 2007-03-30 14:01:41.000000000
+1200
@@ -54,7 +54,7 @@ cdef struct _TerrainTri:
int texcoord_type # 0: use terrainvertex texcoord, 1, 2, 3, 4:
the tri use a texture generated (from blend_material), and the texcoord are
(0.0, 0.0) - (1.0, 1.0)
ctypedef _TerrainTri TerrainTri
-ctypedef void (*terrain_drawColor_FUNC )(float*)
+ctypedef void (*terrain_drawColor_FUNC )(GLfloat*)
ctypedef void (*terrain_disableColor_FUNC)()
ctypedef void (*terrain_enableColor_FUNC )()
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/definitions/ode/ctype.pxd
Soya-0.13-new/definitions/ode/ctype.pxd
--- Soya-0.13/definitions/ode/ctype.pxd 2007-01-12 04:26:50.000000000 +1300
+++ Soya-0.13-new/definitions/ode/ctype.pxd 2007-03-30 14:01:41.000000000
+1200
@@ -15,6 +15,8 @@
# author:
# edited by Marmoute - Pierre-Yves David - [EMAIL PROTECTED]
+cdef extern from "ode_check.h":
+ pass
cdef extern from "ode/ode.h":
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/init.pyx Soya-0.13-new/init.pyx
--- Soya-0.13/init.pyx 2006-07-02 20:40:41.000000000 +1200
+++ Soya-0.13-new/init.pyx 2007-03-30 14:01:41.000000000 +1200
@@ -233,7 +233,7 @@ def set_video(int width, int height, int
renderer.screen_width = width
renderer.screen_height = height
# Information about the current video settings
- info = SDL_GetVideoInfo()
+ info = <SDL_VideoInfo*> SDL_GetVideoInfo() # cast for constness
adjustment
if info == NULL:
s = "Video query failed : %s" % SDL_GetError()
print s
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/model/model.pyx Soya-0.13-new/model/model.pyx
--- Soya-0.13/model/model.pyx 2007-01-20 07:01:06.000000000 +1300
+++ Soya-0.13-new/model/model.pyx 2007-10-08 00:50:09.000000000 +1300
@@ -78,10 +78,10 @@ cdef class _Model(_CObj):
# int normal
# int v[4] # v[3] is optional (only for quad, unused for triangle)
-cdef int face_vertices_number(ModelFace* self):
- if self.option & FACE_TRIANGLE: return 3
- elif self.option & FACE_QUAD: return 4
- return 0
+#U#cdef int face_vertices_number(ModelFace* self):
+#U# if self.option & FACE_TRIANGLE: return 3
+#U# elif self.option & FACE_QUAD: return 4
+#U# return 0
cdef class _SimpleModel(_Model):
@@ -736,7 +736,7 @@ and if the angle between their 2 faces i
# find face neighbors
if self._option & MODEL_NEIGHBORS:
self._neighbors = <int *> malloc(self._nb_faces *
4 * sizeof(int ))
- self._neighbors_side = <char*> malloc(self._nb_faces *
4 * sizeof(char))
+ self._neighbors_side = <signed char*>
malloc(self._nb_faces * 4 * sizeof(char))
self._compute_face_neighbors(faces, vertex2ivertex,
ivertex2vertices, self._neighbors, self._neighbors_side)
# find face simple neighbors (doesn't take angle into account)
@@ -744,7 +744,7 @@ and if the angle between their 2 faces i
# Re-identify vertices, because for simple neighbors we
don't take angle into account
vertex2ivertex, ivertex2vertices =
self._identify_vertices(faces, 360.0)
self._simple_neighbors = <int *>
malloc(self._nb_faces * 4 * sizeof(int ))
- self._simple_neighbors_side = <char*>
malloc(self._nb_faces * 4 * sizeof(char))
+ self._simple_neighbors_side = <signed char*>
malloc(self._nb_faces * 4 * sizeof(char))
self._compute_face_neighbors(faces, vertex2ivertex,
ivertex2vertices, self._simple_neighbors, self._simple_neighbors_side)
# TO DO ?
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/model/terrain.pyx
Soya-0.13-new/model/terrain.pyx
--- Soya-0.13/model/terrain.pyx 2006-11-02 04:08:38.000000000 +1300
+++ Soya-0.13-new/model/terrain.pyx 2007-03-30 15:16:01.000000000 +1200
@@ -203,19 +203,19 @@ cdef void terrain_get_height_at_factors(
k[0] = (- (x - ptr[0]) * w[1] + (z - ptr[2]) * w[0]) * q
-cdef void terrain_drawColor_radeon(float* vect):
- glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, vect)
+#U#cdef void terrain_drawColor_radeon(float* vect):
+#U# glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, vect)
cdef void noop():
pass
-cdef void terrain_disableColor_radeon():
- #glColor4fv(white) # XXX really needed ?
- glDisable(GL_COLOR_MATERIAL)
- glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, white)
+#U#cdef void terrain_disableColor_radeon():
+#U# #glColor4fv(white) # XXX really needed ?
+#U# glDisable(GL_COLOR_MATERIAL)
+#U# glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, white)
-cdef void terrain_enableColor_radeon():
- glEnable(GL_COLOR_MATERIAL)
+#U#cdef void terrain_enableColor_radeon():
+#U# glEnable(GL_COLOR_MATERIAL)
#ctypedef void (*terrain_drawColor_FUNC )(float*)
#ctypedef void (*terrain_disableColor_FUNC)()
@@ -225,7 +225,7 @@ cdef terrain_drawColor_FUNC terrain_d
cdef terrain_disableColor_FUNC terrain_disableColor
cdef terrain_enableColor_FUNC terrain_enableColor
-terrain_drawColor = glColor4fv
+terrain_drawColor = <terrain_drawColor_FUNC> glColor4fv # Const cast
terrain_disableColor = noop
terrain_enableColor = noop
@@ -749,6 +749,9 @@ You MUST call this method after the terr
cshadow_color[2] = shadow_color[2]
cshadow_color[3] = shadow_color[3]
+ scolor = 0 # Greg Ewing, March 2007 ([EMAIL PROTECTED])
+ wcolor = 0 # Uninitialised variables. POSSIBLE BUG.
+
# initialize vertex colors if needed
old_colors = self._colors
self._colors = NULL
@@ -1143,6 +1146,9 @@ You MUST call this method after the terr
cur = renderer.data.nb
pack = <Pack*> chunk_get_ptr(renderer.data)
+ index = 0 # Greg Ewing, March 2007 ([EMAIL PROTECTED])
+ # Uninitialised variable. POSSIBLE BUG.
+
if renderer.state == RENDERER_STATE_OPAQUE:
while pack:
(<_Material> (pack.material_id))._activate()
@@ -1461,10 +1467,10 @@ You MUST call this method after the terr
patch = self._patchs + i
if not sphere_raypick(data,
patch.sphere): continue
# raypick on tris with full
accuracy
- if
self._full_raypick_rect_b(<int> patch.tri_top .v3.coord[0] /
self._scale_factor,
-
<int> patch.tri_top .v3.coord[2] / self._scale_factor,
-
<int> patch.tri_bottom.v3.coord[0] / self._scale_factor,
-
<int> patch.tri_bottom.v3.coord[2] / self._scale_factor,
+ if
self._full_raypick_rect_b(<int> (patch.tri_top .v3.coord[0] /
self._scale_factor),
+
<int> (patch.tri_top .v3.coord[2] / self._scale_factor),
+
<int> (patch.tri_bottom.v3.coord[0] / self._scale_factor),
+
<int> (patch.tri_bottom.v3.coord[2] / self._scale_factor),
data, raypick_data.option): return 1
else:
if raypick_data.option &
RAYPICK_HALF_LINE:
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/ode/collision.pyx
Soya-0.13-new/ode/collision.pyx
--- Soya-0.13/ode/collision.pyx 2006-08-24 05:24:14.000000000 +1200
+++ Soya-0.13-new/ode/collision.pyx 2007-03-30 15:12:40.000000000 +1200
@@ -101,50 +101,50 @@ def collide(_Geom geom1, _Geom geom2, in
return res
-cdef int collide_edge(GLfloat *A, GLfloat *B,
- GLfloat *AB, GLfloat *normalA,
- GLfloat *normalB,
- dGeomID o1, dGeomID o2, int max_contacts,
- int flags, dContactGeom *contact):
- """Check for collision with one triangle edge. Uses a normal
- that's halfway between the precomputed normals of the vertices
- that make up the edge."""
- cdef dGeomID _land_ray # Reusable ray geom #XXX misplaced
-
-
- cdef int n, num_contacts, nA, nB
- cdef dContactGeom contactA, contactB
- cdef _Geom other
- _land_ray = dCreateRay(NULL, 1.0)#XXX misplaced
-
- # First, do one direction
- dGeomRaySetLength(_land_ray, point_distance_to(A, B))
- dGeomRaySet(_land_ray, A[0], A[1], A[2], AB[0], AB[1], AB[2])
- nA = dCollide(_land_ray, o2, flags, &contactA,
sizeof(dContactGeom))
-
-
- # Then the other
- dGeomRaySet(_land_ray, B[0], B[1], B[2], -AB[0], -AB[1], -AB[2])
- nB = dCollide(_land_ray, o2, flags, &contactB,
sizeof(dContactGeom))
- dGeomDestroy(_land_ray)
-
- if nA and nB:
- contact.pos[0] = (contactA.pos[0] +
contactB.pos[0]) / 2.0
- contact.pos[1] = (contactA.pos[1] +
contactB.pos[1]) / 2.0
- contact.pos[2] = (contactA.pos[2] +
contactB.pos[2]) / 2.0
-
- # D
- contact.normal[0] = (normalA[0] + normalB[0]) /
2.0
- contact.normal[1] = (normalA[1] + normalB[1]) /
2.0
- contact.normal[2] = (normalA[2] + normalB[2]) /
2.0
-
- # Get the depth of the contact point in the
colliding geom
- other = <_Geom>dGeomGetData(o2)
- contact.depth =
other._point_depth(contact.pos[0], contact.pos[1],
-
contact.pos[2])
- contact.g1 = o1
- contact.g2 = o2
-
- return 1
-
- return 0
+#U#cdef int collide_edge(GLfloat *A, GLfloat *B,
+#U# GLfloat *AB, GLfloat *normalA,
+#U# GLfloat *normalB,
+#U# dGeomID o1, dGeomID o2, int max_contacts,
+#U# int flags, dContactGeom *contact):
+#U# """Check for collision with one triangle edge. Uses a normal
+#U# that's halfway between the precomputed normals of the vertices
+#U# that make up the edge."""
+#U# cdef dGeomID _land_ray # Reusable ray geom #XXX misplaced
+#U#
+#U#
+#U# cdef int n, num_contacts, nA, nB
+#U# cdef dContactGeom contactA, contactB
+#U# cdef _Geom other
+#U# _land_ray = dCreateRay(NULL, 1.0)#XXX misplaced
+#U#
+#U# # First, do one direction
+#U# dGeomRaySetLength(_land_ray, point_distance_to(A, B))
+#U# dGeomRaySet(_land_ray, A[0], A[1], A[2], AB[0], AB[1], AB[2])
+#U# nA = dCollide(_land_ray, o2, flags, &contactA,
sizeof(dContactGeom))
+#U#
+#U#
+#U# # Then the other
+#U# dGeomRaySet(_land_ray, B[0], B[1], B[2], -AB[0], -AB[1], -AB[2])
+#U# nB = dCollide(_land_ray, o2, flags, &contactB,
sizeof(dContactGeom))
+#U# dGeomDestroy(_land_ray)
+#U#
+#U# if nA and nB:
+#U# contact.pos[0] = (contactA.pos[0] +
contactB.pos[0]) / 2.0
+#U# contact.pos[1] = (contactA.pos[1] +
contactB.pos[1]) / 2.0
+#U# contact.pos[2] = (contactA.pos[2] +
contactB.pos[2]) / 2.0
+#U#
+#U# # D
+#U# contact.normal[0] = (normalA[0] + normalB[0]) /
2.0
+#U# contact.normal[1] = (normalA[1] + normalB[1]) /
2.0
+#U# contact.normal[2] = (normalA[2] + normalB[2]) /
2.0
+#U#
+#U# # Get the depth of the contact point in the
colliding geom
+#U# other = <_Geom>dGeomGetData(o2)
+#U# contact.depth =
other._point_depth(contact.pos[0], contact.pos[1],
+#U#
contact.pos[2])
+#U# contact.g1 = o1
+#U# contact.g2 = o2
+#U#
+#U# return 1
+#U#
+#U# return 0
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/ode/contact.pyx Soya-0.13-new/ode/contact.pyx
--- Soya-0.13/ode/contact.pyx 2006-10-16 21:52:31.000000000 +1300
+++ Soya-0.13-new/ode/contact.pyx 2007-10-08 22:16:19.000000000 +1300
@@ -19,7 +19,7 @@ cdef class Contact:
"""
- def __new__(self, *args, **kw):
+ def __cinit__(self, *args, **kw):
self._contact.surface.mode = ContactBounce
self._contact.surface.mu = dInfinity
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/ode/geom-terrain.pyx
Soya-0.13-new/ode/geom-terrain.pyx
--- Soya-0.13/ode/geom-terrain.pyx 2006-08-24 05:24:14.000000000 +1200
+++ Soya-0.13-new/ode/geom-terrain.pyx 2007-03-30 15:13:26.000000000 +1200
@@ -455,8 +455,8 @@ cdef dColliderFn * _TerrainGetColliderFn
raise RuntimeError("TerrainGeom can't collide with non
primitive Geom")
-cdef int _TerrainAABBTest(dGeomID o1, dGeomID o2, dReal aabb2[6]):
- pass
+#U#cdef int _TerrainAABBTest(dGeomID o1, dGeomID o2, dReal aabb2[6]):
+#U# pass
cdef dGeomClass dTerrainGeomClass
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/ode_check.h Soya-0.13-new/ode_check.h
--- Soya-0.13/ode_check.h 1970-01-01 12:00:00.000000000 +1200
+++ Soya-0.13-new/ode_check.h 2007-03-30 14:01:41.000000000 +1200
@@ -0,0 +1,14 @@
+/*
+ * Check that ODE is configured to use floats and not doubles.
+ * Otherwise chunk_add_float_endian_safe gets passed pointers
+ * of the wrong type.
+ *
+ * Greg Ewing, March 2007
+ * [EMAIL PROTECTED]
+ */
+
+#include <ode/ode.h>
+
+#ifndef dSINGLE
+#error Soya requires ODE to be configured with PRECISION=SINGLE
+#endif
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/opengl.pyx Soya-0.13-new/opengl.pyx
--- Soya-0.13/opengl.pyx 2006-07-02 20:40:41.000000000 +1200
+++ Soya-0.13-new/opengl.pyx 2007-03-30 16:36:22.000000000 +1200
@@ -22,6 +22,7 @@ include "c.pxd"
include "python.pxd"
cimport c_opengl
+from c_opengl cimport GLenum, GLuint
GL_FALSE = c_opengl.GL_FALSE
GL_TRUE = c_opengl.GL_TRUE
@@ -844,9 +845,8 @@ def glScalef(float x,float y,float z):
c_opengl.glScalef(x,y,z)
def glGenTextures(int n):
- cdef unsigned int ret
+ cdef GLuint ret
c_opengl.glGenTextures(n,&ret)
-
return ret
def glBindTexture(int target, unsigned int texture):
@@ -864,7 +864,7 @@ def glAccum(int value, float coef):
def glMatrixMode(int mode):
c_opengl.glMatrixMode(mode)
-def glMultMatrix(float mode):
+def glMultMatrix(GLenum mode):
c_opengl.glMatrixMode(mode)
def glTexParameteri(int target, int param, int value):
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/sound/sound.pyx Soya-0.13-new/sound/sound.pyx
--- Soya-0.13/sound/sound.pyx 2006-08-21 02:02:39.000000000 +1200
+++ Soya-0.13-new/sound/sound.pyx 2007-10-08 22:30:05.000000000 +1300
@@ -155,7 +155,7 @@ cdef class _Sound(_CObj):
cdef int _format
cdef int _framerate
- def __new__(self, *args, **kargs):
+ def __cinit__(self, *args, **kargs):
self._buffers = []
def __dealloc__(self):
@@ -234,6 +234,10 @@ cdef class _OGGVorbisSound(_Sound):
elif self._format == AL_FORMAT_MONO16 : size = 16384
elif self._format == AL_FORMAT_STEREO8 : size = 16384
elif self._format == AL_FORMAT_MONO8 : size = 16384 / 2
+ # Greg Ewing, March 2007 ([EMAIL PROTECTED])
+ # Else clause added to fix uninitialised variable warning
+ else:
+ raise ValueError("Unknown size")
# Catching exception seems to memory leak in pyrex
#try: self._file.pcm_seek(i * 8192)
@@ -285,7 +289,7 @@ cdef class _SoundPlayer(CoordSyst):
cdef int _current_buffer_id
cdef float _old_pos[3]
- def __new__(self, *args, **kargs):
+ def __cinit__(self, *args, **kargs):
alGenSources(1, &self._source)
alSourcef(self._source, AL_REFERENCE_DISTANCE,
_reference_distance)
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/soya3d/body.pyx Soya-0.13-new/soya3d/body.pyx
--- Soya-0.13/soya3d/body.pyx 2006-12-05 08:27:08.000000000 +1300
+++ Soya-0.13-new/soya3d/body.pyx 2007-03-30 14:01:41.000000000 +1200
@@ -71,12 +71,12 @@ cdef class _Body(CoordSyst):
# pos vector (3) # XXX ignored for the
moment
# quaternion quaternion # XXX use a self-relativ
cordinate later
# linear speed vector (3) # XXX idem
- v = dBodyGetLinearVel(bid)
+ v = <dReal*> dBodyGetLinearVel(bid) # Cast for const
correction
vector_by_matrix(vector,
self._ode_parent._root_matrix())
vector_by_matrix(vector, self._inverted_root_matrix())
chunk_add_floats_endian_safe(ode_chunk,v,3)
# angular speed vector (3) # XXX idem
- v = dBodyGetAngularVel(bid)
+ v = <dReal*> dBodyGetAngularVel(bid) # Cast for const
correction
vector_by_matrix(v, self._ode_parent._root_matrix())
vector_by_matrix(v, self._inverted_root_matrix())
chunk_add_floats_endian_safe(ode_chunk,v,3)
@@ -110,7 +110,7 @@ cdef class _Body(CoordSyst):
if self._option & BODY_HAS_ODE:
self.__ode_data = cstate[3]
self.joints = cstate[4]
- self._option & BODY_HAS_ODE
+ #self._option & BODY_HAS_ODE
self._option = self._option &
~BODY_HAS_ODE
else:
self.__ode_data = None
@@ -464,13 +464,17 @@ It also resets the cycle animation time
cdef void _sync_ode_position(self):
- cdef GLfloat * m
+ # Greg Ewing, March 2007 ([EMAIL PROTECTED])
+ # multiply_matrix was being passed an uninitialised pointer
+ cdef GLfloat ma[19]
+ cdef GLfloat *m
cdef dMatrix3 R
cdef dReal * q
if self.parent is self.ode_parent:
m = self._matrix
else:
+ m = ma
multiply_matrix(m,
self._ode_parent._inverted_root_matrix(), self._root_matrix())
R[0] = m[0]
R[1] = m[4]
@@ -490,13 +494,13 @@ It also resets the cycle animation time
dBodySetPosition(self._OdeBodyID, m[12], m[13], m[14])
dBodySetRotation(self._OdeBodyID, R)
- q = dBodyGetQuaternion(self._OdeBodyID)
+ q = <dReal*> dBodyGetQuaternion(self._OdeBodyID) # Cast for
const correction
self._q[0] = q[1]
self._q[1] = q[2]
self._q[2] = q[3]
self._q[3] = q[0]
- q = dBodyGetPosition(self._OdeBodyID)
+ q = <dReal*> dBodyGetPosition(self._OdeBodyID) # Cast for const
correction
self._p[0] = q[0]
self._p[1] = q[1]
self._p[2] = q[2]
@@ -518,13 +522,13 @@ It also resets the cycle animation time
self._t = 0
if self._option & BODY_ODE_INVALIDE_POS:
self._sync_ode_position()
- q = dBodyGetQuaternion(self._OdeBodyID)
+ q = <dReal*> dBodyGetQuaternion(self._OdeBodyID) # Cast
for const correction
self._q[0] = q[1]
self._q[1] = q[2]
self._q[2] = q[3]
self._q[3] = q[0]
- q = dBodyGetPosition(self._OdeBodyID)
+ q = <dReal*> dBodyGetPosition(self._OdeBodyID) # Cast
for const correction
self._p[0] = q[0]
self._p[1] = q[1]
self._p[2] = q[2]
@@ -560,8 +564,8 @@ It also resets the cycle animation time
#saving the scale of the object
#XXX optimisable
memcpy(zoom,&self._matrix[16],3*sizeof(float))
- r = dBodyGetQuaternion(self._OdeBodyID)
- p = dBodyGetPosition(self._OdeBodyID)
+ r = <dReal*>
dBodyGetQuaternion(self._OdeBodyID) # Cast for const correction
+ p = <dReal*>
dBodyGetPosition(self._OdeBodyID) # Cast for const correction
t = 1.0 - self._t
# Linearly interpolate between the
current quaternion and the last
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/soya3d/camera.pyx
Soya-0.13-new/soya3d/camera.pyx
--- Soya-0.13/soya3d/camera.pyx 2006-08-09 09:17:00.000000000 +1200
+++ Soya-0.13-new/soya3d/camera.pyx 2007-10-08 22:29:04.000000000 +1300
@@ -25,7 +25,7 @@ cdef class _Camera(CoordSyst):
#cdef int _viewport[4]
#cdef _master
- def __new__(self, *args, **kargs):
+ def __cinit__(self, *args, **kargs):
self.__raypick_data = -1
self._render_matrix[15] = 1.0
self._frustum = <Frustum*> malloc(sizeof(Frustum))
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/soya3d/coordsyst.pyx
Soya-0.13-new/soya3d/coordsyst.pyx
--- Soya-0.13/soya3d/coordsyst.pyx 2007-01-07 05:25:01.000000000 +1300
+++ Soya-0.13-new/soya3d/coordsyst.pyx 2007-10-08 22:28:01.000000000 +1300
@@ -83,7 +83,7 @@ cdef class CoordSyst(Position):
#cdef int _option
#cdef int _auto_static_count
- def __new__(self, *args, **kargs):
+ def __cinit__(self, *args, **kargs):
self.__raypick_data = -1
self._auto_static_count = 3
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/soya3d/light.pyx Soya-0.13-new/soya3d/light.pyx
--- Soya-0.13/soya3d/light.pyx 2006-08-10 08:59:42.000000000 +1200
+++ Soya-0.13-new/soya3d/light.pyx 2007-10-08 22:28:34.000000000 +1300
@@ -33,7 +33,7 @@ cdef class _Light(CoordSyst):
##cdef int _used
#cdef _static_shadow_displaylists
- def __new__(self, *args, **kargs):
+ def __cinit__(self, *args, **kargs):
self.__raypick_data = -1
self._id = -1
self._static_shadow_displaylists = weakref.WeakKeyDictionary()
@@ -401,11 +401,11 @@ model computation time)."""
glEnable(GL_LIGHT0 + light._id)
light._gl_id_enabled = 1
-cdef void disable_deep_lights():
- """Disable all non top level lights."""
- cdef _Light light
- for light in LIGHTS:
- if (not light is None) and (light._option & LIGHT_TOP_LEVEL)
and (light._gl_id_enabled == 1):
- glDisable(GL_LIGHT0 + i)
- light._gl_id_enabled = 0
+#U#cdef void disable_deep_lights():
+#U# """Disable all non top level lights."""
+#U# cdef _Light light
+#U# for light in LIGHTS:
+#U# if (not light is None) and (light._option & LIGHT_TOP_LEVEL)
and (light._gl_id_enabled == 1):
+#U# glDisable(GL_LIGHT0 + i)
+#U# light._gl_id_enabled = 0
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/soya3d/world.pyx Soya-0.13-new/soya3d/world.pyx
--- Soya-0.13/soya3d/world.pyx 2007-01-20 07:01:06.000000000 +1300
+++ Soya-0.13-new/soya3d/world.pyx 2007-10-09 19:41:28.000000000 +1300
@@ -417,8 +417,14 @@ children, + the children of its children
# return item in self.children
def __getitem__(self, name):
cdef CoordSyst item, i
+ cdef object name_attr
for item in self.children:
- if getattr(item, "name", "") == name: return item
+ try:
+ name_attr = getattr(item, "name")
+ except:
+ name_attr = ""
+ if name_attr == name:
+ return item
for item in self.children:
if isinstance(item, _World):
i = item[name]
diff -u -p -r -N -x .DS_Store -x build -x setup.py -x _ode.c -x _soya.c -x
opengl.c -x sdlconst.c Soya-0.13/text/text.pyx Soya-0.13-new/text/text.pyx
--- Soya-0.13/text/text.pyx 2006-07-02 20:40:41.000000000 +1200
+++ Soya-0.13-new/text/text.pyx 2007-03-30 14:01:41.000000000 +1200
@@ -152,7 +152,7 @@ initialized to make OpenGL calls."""
for j from 0 <= j < bitmap.rows: # get pixels
memcpy(self._pixels + self._current_x +
(self._current_y + j) * MAX_TEXTURE_SIZE, bitmap.buffer + bitmap.pitch * j,
bitmap.pitch)
- self._current_x = self._current_x + glyph.width + 5
+ self._current_x = self._current_x + <int>glyph.width + 5
glBindTexture(GL_TEXTURE_2D, self._tex_id)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
_______________________________________________
Soya-user mailing list
[email protected]
https://mail.gna.org/listinfo/soya-user