示例#1
0
 def Vertex(self):
     self.data.seek(4,1)
     numOrder    = self.data.readUInt()
     self.vertLength = vertLength  = self.data.readUInt()
     self.numVert = numVert     = self.data.readUInt()
     Order       = self.data.read('%sI'%numOrder)
     self.vertBuff = vertBuff    = self.data.readBytes(vertLength * numVert)
     offset      = 0
     for o in Order:
         if o == 0:
             vertOffset = offset
             offset += self.vertOrder[o]
         elif o == 4:
             uvOffset = offset
             offset += self.vertOrder[o]
         elif o == 1:
             normalOffset = offset
             offset += self.vertOrder[o]
         elif o == 5:
             self.boneWeightOffset = offset
             offset += self.vertOrder[o]
         elif o == 6:
             self.boneIndexOffset = offset
             offset += self.vertOrder[o]
         else:
             offset += self.vertOrder[o]
             
     rapi.rpgBindPositionBufferOfs   (vertBuff, noesis.RPGEODATA_FLOAT, vertLength, vertOffset)
     rapi.rpgBindUV1BufferOfs        (vertBuff, noesis.RPGEODATA_FLOAT, vertLength, uvOffset)
     rapi.rpgBindNormalBufferOfs     (vertBuff, noesis.RPGEODATA_FLOAT, vertLength, normalOffset)
     
     return
def noepyLoadModel(data, mdlList):
    '''Build the model, set materials, bones, and animations. You do not
    need all of them as long as they are empty lists (they are by default)'''
    
    ctx = rapi.rpgCreateContext()
    parser = SanaeParser(data)
    parser.parse_file()
    
    #build meshes
    for pose in parser.vertGroups.keys():
        print(pose, len(parser.vertGroups[pose]))
    vertBuffs = parser.vertGroups["walk"]
    for i in range(len(vertBuffs)):
        idxBuff, numIdx, matNum = parser.idxBuffs[i%len(parser.idxBuffs)]
        vertBuff = vertBuffs[i]
        rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
        rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 12)
        rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)
        
        matName = parser.matList[matNum].name
        rapi.rpgSetMaterial(matName)
        rapi.rpgSetOption(noesis.RPGOPT_TRIWINDBACKWARD, 1)
        rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_USHORT, numIdx, noesis.RPGEO_TRIANGLE, 1)    
    
    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdl.setBones(parser.boneList)
    mdl.setAnims(parser.animList)
    mdlList.append(mdl)
    return 1
    def build_meshes(self):

        matCount = 0
        for i in range(len(self.meshList)):
            mesh = self.meshList[i]
            if mesh.matNum != -1:
                mat = self.tempMats[mesh.matNum]
            rapi.rpgSetName(mesh.meshName)
            rapi.rpgBindPositionBufferOfs(mesh.vertBuff,
                                          noesis.RPGEODATA_FLOAT, 56, 0)
            rapi.rpgBindNormalBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT,
                                        56, 12)
            rapi.rpgBindUV1BufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 56,
                                     24)

            for j in range(len(mesh.faceGroups)):
                numIdx, idxBuff = mesh.faceGroups[j]
                if numIdx == 0:
                    continue
                matName = "Material[%d]" % matCount
                texName = mat.texNames[i]

                material = NoeMaterial(matName, texName)
                self.matList.append(material)
                rapi.rpgSetMaterial(matName)
                rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_USHORT,
                                        numIdx, noesis.RPGEO_TRIANGLE, 1)
    def parse_file(self):
        '''Main parser method'''

        idstring = self.inFile.readBytes(6)
        self.inFile.readShort()
        self.inFile.readShort()
        self.read_name()
        meshName = self.read_name()

        self.inFile.readByte()  # delim?
        bbox = self.inFile.read('6f')

        self.inFile.readUInt()
        self.inFile.readUInt()
        numVerts, numIdx = self.inFile.read('2H')
        vertBuff = self.parse_vertices(numVerts)
        idxBuff = self.parse_faces(numIdx)

        self.parse_materials()

        rapi.rpgSetName(meshName)
        rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
        rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 12)
        rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)
        rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_SHORT, numIdx,
                                noesis.RPGEO_TRIANGLE, 1)
    def parse_file(self):
        '''Main parser method'''

        filesize = self.inFile.readUInt()
        idstring = self.inFile.readBytes(4)
        self.inFile.read('2H')
        meshType = self.inFile.readUInt()
        self.inFile.read('2L')
        count1 = self.inFile.readUInt()
        numIdx = self.inFile.readUInt()
        numVerts1 = self.inFile.readUInt()
        numVerts2 = self.inFile.readUInt()
        numVerts3 = self.inFile.readUInt()
        numVerts4 = self.inFile.readUInt()
        count3 = self.inFile.readUInt()
        numMat = self.inFile.readUInt()
        numTex = self.inFile.readUInt()
        unk1Ofs, faceOfs, vert1Ofs, vert2Ofs, vert3Ofs, vert4Ofs, unk3Ofs, \
            matOfs, texOfs = self.inFile.read('9L')

        self.inFile.seek(unk1Ofs)
        self.parse_unk1(count1)
        self.parse_unk2()

        self.inFile.seek(unk3Ofs)
        self.parse_unk3(count3)

        self.inFile.seek(matOfs)
        self.parse_materials(numMat)

        self.inFile.seek(texOfs)
        self.parse_textures(numTex)

        self.inFile.seek(faceOfs)
        self.faceInfo = self.parse_faces(numIdx)

        if vert1Ofs > 0:
            self.inFile.seek(vert1Ofs)
            vertBuff = self.parse_vertices(numVerts1, 1)
            rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 60,
                                          0)
            rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 60,
                                        36)
            rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 60, 28)
            self.build_mesh(numVerts1)

        if vert2Ofs > 0:
            vertBuff = self.parse_vertices(numVerts2, 2)
            rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 64,
                                          0)
            self.build_mesh(numVerts2)
        if vert3Ofs > 0:
            print('here')
            vertBuff = self.parse_vertices(numVerts3, 3)
            rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 72,
                                          0)

            self.build_mesh(numVerts3)
        if vert4Ofs > 0:
            vertBuff = self.parse_vertices(numVerts4, 3)
    def build_meshes(self):

        for meshInfo in self.meshInfo:

            vertBuff = meshInfo[0]
            idxBuff = meshInfo[1]
            numIdx = meshInfo[2]
            matNum = meshInfo[3]
            meshName = meshInfo[4]

            if self.xxFormat >= 4:
                rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT,
                                              70, 2)
                rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT,
                                            70, 30)
                rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 70,
                                         42)
            else:
                rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT,
                                              52, 4)
                rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT,
                                            52, 32)
                rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 52,
                                         44)

            if len(self.matList) > matNum:
                mat = self.matList[matNum]
                matName = mat.name
                rapi.rpgSetMaterial(matName)
            rapi.rpgSetName(meshName)
            rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_USHORT, numIdx,
                                    noesis.RPGEO_TRIANGLE, 1)
            rapi.rpgClearBufferBinds()
 def parse_file(self):
     '''Main parser method'''
     
     idstring = self.inFile.readBytes(6)
     self.inFile.readShort()
     self.inFile.readShort()
     self.read_name()
     meshName = self.read_name()
     
     self.inFile.readByte() # delim?
     bbox = self.inFile.read('6f')
     
     self.inFile.readUInt()
     self.inFile.readUInt()
     numVerts, numIdx = self.inFile.read('2H')
     vertBuff = self.parse_vertices(numVerts)
     idxBuff = self.parse_faces(numIdx)
     
     self.parse_materials()
     
     rapi.rpgSetName(meshName)
     rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
     rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 12)
     rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)
     rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_SHORT, numIdx, noesis.RPGEO_TRIANGLE, 1)
 def build_meshes(self):
         
     for meshInfo in self.meshInfo:
         
         vertBuff = meshInfo[0]
         idxBuff = meshInfo[1]
         numIdx = meshInfo[2]
         matNum = meshInfo[3]
         meshName = meshInfo[4]
         
         if self.xxFormat >= 4:
             rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 70, 2)
             rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 70, 30)
             rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 70, 42)
         else:
             rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 52, 4)
             rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 52, 32)
             rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 52, 44)
         
         if len(self.matList) > matNum:
             mat = self.matList[matNum]            
             matName = mat.name
             rapi.rpgSetMaterial(matName)
         rapi.rpgSetName(meshName)
         rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_USHORT, numIdx, noesis.RPGEO_TRIANGLE, 1)
         rapi.rpgClearBufferBinds()    
