2010-02-23 3 views
2

계층 구조 :3DS 모델로드 - 나무/I가 여기에 3DS 로더를 사용하고

http://www.flipcode.com/archives/Another_3DS_LoaderViewer_Class.shtml

그것은로드 및 모델을 렌더링의 좋은 일을한다, 그러나 그것은 계층 구조의 이해가 부족하다. 결과적으로 모델의 모든 객체가 원점에 렌더링됩니다. 아래의 코드에서

: void Model_3DS::MainChunkProcessor(long length, long findex) 라인입니다 :

// I left this in case anyone gets very ambitious 
case KEYF3DS : 
    //KeyFrameChunkProcessor(h.len, ftell(bin3ds)); 
    break; 

아무도이 어디를 구현하지 않았다, 나는 너무 그것을 구현하는 다른 3DS 로더 표시되지 않습니다. 사람들은 단지 게시하고 화면에 렌더링되는 모든 것에 만족 한이 지점에 도달 할 때까지 게시하는 것처럼 보입니다.

KeyFrameChunkProcessor은 어떻게 생겼습니까?

+1

을, 나는 결국 3DS를로드하고 계층 구조를 검색 할 ASSIMP 라이브러리를 사용 –

답변

2

구글이 나에게 here 주도하십시오 (!) 참고로

Keyframer chunk 
--------------- 

    id   Description 
    ----  ----------- 
    B00A  unknown 
    7001  See first description of this chunk 
    B008  Frames 
    B009  unknown 
    B002  Start object description 

* B008 - Frame information 

simple structure describing frame info 

start end size type   name 
    0 3 4 unsigned long start frame 
    4 7 4 unsigned long end frame 

*B002 - Start of Object info 

Subhunks 

    id  Description 
    ---- ----------- 
    B010 Name & Hierarchy 
    B011* Name Dummy Object 
    B013 unknown 
    B014* unknown 
    B015 unknown 
    B020 Objects pivot point ? 
    B021 unknown 
    B022 unknown 
    B030 unknown 

* B010 - Name & Hierarchy descriptor 

start end size type   name 
0  ? ? ASCIIZ  Object name 
?  ? ? unsigned int unknown 
?  ? ? unsigned int unknown 
?  ? ? unsigned int Hierarchy of Object 

The object hierarchy is a bit complex but works like this. 
Each Object in the scene is given a number to identify its 
order in the tree. Also each object is orddered in the 3ds 
file as it would appear in the tree. 
The root object is given the number -1 (FFFF). 
As the file is read a counter of the object number is kept. 
Is the counter increments the object are children of the 
previous objects.But when the pattern is broken by a number 
what will be less than the current counter the hierarchy returns 
to that level. 

for example. 

    object hierarchy 
    name 

     A  -1 
     B  0     This example is taken 
     C  1     from 50pman.3ds 
     D  2 
     E  1     I would really reccomend 
     F  4     having a look at one of the 
     G  5     examples with the hierarchy 
     H  1     numbers to help work it out. 
     I  7 
     J  8 
     K  0 
     L  10 
     M  11 
     N  0 
     O  13 
     P  14 


          A 
     +-----------------+----------------+ 
     B     K    N 
    +----+----+   +    + 
    C E H   L    O 
    + + +   +    + 
    D F I   M    P 
     + + 
     G J 

Still not done with this chunk yet ! 
If the object name is $$$DUMMY then it is a dummy object 
and therefore you should expect a few extra chunks. 
관련 문제