The Forum is up for sale: XeNTaX Forum looking for new owner

[request] kao the kangaroo .bin .msh files

Post questions about game models here, or help out others!
Bogus
advanced
Posts: 75
Joined: Sat Oct 30, 2010 11:57 am
Has thanked: 1 time
Been thanked: 5 times

Re: [request] kao the kangaroo .bin .msh files

Post by Bogus »

Good job, thank you shakotay2, at least this gives me a hint.
User avatar
Flower35
ultra-n00b
Posts: 7
Joined: Mon Sep 08, 2014 7:34 pm
Location: Polska
Been thanked: 11 times

Re: [request] kao the kangaroo .bin .msh files

Post by Flower35 »

Here is a quick documentation for Kao1 animmesh files:
https://drive.google.com/file/d/1g0gnnV ... sp=sharing
Bogus
advanced
Posts: 75
Joined: Sat Oct 30, 2010 11:57 am
Has thanked: 1 time
Been thanked: 5 times

Re: [request] kao the kangaroo .bin .msh files

Post by Bogus »

Small progress, vertices can be read, but problem is with faces, with 1 object and 1 vertex group works but with more than 1 vertex group is error and i not know, how to implement dummy object.
Only vertices works.

Code: Select all

---------------------------
Noesis Python Error
---------------------------
Traceback (most recent call last):
  File "D:\bogus pliki\noesis\plugins\python\fmt_Kao_the_Kangaroo.py", line 54, in noepyLoadModel
    rapi.rpgCommitTriangles(FaceBuff, noesis.RPGEODATA_USHORT, numfaces, noesis.RPGEO_TRIANGLE, 1)
RuntimeError: Number of indices must be evenly divisible by 3 with RPGEO_TRIANGLE

---------------------------
OK   
---------------------------
Here is current noesis script

Code: Select all

from inc_noesis import *
import noesis
import rapi

def registerNoesisTypes():
    handle = noesis.register("Kao the Kangaroo", ".bin")
    noesis.setHandlerTypeCheck(handle, noepyCheckType)
    noesis.setHandlerLoadModel(handle, noepyLoadModel)
    return 1

def noepyCheckType(data):
    bs = NoeBitStream(data)
    Header = bs.readBytes(4)
    if Header != b'T83d':
        return 0
    return 1

def noepyLoadModel(data, mdlList):
    noesis.logPopup()
    ctx = rapi.rpgCreateContext()
    bs = NoeBitStream(data)
    bs.seek(0x0C, NOESEEK_ABS)
    nummeshes = bs.readInt()
    print("number of meshes", nummeshes)
    numfaces = bs.readInt()
    print("number of faces", numfaces)
    numanims = bs.readInt()
    print("number of animations", numanims)
    bs.seek(0x4C, NOESEEK_ABS)

    for i in range(nummeshes):
        numverts = bs.readInt()
        print("number of vertices", numverts)
        numvertgroups = bs.readInt()
        print("number of vertex groups", numvertgroups)
        meshname= (bs.readBytes(32).decode("ASCII").rstrip("\0"))
        print(meshname)
        unknown = bs.readInt()

    for i in range(nummeshes):
        faces = []
        size = bs.readBytes(16*numfaces)
        for j in range(numfaces):
            idx = size[j*16] + size[j*16 + 1]*256
            faces.append(idx)
            idx = size[j*16 + 4] + size[j*16 + 5]*256
            faces.append(idx)
            idx = size[j*16+ 8] + size[j*16 + 9]*256
            faces.append(idx)
        print(faces)
        FaceBuff = struct.pack('H' * len(faces), *faces)
        for j in range(numvertgroups):
            VertBuff = bs.readBytes(numverts * 16)
            rapi.rpgBindPositionBufferOfs(VertBuff, noesis.RPGEODATA_FLOAT, 16, 0)
            rapi.rpgCommitTriangles(None, noesis.RPGEODATA_USHORT, numverts, noesis.RPGEO_POINTS, 1)

    mdl = rapi.rpgConstructModel()
    mdlList.append(mdl)

    rapi.rpgClearBufferBinds()
    return 1
Post Reply