示例#9
0
    def build_mesh(self):

        print(len(self.idxBuffs), len(self.matList))
        for i in range(len(self.idxBuffs)):
            vertBuff, vertSize = self.vertBuffs[i]
            idxBuff, numIdx = self.idxBuffs[i]

            if i < len(self.matList):
                matName = self.matList[i].name
            else:
                matName = self.matList[-1].name

            if vertSize == 56:
                rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT,
                                              56, 0)
                rapi.rpgBindPositionUV1Ofs(vertBuff, noesis.RPGEODATA_FLOAT,
                                           56, 12)
                rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 56,
                                         28)
            elif vertSize == 72:
                rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT,
                                              72, 0)
                rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT,
                                            72, 28)
                rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 72,
                                         44)
            rapi.rpgSetMaterial(matName)
            rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_USHORT, numIdx,
                                    noesis.RPGEO_TRIANGLE, 1)
def noepyLoadModel(data, mdlList):
    '''Build the model, set materials, bones, and animations. You do not
    need all of them as long as they are empty lists (they are by default)'''
    

    parser = SanaeParser(data)
    parser.parse_file()
    ctx = rapi.rpgCreateContext()
    
    for i in range(len(parser.vertBuffs)):
        
        vertBuff, numVerts = parser.vertBuffs[i]
        idxBuff, numIdx, matNum = parser.idxBuffs[i]
        matList = [parser.matList[matNum]]
        texList = [parser.texList[matNum]]
        matName = matList[0].name
        
        rapi.rpgReset()
        rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
        rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 12)
        rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)        
        rapi.rpgSetMaterial(matName)
        rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_USHORT, numIdx, noesis.RPGEO_TRIANGLE, 1)    
        
        
        mdl = rapi.rpgConstructModel()
        
        mdl.setModelMaterials(NoeModelMaterials(texList, matList))
        mdl.setBones(parser.boneList)
        mdl.setAnims(parser.animList)
        mdlList.append(mdl)
    return 1
示例#11
0
    def build_meshes(self):

        for i in range(len(self.idxBuffs)):
            idxBuff, numIdx, matNum = self.idxBuffs[i]
            vertBuff, vertType = self.vertBuffs[i]
            if matNum != -1:
                matName = self.matList[matNum].name
                rapi.rpgSetMaterial(matName)

            if vertType == 0.125:
                rapi.rpgBindPositionBufferOfs(vertBuff,
                                              noesis.RPGEODATA_HALFFLOAT, 16,
                                              0)
                rapi.rpgBindNormalBufferOfs(vertBuff,
                                            noesis.RPGEODATA_HALFFLOAT, 16, 6)
                rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_HALFFLOAT,
                                         16, 12)

            elif vertType in [0.0333, 0.0335]:
                rapi.rpgBindPositionBufferOfs(vertBuff,
                                              noesis.RPGEODATA_HALFFLOAT, 22,
                                              0)
                rapi.rpgBindNormalBufferOfs(vertBuff,
                                            noesis.RPGEODATA_HALFFLOAT, 22, 6)
                rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_HALFFLOAT,
                                         22, 18)

            rapi.rpgSetOption(noesis.RPGOPT_TRIWINDBACKWARD, 1)

            rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_USHORT, numIdx,
                                    noesis.RPGEO_TRIANGLE, 1)
