Author: ArcRiley
Date: 2007-07-08 05:37:55 -0400 (Sun, 08 Jul 2007)
New Revision: 421
Modified:
trunk/pysoy/setup.py
trunk/pysoy/src/_datatypes/FaceList.pxi
trunk/pysoy/src/_datatypes/VertexList.pxi
trunk/pysoy/src/_datatypes/soy._datatypes.pxd
trunk/pysoy/src/atoms/Face.pxi
trunk/pysoy/src/atoms/Vertex.pxi
trunk/pysoy/src/atoms/soy.atoms.pxd
trunk/pysoy/src/bodies._bodies/Mesh.pxi
trunk/pysoy/src/bodies._bodies/soy.bodies._bodies.pxd
trunk/pysoy/src/widgets/soy.widgets.pxd
trunk/pysoy/tests/tex_pyramid.py
Log:
Moved Mesh "Vert" stuff to VertexList
Modified: trunk/pysoy/setup.py
===================================================================
--- trunk/pysoy/setup.py 2007-07-08 09:12:28 UTC (rev 420)
+++ trunk/pysoy/setup.py 2007-07-08 09:37:55 UTC (rev 421)
@@ -26,7 +26,7 @@
version = 'Trunk'
modules = {
- '_datatypes' : ['glib'],
+ '_datatypes' : ['GLEW','GL','glib'],
'_internals' : [],
'atoms' : [],
'bodies._bodies' : ['GLEW','GL','ode'],
Modified: trunk/pysoy/src/_datatypes/FaceList.pxi
===================================================================
--- trunk/pysoy/src/_datatypes/FaceList.pxi 2007-07-08 09:12:28 UTC (rev
420)
+++ trunk/pysoy/src/_datatypes/FaceList.pxi 2007-07-08 09:37:55 UTC (rev
421)
@@ -44,7 +44,10 @@
return self.__str__()
def __getitem__(self, index) :
- return soy.atoms.Face(self._mesh, index)
+ cdef object f
+ f = soy.atoms.Face()
+ (<soy.atoms.Face> f)._addList(mesh, index)
+ return f
def append(self, item) :
cdef soy.bodies._bodies.Mesh _mesh
@@ -57,7 +60,8 @@
_mesh._cface.lock()
_mesh._allocFaces(_mesh._nface + 1)
(<soy.atoms.Face> item)._addList(_mesh, _mesh._nface)
- (<soy.atoms.Face> item)._setList()
+ (<soy.atoms.Face> item)._setList()
+ self._mesh._flagFaceVBO(self._index)
_mesh._nface = _mesh._nface + 1
_mesh._cface.unlock()
Modified: trunk/pysoy/src/_datatypes/VertexList.pxi
===================================================================
--- trunk/pysoy/src/_datatypes/VertexList.pxi 2007-07-08 09:12:28 UTC (rev
420)
+++ trunk/pysoy/src/_datatypes/VertexList.pxi 2007-07-08 09:37:55 UTC (rev
421)
@@ -29,11 +29,12 @@
def __new__(self, mesh) :
if not isinstance(mesh, soy.bodies._bodies.Mesh) :
raise TypeError('argument must be of type soy.bodies.Mesh')
- self._mesh = mesh
+ self._mesh = <void *> mesh
+ self._children = soy._internals.Children()
def __len__(self) :
- return (<soy.bodies._bodies.Mesh> self._mesh)._nvert
+ return self._arraySize
def __str__(self) :
@@ -41,19 +42,18 @@
cdef object l
cdef soy.bodies._bodies.Mesh _mesh
l = []
- _mesh = <soy.bodies._bodies.Mesh> self._mesh
- _mesh._cvert.lock()
- for i from 0 <= i < _mesh._nvert :
- l.append({'position':(_mesh._verts[i].px,
- _mesh._verts[i].py,
- _mesh._verts[i].pz),
- 'normal' :(_mesh._verts[i].nx,
- _mesh._verts[i].ny,
- _mesh._verts[i].nz),
- 'texcoord':(_mesh._verts[i].tx,
- _mesh._verts[i].ty,
- _mesh._verts[i].tz)})
- _mesh._cvert.unlock()
+ self._children.lock()
+ for i from 0 <= i < self._arraySize :
+ l.append({'position':(self._array[i].px,
+ self._array[i].py,
+ self._array[i].pz),
+ 'normal' :(self._array[i].nx,
+ self._array[i].ny,
+ self._array[i].nz),
+ 'texcoord':(self._array[i].tx,
+ self._array[i].ty,
+ self._array[i].tz)})
+ self._children.unlock()
return str(l)
@@ -62,23 +62,78 @@
def __getitem__(self, _index) :
- cdef int i
+ cdef int i, f
cdef soy.atoms.Vertex _vert
- cdef soy.bodies._bodies.Mesh _mesh
- _mesh = <soy.bodies._bodies.Mesh> self._mesh
#
# Check to see if there's already a Vertex instance made, if so return it,
# otherwise create a new instance and return that. We do this to prevent
# duplicate Vertex instances and to prevent having to internally hold an
# instance of every vertex in every mesh - that'd eat way too much memory.
#
- _mesh._cvert.lock()
- for i from 0 <= i < _mesh._cvert.current :
- if (<soy.atoms.Vertex> _mesh._cvert.list[i])._index == _index :
- _vert = <soy.atoms.Vertex> _mesh._cvert.list[i]
- _index = -1
+ self._children.lock()
+ for i from 0 <= i < self._children.current :
+ if (<soy.atoms.Vertex> self._children.list[i])._index == _index :
+ _vert = <soy.atoms.Vertex> self._children.list[i]
+ f = 1
break
- _mesh._cvert.unlock()
- if _index == -1 :
- _vert = soy.atoms.Vertex(mesh=_mesh, index=_index)
+ self._children.unlock()
+ if not f :
+ _vert = soy.atoms.Vertex(mesh = <soy.bodies._bodies.Mesh> self._mesh,
+ index= _index)
return _vert
+
+ cdef void _renderArray(self) :
+ gl.glVertexPointer (3, gl.GL_FLOAT, 36, &self._array[0].px)
+ gl.glNormalPointer ( gl.GL_FLOAT, 36, &self._array[0].nx)
+ gl.glTexCoordPointer(3, gl.GL_FLOAT, 36, &self._array[0].tx)
+
+ cdef void _renderBuffer(self) :
+ gl.glBindBufferARB (gl.GL_ARRAY_BUFFER_ARB, self._buffer)
+ self._sendUpdated()
+ gl.glTexCoordPointer(3, gl.GL_FLOAT, 36, <float*> 24)
+ gl.glNormalPointer ( gl.GL_FLOAT, 36, <float*> 12)
+ gl.glVertexPointer (3, gl.GL_FLOAT, 36, <float*> 0)
+
+
+ cdef void _createBuffer(self) :
+ self._bufferAlloc = self._arrayAlloc
+ self._updateRange.offset = -1
+ gl.glGenBuffersARB(1, &self._buffer)
+ gl.glBindBufferARB(gl.GL_ARRAY_BUFFER_ARB, self._buffer)
+ gl.glBufferDataARB(gl.GL_ARRAY_BUFFER_ARB, 36*self._bufferAlloc,
+ self._array, gl.GL_STATIC_DRAW_ARB)
+
+
+ cdef void _flagUpdated(self, int _index) :
+ if _index < self._updateRange.offset or self._updateRange.offset == -1 :
+ self._updateRange.offset = _index
+ if _index - self._updateRange.offset > self._updateRange.length :
+ self._updateRange.length = _index - self._updateRange.offset
+
+
+ cdef void _sendUpdated(self) :
+ if self._updateRange.offset == -1 :
+ return
+ # If in the process of writing, wait until next cycle to send
+ if not self._children.trylock() :
+ return
+ # If the range to be updated is larger than the existing buffer
+ if self._updateRange.offset+self._updateRange.length > self._bufferAlloc :
+ self._bufferAlloc = self._arrayAlloc
+ gl.glBufferDataARB(gl.GL_ELEMENT_ARRAY_BUFFER_ARB, 6*self._bufferAlloc,
+ self._array, gl.GL_STATIC_DRAW_ARB)
+ else :
+ gl.glBufferSubDataARB(gl.GL_ARRAY_BUFFER_ARB,
+ 36 * self._updateRange.offset,
+ 36 * (self._updateRange.length+1),
+ &self._array[self._updateRange.offset])
+ self._updateRange.offset = -1
+ self._updateRange.length = 0
+ self._children.unlock()
+
+
+ cdef void _allocArray(self, int num) :
+ cdef soy.bodies._bodies.Mesh _mesh
+ _mesh = <soy.bodies._bodies.Mesh> self._mesh
+ self._array = <Vert *> _mesh._alloc(num, &self._arrayAlloc,
+ self._array, sizeof(Vert))
Modified: trunk/pysoy/src/_datatypes/soy._datatypes.pxd
===================================================================
--- trunk/pysoy/src/_datatypes/soy._datatypes.pxd 2007-07-08 09:12:28 UTC
(rev 420)
+++ trunk/pysoy/src/_datatypes/soy._datatypes.pxd 2007-07-08 09:37:55 UTC
(rev 421)
@@ -17,10 +17,29 @@
#
# $Id$
+cimport gl
cimport py
cimport glib
cimport stdio
+cimport soy._internals
+cdef struct Vert :
+ float px
+ float py
+ float pz
+ float nx
+ float ny
+ float nz
+ float tx
+ float ty
+ float tz
+
+
+cdef struct Range :
+ int offset
+ int length
+
+
cdef class HashTable :
cdef glib.GHashTable* _hashtable
cdef void _insert(self, char*, float)
@@ -31,4 +50,17 @@
cdef class VertexList :
- cdef object _mesh
+ cdef void *_mesh
+ cdef soy._internals.Children _children # was cvert
+ cdef Vert *_array # was verts
+ cdef unsigned short _arraySize # was nvert
+ cdef int _arrayAlloc # was mvert
+ cdef gl.GLuint _buffer # was bvert
+ cdef int _bufferAlloc # was avert
+ cdef Range _updateRange # was uvert
+ cdef void _allocArray (self, int)
+ cdef void _renderArray (self)
+ cdef void _renderBuffer (self)
+ cdef void _createBuffer (self)
+ cdef void _sendUpdated (self)
+ cdef void _flagUpdated (self, int)
Modified: trunk/pysoy/src/atoms/Face.pxi
===================================================================
--- trunk/pysoy/src/atoms/Face.pxi 2007-07-08 09:12:28 UTC (rev 420)
+++ trunk/pysoy/src/atoms/Face.pxi 2007-07-08 09:37:55 UTC (rev 421)
@@ -22,14 +22,8 @@
An element of FaceList.
'''
- def __new__(self, mesh=None, index=-1) :
- if isinstance(mesh, soy.bodies._bodies.Mesh) and \
- index>-1 and index<(<soy.bodies._bodies.Mesh> mesh)._nface :
- (<soy.bodies._bodies.Mesh> mesh)._cface.lock()
- self._addList(mesh, index)
- (<soy.bodies._bodies.Mesh> mesh)._cface.unlock()
- else :
- self._index = -1
+ def __new__(self, verts=(0,0,0)) :
+ self.verts = verts
def __richcmp__(self, peer, op) :
@@ -73,7 +67,6 @@
self._mesh._faces[self._index].a = self._saved_a._index
self._mesh._faces[self._index].b = self._saved_b._index
self._mesh._faces[self._index].c = self._saved_c._index
- self._mesh._flagFaceVBO(self._index)
cdef void _remList(self) :
@@ -96,7 +89,7 @@
property verts :
def __get__(self) :
- if self._index == -1 :
+ if self._index != -1 :
return (self._saved.a,
self._saved.b,
self._saved.c)
@@ -118,3 +111,4 @@
self._saved_c = value[2]
if self._index > -1 :
self._setList()
+ self._mesh._flagFaceVBO(self._index)
Modified: trunk/pysoy/src/atoms/Vertex.pxi
===================================================================
--- trunk/pysoy/src/atoms/Vertex.pxi 2007-07-08 09:12:28 UTC (rev 420)
+++ trunk/pysoy/src/atoms/Vertex.pxi 2007-07-08 09:37:55 UTC (rev 421)
@@ -22,28 +22,28 @@
An element of VertexList with .position .normal and .texcoord properties
'''
- def __new__(self, soy.bodies._bodies.Mesh mesh,
+ def __new__(self, soy.bodies._bodies.Mesh mesh,
position=None, normal=None, texcoord=None,
index=-1, *args, **keywords) :
self._index = -1
- self._mesh = mesh
+ self._list = mesh._verts
if index >= 0 :
# For an instance of an existing vertex
- if index >= self._mesh._nvert :
+ if index >= self._list._arraySize :
raise ValueError('index out of range')
- self._mesh._cvert.lock()
- self._mesh._cvert.append(<void *>self)
+ self._list._children.lock()
+ self._list._children.append(<void *>self)
self._index = index
- self._mesh._cvert.unlock()
+ self._list._children.unlock()
else :
# For a brand new vertex
- self._mesh._cvert.lock()
- self._mesh._cvert.append(<void *>self)
- self._index = self._mesh._nvert
- self._mesh._allocVerts(self._mesh._nvert + 1)
- self._mesh._nvert = self._mesh._nvert + 1
- self._mesh._flagVertVBO(self._index)
- self._mesh._cvert.unlock()
+ self._list._children.lock()
+ self._list._children.append(<void *>self)
+ self._index = self._list._arraySize
+ self._list._arraySize = self._list._arraySize + 1
+ self._list._allocArray (self._list._arraySize)
+ self._list._flagUpdated(self._index)
+ self._list._children.unlock()
if position :
self.position = position
if normal :
@@ -54,81 +54,81 @@
def __dealloc__(self) :
if self._index >= 0 :
- self._mesh._cvert.lock()
- self._mesh._cvert.remove(<void *>self)
- self._mesh._cvert.unlock()
+ self._list._children.lock()
+ self._list._children.remove(<void *>self)
+ self._list._children.unlock()
def __repr__(self) :
- return '<Vertex at (%f, %f, %f)>' % (self._mesh._verts[self._index].px,
- self._mesh._verts[self._index].py,
- self._mesh._verts[self._index].pz)
+ return '<Vertex at (%f, %f, %f)>' % (self._list._array[self._index].px,
+ self._list._array[self._index].py,
+ self._list._array[self._index].pz)
property position :
def __get__(self) :
cdef float x, y, z
cdef object t
- self._mesh._cvert.lock()
- t = (self._mesh._verts[self._index].px,
- self._mesh._verts[self._index].py,
- self._mesh._verts[self._index].pz)
- self._mesh._cvert.unlock()
+ self._list._children.lock()
+ t = (self._list._array[self._index].px,
+ self._list._array[self._index].py,
+ self._list._array[self._index].pz)
+ self._list._children.unlock()
return t
def __set__(self, value) :
if type(value)!=tuple and type(value)!=list :
raise TypeError('Must provide a tuple or list')
if len(value)!=3 :
raise TypeError('Must provide (x,y,z)')
- self._mesh._cvert.lock()
- self._mesh._verts[self._index].px = value[0]
- self._mesh._verts[self._index].py = value[1]
- self._mesh._verts[self._index].pz = value[2]
- self._mesh._flagVertVBO(self._index)
- self._mesh._cvert.unlock()
+ self._list._children.lock()
+ self._list._array[self._index].px = value[0]
+ self._list._array[self._index].py = value[1]
+ self._list._array[self._index].pz = value[2]
+ self._list._flagUpdated(self._index)
+ self._list._children.unlock()
property normal :
def __get__(self) :
cdef float x, y, z
cdef object t
- self._mesh._cvert.lock()
- t = (self._mesh._verts[self._index].nx,
- self._mesh._verts[self._index].ny,
- self._mesh._verts[self._index].nz)
- self._mesh._cvert.unlock()
+ self._list._children.lock()
+ t = (self._list._array[self._index].nx,
+ self._list._array[self._index].ny,
+ self._list._array[self._index].nz)
+ self._list._children.unlock()
return t
def __set__(self, value) :
if type(value)!=tuple and type(value)!=list :
raise TypeError('Must provide a tuple or list')
if len(value)!=3 :
raise TypeError('Must provide (x,y,z)')
- self._mesh._cvert.lock()
- self._mesh._verts[self._index].nx = value[0]
- self._mesh._verts[self._index].ny = value[1]
- self._mesh._verts[self._index].nz = value[2]
- self._mesh._flagVertVBO(self._index)
- self._mesh._cvert.unlock()
+ self._list._children.lock()
+ self._list._array[self._index].nx = value[0]
+ self._list._array[self._index].ny = value[1]
+ self._list._array[self._index].nz = value[2]
+ self._list._flagUpdated(self._index)
+ self._list._children.unlock()
property texcoord :
def __get__(self) :
cdef float x, y, z
cdef object t
- self._mesh._cvert.lock()
- t = (self._mesh._verts[self._index].tx,
- self._mesh._verts[self._index].ty,
- self._mesh._verts[self._index].tz)
- self._mesh._cvert.unlock()
+ self._list._children.lock()
+ t = (self._list._array[self._index].tx,
+ self._list._array[self._index].ty,
+ self._list._array[self._index].tz)
+ self._list._children.unlock()
return t
def __set__(self, value) :
if type(value)!=tuple and type(value)!=list :
raise TypeError('Must provide a tuple or list')
if len(value)!=3 :
raise TypeError('Must provide (x,y,z)')
- self._mesh._cvert.lock()
- self._mesh._verts[self._index].tx = value[0]
- self._mesh._verts[self._index].ty = value[1]
- self._mesh._verts[self._index].tz = value[2]
- self._mesh._flagVertVBO(self._index)
- self._mesh._cvert.unlock()
+ self._list._children.lock()
+ self._list._array[self._index].tx = value[0]
+ self._list._array[self._index].ty = value[1]
+ self._list._array[self._index].tz = value[2]
+ self._list._flagUpdated(self._index)
+ self._list._children.unlock()
Modified: trunk/pysoy/src/atoms/soy.atoms.pxd
===================================================================
--- trunk/pysoy/src/atoms/soy.atoms.pxd 2007-07-08 09:12:28 UTC (rev 420)
+++ trunk/pysoy/src/atoms/soy.atoms.pxd 2007-07-08 09:37:55 UTC (rev 421)
@@ -22,10 +22,12 @@
cimport soy.bodies._bodies
cimport soy.materials
+
cdef class Vertex :
- cdef soy.bodies._bodies.Mesh _mesh
+ cdef soy._datatypes.VertexList _list
cdef int _index
+
cdef class Face :
cdef soy.bodies._bodies.Mesh _mesh
cdef int _index
Modified: trunk/pysoy/src/bodies._bodies/Mesh.pxi
===================================================================
--- trunk/pysoy/src/bodies._bodies/Mesh.pxi 2007-07-08 09:12:28 UTC (rev
420)
+++ trunk/pysoy/src/bodies._bodies/Mesh.pxi 2007-07-08 09:37:55 UTC (rev
421)
@@ -24,12 +24,12 @@
'''
def __new__(self, scene=None, *args, **keywords) :
self._cface = soy._internals.Children()
- self._cvert = soy._internals.Children()
+ self._verts = soy._datatypes.VertexList(self)
def __repr__(self) :
return '<Mesh with %d verticies, %d faces, and %d materials>' % (
- self._nvert, self._nface, self._nmate)
+ len(self._verts), self._nface, self._nmate)
property faces :
@@ -47,7 +47,7 @@
This is a list-like object for manipulating the verticies of a Mesh.
'''
def __get__(self) :
- return soy._datatypes.VertexList(self)
+ return self._verts
property textures :
@@ -119,9 +119,7 @@
cdef void _renderVA(self) :
cdef int i
- gl.glTexCoordPointer(3, gl.GL_FLOAT, 36, &self._verts[0].tx)
- gl.glNormalPointer ( gl.GL_FLOAT, 36, &self._verts[0].nx)
- gl.glVertexPointer (3, gl.GL_FLOAT, 36, &self._verts[0].px)
+ self._verts._renderArray()
for i from 0 <= i < self._nmate :
(<soy.materials.Material> self._mates[i].mat)._bind()
gl.glDrawElements (gl.GL_TRIANGLES, self._mates[i].length*3,
@@ -138,11 +136,7 @@
self._createVBO()
gl.glBindBufferARB (gl.GL_ELEMENT_ARRAY_BUFFER_ARB, self._bface)
self._sendFaceVBO()
- gl.glBindBufferARB (gl.GL_ARRAY_BUFFER_ARB, self._bvert)
- self._sendVertVBO()
- gl.glTexCoordPointer(3, gl.GL_FLOAT, 36, <float*> 24)
- gl.glNormalPointer ( gl.GL_FLOAT, 36, <float*> 12)
- gl.glVertexPointer (3, gl.GL_FLOAT, 36, <float*> 0)
+ self._verts._renderBuffer()
for i from 0 <= i < self._nmate :
(<soy.materials.Material> self._mates[i].mat)._bind()
gl.glDrawElements (gl.GL_TRIANGLES, self._mates[i].length*3,
@@ -158,12 +152,7 @@
gl.glBindBufferARB(gl.GL_ELEMENT_ARRAY_BUFFER_ARB, self._bface)
gl.glBufferDataARB(gl.GL_ELEMENT_ARRAY_BUFFER_ARB, 6*self._aface,
self._faces, gl.GL_STATIC_DRAW_ARB)
- self._avert = self._mvert
- self._uvert.offset = -1
- gl.glGenBuffersARB(1, &self._bvert)
- gl.glBindBufferARB(gl.GL_ARRAY_BUFFER_ARB, self._bvert)
- gl.glBufferDataARB(gl.GL_ARRAY_BUFFER_ARB, 36*self._avert,
- self._verts, gl.GL_STATIC_DRAW_ARB)
+ self._verts._createBuffer()
cdef void _flagFaceVBO(self, int index) :
@@ -173,13 +162,6 @@
self._uface.length = index-self._uface.offset
- cdef void _flagVertVBO(self, int _index) :
- if _index < self._uvert.offset or self._uvert.offset == -1 :
- self._uvert.offset = _index
- if _index - self._uvert.offset > self._uvert.length :
- self._uvert.length = _index - self._uvert.offset
-
-
cdef void _sendFaceVBO(self) :
if self._uface.offset == -1 :
return
@@ -202,27 +184,6 @@
self._cface.unlock()
- cdef void _sendVertVBO(self) :
- if self._uvert.offset == -1 :
- return
- if self._uface.offset + self._uface.length > self._aface :
- self._cvert.lock()
- self._aface = self._mface
- gl.glBufferDataARB(gl.GL_ELEMENT_ARRAY_BUFFER_ARB, 6*self._mface,
- self._faces, gl.GL_STATIC_DRAW_ARB)
- self._cvert.unlock()
- return
- # If in the process of writing, wait until next cycle to send
- if not self._cvert.trylock() :
- return
- gl.glBufferSubDataARB(gl.GL_ARRAY_BUFFER_ARB, 36*self._uvert.offset,
- 36*(self._uvert.length+1),
- &self._verts[self._uvert.offset])
- self._uvert.offset = -1
- self._uvert.length = 0
- self._cvert.unlock()
-
-
cdef void *_alloc(self, int num, int* m, void* store, int size) :
if num == 0 :
m[0] = 0
@@ -242,11 +203,6 @@
self._faces, sizeof(Face))
- cdef void _allocVerts(self, int num) :
- self._verts = <Vert *> self._alloc(num, &self._mvert,
- self._verts, sizeof(Vert))
-
-
cdef void _allocMates(self, int num) :
self._mates = <MatRange *> self._alloc(num, &self._mmate,
self._mates, sizeof(MatRange))
@@ -257,10 +213,8 @@
def __new__(self, object scene=None, object tex=None, *args, **keywords) :
self._allocMates(3)
self._allocFaces(6)
- self._allocVerts(5)
self._nmate = 3
self._nface = 6
- self._nvert = 5
import soy.colors
self.mat0 = soy.materials.Material(ambient=soy.colors.BlueViolet(),
diffuse=soy.colors.Cyan())
@@ -302,57 +256,13 @@
self._faces[5].b = 3
self._faces[5].c = 1
- self._verts[0].px = 0.0
- self._verts[0].py = 1.0
- self._verts[0].pz = 0.0
- self._verts[0].nx = 0.0
- self._verts[0].ny = 1.0
- self._verts[0].nz = 0.0
- self._verts[0].tx = 0.0
- self._verts[0].ty = 0.0
- self._verts[0].tz = 0.0
+ soy.atoms.Vertex(self,position=(0,1,0), normal=(0,1,0), texcoord=(0,0,0))
+ soy.atoms.Vertex(self,position=(-1,-1,1),normal=(-1,-1,1),texcoord=(0,0,0))
+ soy.atoms.Vertex(self,position=(1,-1,1), normal=(1,-1,1), texcoord=(0,1,0))
+ soy.atoms.Vertex(self,position=(1,-1,-1),normal=(1,-1,-1),texcoord=(1,1,0))
+
soy.atoms.Vertex(self,position=(-1,-1,-1),normal=(0,-1,0),texcoord=(1,0,0))
- self._verts[1].px = -1.0
- self._verts[1].py = -1.0
- self._verts[1].pz = 1.0
- self._verts[1].nx = -1.0
- self._verts[1].ny = -1.0
- self._verts[1].nz = 1.0
- self._verts[1].tx = 0.0
- self._verts[1].ty = 0.0
- self._verts[1].tz = 0.0
- self._verts[2].px = 1.0
- self._verts[2].py = -1.0
- self._verts[2].pz = 1.0
- self._verts[2].nx = 1.0
- self._verts[2].ny = -1.0
- self._verts[2].nz = 1.0
- self._verts[2].tx = 0.0
- self._verts[2].ty = 1.0
- self._verts[2].tz = 0.0
-
- self._verts[3].px = 1.0
- self._verts[3].py = -1.0
- self._verts[3].pz = -1.0
- self._verts[3].nx = 1.0
- self._verts[3].ny = -1.0
- self._verts[3].nz = -1.0
- self._verts[3].tx = 1.0
- self._verts[3].ty = 1.0
- self._verts[3].tz = 0.0
-
- self._verts[4].px = -1.0
- self._verts[4].py = -1.0
- self._verts[4].pz = -1.0
- self._verts[4].nx = -1.0
- self._verts[4].ny = -1.0
- self._verts[4].nz = -1.0
- self._verts[4].tx = 1.0
- self._verts[4].ty = 0.0
- self._verts[4].tz = 0.0
-
def __dealloc__(self) :
self._allocFaces(0)
- self._allocVerts(0)
self._allocMates(0)
Modified: trunk/pysoy/src/bodies._bodies/soy.bodies._bodies.pxd
===================================================================
--- trunk/pysoy/src/bodies._bodies/soy.bodies._bodies.pxd 2007-07-08
09:12:28 UTC (rev 420)
+++ trunk/pysoy/src/bodies._bodies/soy.bodies._bodies.pxd 2007-07-08
09:37:55 UTC (rev 421)
@@ -34,18 +34,6 @@
unsigned short c
-cdef struct Vert :
- float px
- float py
- float pz
- float nx
- float ny
- float nz
- float tx
- float ty
- float tz
-
-
cdef struct Range :
int offset
int length
@@ -92,13 +80,7 @@
cdef Face *_faces # indices for each face
#
# Vertex Data
- cdef int _avert # Allocated buffer size
- cdef gl.GLuint _bvert # vertex array Buffer
- cdef soy._internals.Children _cvert # "Vertex" Children
- cdef Range _uvert # Updated vertex array
- cdef unsigned short _nvert # Number of
- cdef int _mvert # Malloc size
- cdef Vert *_verts # array of shared Verticies
+ cdef soy._datatypes.VertexList _verts
#
# Texture Data
cdef unsigned int _nmate # number of
@@ -111,12 +93,9 @@
cdef void _renderVBO (self)
cdef void _createVBO (self)
cdef void _flagFaceVBO (self, int)
- cdef void _flagVertVBO (self, int)
cdef void _sendFaceVBO (self)
- cdef void _sendVertVBO (self)
cdef void *_alloc (self, int, int*, void*, int)
cdef void _allocFaces (self, int)
- cdef void _allocVerts (self, int)
cdef void _allocMates (self, int)
cdef class Pyramid (Mesh) :
Modified: trunk/pysoy/src/widgets/soy.widgets.pxd
===================================================================
--- trunk/pysoy/src/widgets/soy.widgets.pxd 2007-07-08 09:12:28 UTC (rev
420)
+++ trunk/pysoy/src/widgets/soy.widgets.pxd 2007-07-08 09:37:55 UTC (rev
421)
@@ -23,6 +23,7 @@
cimport soy.bodies._bodies
cimport soy.colors
cimport soy.textures
+cimport soy._datatypes
cimport soy._internals
cdef class Widget :
@@ -52,7 +53,7 @@
cdef class Canvas (Widget) :
cdef object _texture
- cdef soy.bodies._bodies.Vert _verts[4]
+ cdef soy._datatypes.Vert _verts[4]
cdef soy.bodies._bodies.Face _faces[2]
Modified: trunk/pysoy/tests/tex_pyramid.py
===================================================================
--- trunk/pysoy/tests/tex_pyramid.py 2007-07-08 09:12:28 UTC (rev 420)
+++ trunk/pysoy/tests/tex_pyramid.py 2007-07-08 09:37:55 UTC (rev 421)
@@ -7,9 +7,6 @@
img = Image.open('lava.png')
lava = soy.textures.Image(img)
-img = Image.open('arc.png')
-face = soy.textures.Image(img)
-
img = Image.open('la.png')
luma = soy.textures.Image(img)
@@ -20,19 +17,10 @@
cam = soy.bodies.Camera(sce)
cam.position = (0.0, 0.0, 5.0)
-stz = soy.widgets.StackZ(win, margin=10)
-ca1 = soy.widgets.Canvas(stz, aspect=0.0, texture=lava)
-pro = soy.widgets.Projector(stz, camera=cam)
-stx = soy.widgets.StackX(stz)
-sp1 = soy.widgets.Widget(stx)
-sp2 = soy.widgets.Widget(stx)
-sty = soy.widgets.StackY(stx)
-sp3 = soy.widgets.Widget(sty)
-ca2 = soy.widgets.Canvas(sty, texture=face)
+ca1 = soy.widgets.Canvas(win, aspect=0.0, texture=lava)
+pro = soy.widgets.Projector(win, camera=cam)
pyr = soy.bodies.Pyramid(sce, luma)
pyr.rotation = (1.0, 1.0, 0.0)
-sleep(1)
-pyr.verts[0].position = (0,2,0)
if __name__ == '__main__' :
while True:
_______________________________________________
PySoy-SVN mailing list
[email protected]
http://www.pysoy.org/mailman/listinfo/pysoy-svn