I’ve been working on in game model generation. I’ve been able to build the models fine. I’ve moved on to trying to add texcoordinates to the vertices but I’ve run into a problem.
My implmentation is just to create a for loop going through vertices in a circle then adding the processed data points to the vertexData object.
For the texcoording code in the ‘U’ direction I have:
#Texcoord calculations if oldvert is not None: rowPos = vdata.getNumRows() print "rowPos = ",rowPos texWriter.setRow(rowPos-1) #Back up one vertex to grab the data. cdist = self.spinnerets[i].getDistance(oldvert) print "distance = ", cdist if texWriter.hasColumn(): print "column here" q = texWriter.getData2f() CoordU = q + cdist else: print "no column" CoordU = q + cdist texWriter.setRow(rowPos) else: CoordU = 0.001
Basically I’m trying to calculate the real world distance between the currect vertex and the previous one to use that information to scale the texture in the U direction. The first pass of the loop bypasses the function and just sets the U coordinate to zero.
My GeomVertexRewriter gives me an error. It looks like its saying there isn’t any data in the column, but as you can see from the print out of the vertexData, the column is there and has data in it. Here’s the error message, I’ve told it to print out some of the relevant variables in the terminal as well:
1 rows. Array 0 (0ABAA094, [ vertex(3f) normal(3f) texcoord(2f) ]): row 0: vertex -0.701939 -1.63289 -6.22406 normal 0.212537 0.367605 0.90537 texcoord 0.001 0.001 i= 1 rowPos = 1 distance = 7.01223564148 Assertion failed: GeomVertexWriter::get_column() == GeomVertexReader::get_column() at line 268 of c:\buildslave\release_sdk_win32\ build\panda3d\panda\src\gobj\geomVertexRewriter.I Traceback (most recent call last): File "C:\Panda3D-1.7.2\direct\showbase\EventManager.py", line 61, in eventLoopTask self.doEvents() File "C:\Panda3D-1.7.2\direct\showbase\EventManager.py", line 55, in doEvents processFunc(self.eventQueue.dequeueEvent()) File "C:\Panda3D-1.7.2\direct\showbase\EventManager.py", line 124, in processEvent messenger.send(eventName) File "C:\Panda3D-1.7.2\direct\showbase\Messenger.py", line 388, in send self.__dispatch(acceptorDict, event, sentArgs, foundWatch) File "C:\Panda3D-1.7.2\direct\showbase\Messenger.py", line 473, in __dispatch method (*(extraArgs + sentArgs)) File "ver1.py", line 204, in toggleRecord self.initiateMap() File "ver1.py", line 219, in initiateMap self.getVertices(self.vdata, self.imageCoordinates, self.PatientMarker, self.verticesPerCircle, [self.panelresX, self.panelres Y], self.panelscale) File "ver1.py", line 316, in getVertices if texWriter.hasColumn(): AssertionError: GeomVertexWriter::get_column() == GeomVertexReader::get_column() at line 268 of c:\buildslave\release_sdk_win32\bu ild\panda3d\panda\src\gobj\geomVertexRewriter.I :task(error): Exception occurred in PythonTask eventManager