def noepyLoadModel(data, mdlList):
    '''Build the model, set materials, bones, and animations. You do not
    need all of them as long as they are empty lists (they are by default)'''

    parser = SanaeParser(data)
    parser.parse_file()
    ctx = rapi.rpgCreateContext()

    for i in range(len(parser.vertBuffs)):

        vertBuff, numVerts = parser.vertBuffs[i]
        idxBuff, numIdx, matNum = parser.idxBuffs[i]
        matList = [parser.matList[matNum]]
        texList = [parser.texList[matNum]]
        matName = matList[0].name

        rapi.rpgReset()
        rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
        rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 12)
        rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)
        rapi.rpgSetMaterial(matName)
        rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_USHORT, numIdx,
                                noesis.RPGEO_TRIANGLE, 1)

        mdl = rapi.rpgConstructModel()

        mdl.setModelMaterials(NoeModelMaterials(texList, matList))
        mdl.setBones(parser.boneList)
        mdl.setAnims(parser.animList)
        mdlList.append(mdl)
    return 1
示例#13
0
    def CreateModel(self):

        for n in range(self.numMesh):
            rapi.rpgBindPositionBufferOfs(self.vertBuff[n],
                                          noesis.RPGEODATA_HALFFLOAT, 64, 0)
            rapi.rpgBindUV1BufferOfs(self.vertBuff[n], noesis.RPGEODATA_SHORT,
                                     64, 16)
            rapi.rpgBindUV2BufferOfs(self.vertBuff[n], noesis.RPGEODATA_SHORT,
                                     64, 16)

            idxBuffer = self.idxBuff[n][:]
            for i in range(self.numDrawCall[n]):
                numDrawFace = self.drawCallFace[n][i]
                idxBuff = idxBuffer[:numDrawFace * 6]
                idxBuffer = idxBuffer[numDrawFace * 6:]
                rapi.rpgSetMaterial(self.matList[self.matID[n][i]].name)
                if self.matID[n][i] in self.matEmis:
                    #rapi.rpgSetLightmap(self.matEmis[self.matID[n][i]].name)
                    self.matList[self.matID[n][i]].setNextPass(
                        self.matEmis[self.matID[n][i]])
                rapi.rpgSetOption(noesis.RPGOPT_TRIWINDBACKWARD, 1)
                if SKIPTOID:
                    rapi.rpgBindBoneIndexBufferOfs(self.boneBuff[n],
                                                   noesis.RPGEODATA_UBYTE, 4,
                                                   0, 4)
                else:
                    rapi.rpgBindBoneIndexBufferOfs(self.vertBuff[n],
                                                   noesis.RPGEODATA_UBYTE, 64,
                                                   44, 4)
                rapi.rpgBindBoneWeightBufferOfs(self.vertBuff[n],
                                                noesis.RPGEODATA_FLOAT, 64, 28,
                                                4)
                rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_USHORT,
                                        numDrawFace * 3, noesis.RPGEO_TRIANGLE,
                                        1)
def noepyLoadModel(data, mdlList):
    '''Build the model, set materials, bones, and animations. You do not
    need all of them as long as they are empty lists (they are by default)'''

    ctx = rapi.rpgCreateContext()
    parser = SanaeParser(data)
    parser.parse_file()

    #build meshes
    for pose in parser.vertGroups.keys():
        print(pose, len(parser.vertGroups[pose]))
    vertBuffs = parser.vertGroups["walk"]
    for i in range(len(vertBuffs)):
        idxBuff, numIdx, matNum = parser.idxBuffs[i % len(parser.idxBuffs)]
        vertBuff = vertBuffs[i]
        rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
        rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 12)
        rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)

        matName = parser.matList[matNum].name
        rapi.rpgSetMaterial(matName)
        rapi.rpgSetOption(noesis.RPGOPT_TRIWINDBACKWARD, 1)
        rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_USHORT, numIdx,
                                noesis.RPGEO_TRIANGLE, 1)

    mdl = rapi.rpgConstructModel()
    mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
    mdl.setBones(parser.boneList)
    mdl.setAnims(parser.animList)
    mdlList.append(mdl)
    return 1
 def build_meshes(self):
     
     rapi.rpgSetOption(noesis.RPGOPT_TRIWINDBACKWARD, 1)
     for mesh in self.meshList:
         
         print(mesh.vertSize)
         if mesh.vertSize == 28:
             rapi.rpgBindPositionBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 28, 0)
         elif mesh.vertSize == 32:
             rapi.rpgBindPositionBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
             #rapi.rpgBindNormalBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 32, 20)
             rapi.rpgBindUV1BufferOfs(mesh.vertBuff, noesis.RPGEODATA_HALFFLOAT, 32, 16)
         elif mesh.vertSize == 36:
             rapi.rpgBindPositionBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 36, 0)
         elif mesh.vertSize == 40:
             rapi.rpgBindPositionBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 40, 0)
         elif mesh.vertSize == 44:
             rapi.rpgBindPositionBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 44, 0)
         
         
         #for j in range(mesh.numFaceGroups): # Not sure
         for j in range(1):
             numIdx = mesh.numIndices[j]
             idxBuff = mesh.idxBuffs[j]
             rapi.rpgSetMaterial("WP_A_1550small.tga")
             rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_USHORT, numIdx, noesis.RPGEO_TRIANGLE_STRIP, 1)
    def parse_vertices(self, numVerts):

        vertBuff = self.inFile.readBytes(numVerts * 40)
        rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 40, 0)
        rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 40, 12)
        rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 40, 32)

        self.invert_faces()
示例#17
0
 def parse_vertices(self, numVerts):
     
     vertBuff = self.inFile.readBytes(numVerts*40)
     rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 40, 0)
     rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 40, 12)
     rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 40, 32)    
 
     self.invert_faces()
 def build_meshes(self):
     
     for mesh in self.meshList:
         
         rapi.rpgBindPositionBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 44, 0)
         rapi.rpgBindNormalBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 44, 12)
         rapi.rpgBindUV1BufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 44, 28)
         rapi.rpgCommitTriangles(mesh.idxBuff, noesis.RPGEODATA_USHORT, mesh.numIdx, noesis.RPGEO_TRIANGLE, 1)
示例#19
0
    def CreateGeo(self):
        print(len(self.idxs))
        x = 0
        y = len(self.geos)  #8
        n = []  #[5,6,7]
        GEO_C = 0
        self.matList = []
        self.texList = []
        dirPath = rapi.getDirForFilePath(rapi.getInputName())
        for mat in self.mats:
            self.matList.append(mat.material)
            mat = mat.material
            diffuse = mat.texName
            normal = mat.nrmTexName
            specular = mat.specTexName
            for t in [diffuse, normal, specular]:
                try:
                    tex = open(dirPath + '/' + t, 'rb').read()
                    tex = rapi.loadTexByHandler(tex, '.dds')
                    tex.name = t
                    self.texList.append(tex)
                except:
                    raise

        for i in range(x, x + y):
            #for i in range(len(self.idxs)):
            idx = self.idxs[i]
            geo = self.geos[i]
            prop = geo.props
            print("%d: " % i, idx.name, " | ", geo.name)
            print(idx.numTri, idx.numIdx, geo.numVert)
            if not i in n:

                #material = self.matList[MaterialLink[idx.name]]
                rapi.rpgSetMaterial(MaterialLink[idx.name])
                rapi.rpgBindPositionBufferOfs(geo.vertBuffer,
                                              noesis.RPGEODATA_FLOAT,
                                              geo.vertLength, prop['position'])
                rapi.rpgBindUV1BufferOfs(geo.uvBuffer, noesis.RPGEODATA_FLOAT,
                                         geo.uvLength, prop['tex0'])
                rapi.rpgBindNormalBufferOfs(geo.vertBuffer,
                                            noesis.RPGEODATA_FLOAT,
                                            geo.vertLength, prop['normal'])
                rapi.rpgBindTangentBufferOfs(geo.vertBuffer,
                                             noesis.RPGEODATA_FLOAT,
                                             geo.vertLength, prop['tangent'])
                rapi.rpgCommitTriangles(idx.idxBuffer, noesis.RPGEODATA_USHORT,
                                        idx.numIdx, noesis.RPGEO_TRIANGLE, 1)
                #rapi.rpgCommitTriangles         (idx.idxBuffer,    noesis.RPGEODATA_USHORT, idx.numTri,     noesis.RPGEO_TRIANGLE, 1)
            if GEO_C == 1:
                bs = NoeBitStream()
                fileG = open("geo-%d.p3ddump" % i, 'wb')
                bs.writeUInt(geo.numVert)
                bs.writeBytes(geo.vertBuffer)
                bs.writeUInt(idx.numTri)
                bs.writeBytes(idx.idxBuffer)
                fileG.write(bs.getBuffer())
                fileG.close()
  def build_mesh(self):
      
      for i in range(len(self.meshList)):
          mesh = self.meshList[i]
          rapi.rpgBindPositionBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
          rapi.rpgBindNormalBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 32, 12)
          rapi.rpgBindUV1BufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)
 
          rapi.rpgCommitTriangles(mesh.idxBuff, noesis.RPGEODATA_UINT, mesh.numIdx, noesis.RPGEO_TRIANGLE, 1)         
 def parse_vertices(self, numVerts):
    
    self.vertList = self.inFile.readBytes(numVerts * 48)
    rapi.rpgBindPositionBufferOfs(self.vertList, noesis.RPGEODATA_FLOAT, 48, 0)
    rapi.rpgBindNormalBufferOfs(self.vertList, noesis.RPGEODATA_FLOAT, 48, 28)
    rapi.rpgBindUV1BufferOfs(self.vertList, noesis.RPGEODATA_FLOAT, 48, 40)
    
    trans = NoeMat43((NoeVec3((-1.0, 0.0, 0.0)), NoeVec3((0.0, 1.0, 0.0)), NoeVec3((0.0, 0.0, 1.0)), NoeVec3((0.0, 0.0, 0.0))))
    rapi.rpgSetTransform(trans)
    def build_mesh(self):
        
        for mesh in self.meshList:
            rapi.rpgBindPositionBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 92, 0)
            rapi.rpgBindNormalBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 92, 12)
            rapi.rpgBindUV1BufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 92, 28)                        
            rapi.rpgSetName(mesh.meshName)

            matName = self.matList[mesh.matNum].name
            rapi.rpgSetMaterial(matName)
            rapi.rpgCommitTriangles(mesh.idxBuff, noesis.RPGEODATA_UINT, mesh.numIdx, noesis.RPGEO_TRIANGLE, 1)
 def build_mesh(self):
     
     for i in range(len(self.meshList)):
         mesh = self.meshList[i]
         rapi.rpgBindPositionBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 48, 0)
         rapi.rpgBindNormalBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 48, 28)
         rapi.rpgBindUV1BufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 48, 40)            
         
         matName = self.matList[i].name
         rapi.rpgSetMaterial(matName)
         rapi.rpgCommitTriangles(mesh.idxBuff, noesis.RPGEODATA_USHORT, mesh.numIdx, noesis.RPGEO_TRIANGLE, 1)
 def parse_vertices(self, numVerts):
     
     vertBuff = self.inFile.readBytes(numVerts*32*3)
     rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
     rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 12)
     rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)        
     
     idxBuff = bytes()
     for i in range(numVerts * 3):
         idxBuff += struct.pack('L', i)
         
     return idxBuff
 def parse_vertices(self, numVerts, vertType):
     
     if vertType == 0:
         vertBuff = self.inFile.readBytes(44*numVerts)
         rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 44, 0)
         rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 44, 12)
         rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 44, 24)            
     elif vertType == 1024:
         vertBuff = self.inFile.readBytes(52*numVerts)
         rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 52, 0)
         rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 52, 12)
         rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 52, 24)
    def parse_vertices(self, numVerts):

        vertBuff = self.inFile.readBytes(numVerts * 32 * 3)
        rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
        rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 12)
        rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)

        idxBuff = bytes()
        for i in range(numVerts * 3):
            idxBuff += struct.pack('L', i)

        return idxBuff
 def parse_vertices(self, numVerts, vertType):
     
     if vertType == 0:
         vertBuff = self.inFile.readBytes(48*numVerts)
         rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 48, 0)
         rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 48, 28)
         rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 48, 40)        
     elif vertType == 1:
         vertBuff = self.inFile.readBytes(32*numVerts)
         rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
         rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 12)
         rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)
示例#28
0
 def parse_vertices(self, numVerts, vertType):
     
     if vertType == 0x01:
         vertBuff = self.inFile.readBytes(numVerts*32)
         rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
         rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 12)
         rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 24) 
     elif vertType == 0x17:
         vertBuff = self.inFile.readBytes(numVerts*44)
         rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 44, 0)
         rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 44, 12)
         rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 44, 36)
 def build_mesh(self):
     
     for i in range(len(self.meshList)):
         mesh = self.meshList[i]
         rapi.rpgSetName(self.filename)
         rapi.rpgBindPositionBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 40, 0)
         rapi.rpgBindNormalBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 40, 16)
         rapi.rpgBindUV1BufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 40, 32)
 
         matName = self.matList[0].name
         rapi.rpgSetMaterial(matName)
         rapi.rpgCommitTriangles(mesh.idxBuff, noesis.RPGEODATA_UINT, mesh.numIdx, noesis.RPGEO_TRIANGLE, 1)
 def parse_vertices(self, numVerts, meshType):
     
     if meshType == 0:
         vertBuff = self.inFile.readBytes(numVerts*32)
         rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
         rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 12)
         rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)
     elif meshType == 1:
         vertBuff = self.inFile.readBytes(numVerts*40)
         rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 40, 0)
         rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 40, 12)
         rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 40, 24)
    def build_meshes(self):
        
        for i in range(len(self.meshList)):
            mesh = self.meshList[i]
            rapi.rpgBindPositionBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
            rapi.rpgBindNormalBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 32, 12)
            rapi.rpgBindUV1BufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)

            print(mesh.matNum)
            matName = self.matList[mesh.matNum].name
            rapi.rpgSetMaterial(matName)
            rapi.rpgCommitTriangles(mesh.idxBuff, noesis.RPGEODATA_USHORT, mesh.numIdx, noesis.RPGEO_TRIANGLE_STRIP, 1)
    def build_mesh(self):

        for mesh in self.meshList:
            rapi.rpgBindPositionBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 92, 0)
            rapi.rpgBindNormalBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 92, 12)
            rapi.rpgBindUV1BufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 92, 28)

            trans = NoeMat43((NoeVec3((-1, 0, 0)), NoeVec3((0, 1, 0)), NoeVec3((0, 0, 1)), NoeVec3((0, 0, 0))))
            rapi.rpgSetTransform(trans)

            rapi.rpgSetName(mesh.matName)
            rapi.rpgSetMaterial(mesh.matName)
            rapi.rpgCommitTriangles(mesh.idxBuff, noesis.RPGEODATA_UINT, mesh.numIdx, noesis.RPGEO_TRIANGLE, 1)
 def build_meshes(self):
     
     for i in range(len(self.meshList)):
         mesh = self.meshList[i]
         print(mesh.name)
         if "lod01" not in mesh.name:
             continue
         rapi.rpgBindPositionBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, mesh.vertSize, 0)
         rapi.rpgBindNormalBufferOfs(mesh.vertBuff, noesis.RPGEODATA_HALFFLOAT, mesh.vertSize, 6)
         rapi.rpgBindUV1BufferOfs(mesh.vertBuff, noesis.RPGEODATA_HALFFLOAT, mesh.vertSize, 10)
         matName = self.matList[i].name
         rapi.rpgSetMaterial(matName)
         rapi.rpgCommitTriangles(mesh.idxBuff, noesis.RPGEODATA_USHORT, mesh.numIdx, noesis.RPGEO_TRIANGLE, 1)
 def parse_vertices(self, numVerts, vertSize):
     
     if vertSize == 52:
         vertBuff = self.inFile.readBytes(numVerts*52)
         rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 52, 0)
         rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 52, 28)
         rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 52, 44)
     elif vertSize == 56:
         vertBuff = self.inFile.readBytes(numVerts*56)
         rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 56, 0)
         rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 56, 28)
         rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 56, 48)
     rapi.rpgCommitTriangles(None, noesis.RPGEODATA_USHORT, numVerts, noesis.RPGEO_POINTS, 1)
 def build_mesh(self):
 
     for i in range(len(self.meshList)):
         mesh = self.meshList[i]
         rapi.rpgBindPositionBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
         rapi.rpgBindNormalBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 32, 12)
         rapi.rpgBindUV1BufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)
         
         meshName = "Mesh%d" %i
         rapi.rpgSetName(meshName)
         mat = self.matList[i]
         rapi.rpgSetMaterial(mat.name)
         rapi.rpgCommitTriangles(mesh.idxBuff, noesis.RPGEODATA_USHORT, mesh.numIdx, noesis.RPGEO_TRIANGLE, 1)
 def build_meshes(self):
     
     for mesh in self.meshList:
         rapi.rpgBindPositionBufferOfs(mesh.vertBuff, noesis.RPGEODATA_HALFFLOAT, 24, 0)
         rapi.rpgBindUV1BufferOfs(mesh.vertBuff, noesis.RPGEODATA_HALFFLOAT, 24, 8)
         
         for idxStart, numIdx, matName in self.meshInfo:
             
             start = idxStart * 2
             end = start + (numIdx * 2)
             idxBuff = mesh.idxBuff[start:end]
             
             rapi.rpgSetMaterial(matName)
             rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_USHORT, numIdx, noesis.RPGEO_TRIANGLE, 1)
    def CreateGeo(self):
        print(len(self.idxs))
        x=0
        y=len(self.geos)#8
        n = []#[5,6,7]
        GEO_C = 0
        self.matList    = []
        self.texList    = []
        dirPath         = rapi.getDirForFilePath(rapi.getInputName())
        for mat in self.mats:
            self.matList.append(mat.material)
            mat         = mat.material
            diffuse     = mat.texName
            normal      = mat.nrmTexName
            specular    = mat.specTexName
            for t in [diffuse,normal,specular]:
                try:
                    tex         = open(dirPath + '/' +t,'rb').read()
                    tex         = rapi.loadTexByHandler(tex,'.dds')
                    tex.name    = t
                    self.texList.append(tex)
                except:
                    raise
        
        for i in range(x,x+y):
        #for i in range(len(self.idxs)):
            idx  = self.idxs[i]
            geo  = self.geos[i]
            prop = geo.props
            print("%d: "%i,idx.name," | ",geo.name)
            print(idx.numTri,idx.numIdx,geo.numVert)
            if not i in n:

                #material = self.matList[MaterialLink[idx.name]]
                rapi.rpgSetMaterial(MaterialLink[idx.name])
                rapi.rpgBindPositionBufferOfs   (geo.vertBuffer,   noesis.RPGEODATA_FLOAT,  geo.vertLength, prop['position'])
                rapi.rpgBindUV1BufferOfs        (geo.uvBuffer,     noesis.RPGEODATA_FLOAT,  geo.uvLength,   prop['tex0'])
                rapi.rpgBindNormalBufferOfs     (geo.vertBuffer,   noesis.RPGEODATA_FLOAT,  geo.vertLength, prop['normal'])
                rapi.rpgBindTangentBufferOfs    (geo.vertBuffer,   noesis.RPGEODATA_FLOAT,  geo.vertLength, prop['tangent'])
                rapi.rpgCommitTriangles         (idx.idxBuffer,    noesis.RPGEODATA_USHORT, idx.numIdx,     noesis.RPGEO_TRIANGLE, 1)
                #rapi.rpgCommitTriangles         (idx.idxBuffer,    noesis.RPGEODATA_USHORT, idx.numTri,     noesis.RPGEO_TRIANGLE, 1)
            if GEO_C == 1:
                bs = NoeBitStream()
                fileG = open("geo-%d.p3ddump"%i,'wb')
                bs.writeUInt(geo.numVert)
                bs.writeBytes(geo.vertBuffer)
                bs.writeUInt(idx.numTri)
                bs.writeBytes(idx.idxBuffer)
                fileG.write(bs.getBuffer())
                fileG.close()
 def build_meshes(self):
     
     for mesh in self.meshList:
         
         if mesh.vertType == 3:
             rapi.rpgBindPositionBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 48, 0)
         elif mesh.vertType == 9:
             rapi.rpgBindPositionBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 72, 0)
             rapi.rpgBindNormalBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 72, 52)
             rapi.rpgBindUV1BufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 72, 40)
         
         for numIdx, idxBuff, matName in mesh.faceGroups:
             rapi.rpgSetMaterial(matName)
             rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_USHORT, numIdx, noesis.RPGEO_TRIANGLE, 1)
 def parse_vertices(self, numVerts, meshType):
     
     print (self.inFile.tell())
     if meshType == 1:
         vertBuff = self.inFile.readBytes(numVerts * 32)
         rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
         rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 12)
         rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)
     elif meshType == 2:
         vertBuff = self.inFile.readBytes(numVerts * 36)
         rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 36, 0)
         rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 36, 16)
         rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 36, 28)
     elif meshType == 3:
         vertBuff = self.inFile.readBytes(numVerts * 40)
         rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 40, 0)
         rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 40, 20)
         rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 40, 32)
     elif meshType == 4:
         vertBuff = self.inFile.readBytes(numVerts * 44)
         rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 44, 0)
         rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 44, 24)
         rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 44, 36)
     else:
         print("unknown meshType: %d" %meshType)        
 def build_mesh(self):
     
     for mesh in self.meshList:
         rapi.rpgBindPositionBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
         rapi.rpgBindNormalBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 32, 12)
         rapi.rpgBindUV1BufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)            
         
         for matNum in mesh.idxBuffs:
             
             matName = mesh.materials[matNum].name
             
             idxBuff = mesh.idxBuffs[matNum]
             numIdx = len(idxBuff) // 2
             rapi.rpgSetMaterial(matName)
             rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_USHORT, numIdx, noesis.RPGEO_TRIANGLE, 1)               
示例#41
0
    def build_mesh(self):

        for mesh in self.meshList:
            rapi.rpgBindPositionBufferOfs(mesh.vertBuff,
                                          noesis.RPGEODATA_FLOAT, 92, 0)
            rapi.rpgBindNormalBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT,
                                        92, 12)
            rapi.rpgBindUV1BufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 92,
                                     28)
            rapi.rpgSetName(mesh.meshName)

            matName = self.matList[mesh.matNum].name
            rapi.rpgSetMaterial(matName)
            rapi.rpgCommitTriangles(mesh.idxBuff, noesis.RPGEODATA_UINT,
                                    mesh.numIdx, noesis.RPGEO_TRIANGLE, 1)
def build_mesh(meshList):
    
    for mesh in meshList:
        
        if mesh.vertSize == 32:
            rapi.rpgBindPositionBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
            rapi.rpgBindNormalBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 32, 12)
            rapi.rpgBindUV1BufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)
        elif mesh.vertSize == 36:
            rapi.rpgBindPositionBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 36, 0)
            rapi.rpgBindNormalBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 36, 12)
            rapi.rpgBindUV1BufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 36, 28)              
        
        rapi.rpgSetMaterial(mesh.matName)
        rapi.rpgCommitTriangles(mesh.idxBuff, noesis.RPGEODATA_USHORT, mesh.numIdx, noesis.RPGEO_TRIANGLE, 1)
示例#43
0
    def parse_vertices(self, numVerts, vertType):

        if vertType == 0:
            vertBuff = self.inFile.readBytes(44 * numVerts)
            rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 44,
                                          0)
            rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 44,
                                        12)
            rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 44, 24)
        elif vertType == 1024:
            vertBuff = self.inFile.readBytes(52 * numVerts)
            rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 52,
                                          0)
            rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 52,
                                        12)
            rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 52, 24)
示例#44
0
    def build_mesh(self):

        for mesh in self.meshList:
            rapi.rpgBindPositionBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 92, 0)
            rapi.rpgBindNormalBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 92, 12)
            rapi.rpgBindUV1BufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 92, 28)            
            
            trans = NoeMat43((NoeVec3((-1, 0, 0)),
                         NoeVec3((0, 1, 0)),
                         NoeVec3((0, 0, 1)),
                         NoeVec3((0, 0, 0))))
            rapi.rpgSetTransform(trans)
            
            rapi.rpgSetName(mesh.matName)
            rapi.rpgSetMaterial(mesh.matName)
            rapi.rpgCommitTriangles(mesh.idxBuff, noesis.RPGEODATA_UINT, mesh.numIdx, noesis.RPGEO_TRIANGLE, 1)
示例#45
0
    def parse_vertices(self, numVerts, meshType):

        if meshType == 0:
            vertBuff = self.inFile.readBytes(numVerts * 32)
            rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32,
                                          0)
            rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32,
                                        12)
            rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)
        elif meshType == 1:
            vertBuff = self.inFile.readBytes(numVerts * 40)
            rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 40,
                                          0)
            rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 40,
                                        12)
            rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 40, 24)
示例#46
0
    def build_mesh(self):

        rapi.rpgSetName(self.filename)
        rapi.rpgBindPositionBufferOfs(self.vertBuff, noesis.RPGEODATA_FLOAT,
                                      32, 0)
        if self.hasNormals:
            rapi.rpgBindNormalBufferOfs(self.vertBuff, noesis.RPGEODATA_FLOAT,
                                        32, 12)
        rapi.rpgBindUV1BufferOfs(self.vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)

        if len(self.matList) > 0:
            material = self.matList[0]
            rapi.rpgSetMaterial(material.name)

        rapi.rpgCommitTriangles(self.idxBuff, noesis.RPGEODATA_UINT,
                                self.numIdx, noesis.RPGEO_TRIANGLE, 1)
    def parse_vertices(self, numVerts, vertType):

        if vertType == 0:
            vertBuff = self.inFile.readBytes(48 * numVerts)
            rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 48,
                                          0)
            rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 48,
                                        28)
            rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 48, 40)
        elif vertType == 1:
            vertBuff = self.inFile.readBytes(32 * numVerts)
            rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32,
                                          0)
            rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32,
                                        12)
            rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)
    def build_mesh(self):

        for i in range(len(self.meshList)):
            mesh = self.meshList[i]
            rapi.rpgBindPositionBufferOfs(mesh.vertBuff,
                                          noesis.RPGEODATA_FLOAT, 32, 0)
            rapi.rpgBindNormalBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT,
                                        32, 12)
            rapi.rpgBindUV1BufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 32,
                                     24)

            meshName = "Mesh%d" % i
            rapi.rpgSetName(meshName)
            mat = self.matList[i]
            rapi.rpgSetMaterial(mat.name)
            rapi.rpgCommitTriangles(mesh.idxBuff, noesis.RPGEODATA_USHORT,
                                    mesh.numIdx, noesis.RPGEO_TRIANGLE, 1)
示例#49
0
	def bindBuffers(self, vertexData, bindWeights = True):
		rapi.rpgClearBufferBinds()
		if self.posType != 0:
			bindTypes = (0, noesis.RPGEODATA_BYTE, noesis.RPGEODATA_SHORT, noesis.RPGEODATA_FLOAT)
			rapi.rpgBindPositionBufferOfs(vertexData, bindTypes[self.posType], self.vertexSize, self.posOfs)
		if self.normalType != 0:
			bindTypes = (0, noesis.RPGEODATA_BYTE, noesis.RPGEODATA_SHORT, noesis.RPGEODATA_FLOAT)
			rapi.rpgBindNormalBufferOfs(vertexData, bindTypes[self.normalType], self.vertexSize, self.normalOfs)
		if self.uvType != 0:
			bindTypes = (0, noesis.RPGEODATA_UBYTE, noesis.RPGEODATA_USHORT, noesis.RPGEODATA_FLOAT)
			rapi.rpgBindUV1BufferOfs(vertexData, bindTypes[self.uvType], self.vertexSize, self.uvOfs)
		if self.colorType == 7:
			#binding is not natively supported for the other color formats. if you want to use them, you need to decode them before binding.
			rapi.rpgBindColorBufferOfs(vertexData, noesis.RPGEODATA_UBYTE, self.vertexSize, self.colorOfs, 4)
		if bindWeights is True and self.weightType != 0:
			bindTypes = (0, noesis.RPGEODATA_UBYTE, noesis.RPGEODATA_USHORT, noesis.RPGEODATA_FLOAT)
			rapi.rpgBindBoneWeightBufferOfs(vertexData, bindTypes[self.weightType], self.vertexSize, self.weightOfs, self.numWeights)
 def build_mesh(self, vertSize):
     
     for i in range(len(self.vertBuffs)):
         vertBuff, numVerts = self.vertBuffs[i]
         idxBuff, numIdx = self.idxBuffs[i]
         matName = self.materials[i]
         
         if vertSize == 36:
             rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 36, 0)
             rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 36, 12)
             rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 36, 28)
         elif vertSize == 44:
             rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 44, 0)
             rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 44, 12)
             rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 44, 36)
         rapi.rpgSetMaterial(matName)
         rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_USHORT, numIdx, noesis.RPGEO_TRIANGLE, 1)
    def build_meshes(self):

        for i in range(len(self.meshList)):
            mesh = self.meshList[i]
            rapi.rpgBindPositionBufferOfs(mesh.vertBuff,
                                          noesis.RPGEODATA_FLOAT, 32, 0)
            rapi.rpgBindNormalBufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT,
                                        32, 12)
            rapi.rpgBindUV1BufferOfs(mesh.vertBuff, noesis.RPGEODATA_FLOAT, 32,
                                     24)

            print(mesh.matNum)
            matName = self.matList[mesh.matNum].name
            rapi.rpgSetMaterial(matName)
            rapi.rpgCommitTriangles(mesh.idxBuff, noesis.RPGEODATA_USHORT,
                                    mesh.numIdx, noesis.RPGEO_TRIANGLE_STRIP,
                                    1)
示例#52
0
文件: inc_noesis.py 项目: r-lyeh/eve
	def bindBuffers(self, vertexData, bindWeights = True):
		rapi.rpgClearBufferBinds()
		if self.posType != 0:
			bindTypes = (0, noesis.RPGEODATA_BYTE, noesis.RPGEODATA_SHORT, noesis.RPGEODATA_FLOAT)
			rapi.rpgBindPositionBufferOfs(vertexData, bindTypes[self.posType], self.vertexSize, self.posOfs)
		if self.normalType != 0:
			bindTypes = (0, noesis.RPGEODATA_BYTE, noesis.RPGEODATA_SHORT, noesis.RPGEODATA_FLOAT)
			rapi.rpgBindNormalBufferOfs(vertexData, bindTypes[self.normalType], self.vertexSize, self.normalOfs)
		if self.uvType != 0:
			bindTypes = (0, noesis.RPGEODATA_UBYTE, noesis.RPGEODATA_USHORT, noesis.RPGEODATA_FLOAT)
			rapi.rpgBindUV1BufferOfs(vertexData, bindTypes[self.uvType], self.vertexSize, self.uvOfs)
		if self.colorType == 7:
			#binding is not natively supported for the other color formats. if you want to use them, you need to decode them before binding.
			rapi.rpgBindColorBufferOfs(vertexData, noesis.RPGEODATA_UBYTE, self.vertexSize, self.colorOfs, 4)
		if bindWeights is True and self.weightType != 0:
			bindTypes = (0, noesis.RPGEODATA_UBYTE, noesis.RPGEODATA_USHORT, noesis.RPGEODATA_FLOAT)
			rapi.rpgBindBoneWeightBufferOfs(vertexData, bindTypes[self.weightType], self.vertexSize, self.weightOfs, self.numWeights)
    def build_meshes(self):

        for mesh in self.meshList:
            rapi.rpgBindPositionBufferOfs(mesh.vertBuff,
                                          noesis.RPGEODATA_HALFFLOAT, 24, 0)
            rapi.rpgBindUV1BufferOfs(mesh.vertBuff, noesis.RPGEODATA_HALFFLOAT,
                                     24, 8)

            for idxStart, numIdx, matName in self.meshInfo:

                start = idxStart * 2
                end = start + (numIdx * 2)
                idxBuff = mesh.idxBuff[start:end]

                rapi.rpgSetMaterial(matName)
                rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_USHORT,
                                        numIdx, noesis.RPGEO_TRIANGLE, 1)