Sommaire

format1


(.3D) FILE FORMAT

v1.0(release) (c) Laurent CANCé Françis (LCF) 2002-2015

9

char

HeaderName

4

char

CHUNK

1

BASIC3D_HDR

Header

1

[LZ77 data]

Part1

1

[LZ77 data]

Part2

DATA

=

Part1 + Part2

while (!end)

{

readCHUNK(4);

"ENDF":

end=1;

"HDR_":

read BASIC3D_HEADER

"MAT_":

read BASIC3D_MATERIAL

"INFO":

read BASIC3D_INFO

"TEX_":

read BASIC3D_TEXTURE

"TE2_":

read BASIC3D_TEXTURE2

"ANIM":

read BASIC3D_ANIMATION

"ANI2":

read BASIC3D_ANIMATION2

"ANI3":

read BASIC3D_ANIMATION3

"CAM_":

read BASIC3D_CAMERA

"LIGH":

read BASIC3D_LIGHTS

"MESH":

read BASIC3D_MESH

}

ENUM

MESH

=

1

SKELETON

=

2

SKIN

=

4

HELPER

=

8

CAMERA

=

16

FREE

=

32

TARGET

=

64

PARALLEL

=

128

ORTHOGRAPHIC

=

256

PERSPECTIVE

=

512

_LIGHT

=

1024

DIRECTIONNAL

=

2048

SPOTLIGHT

=

4096

OMNIDIRECTIONNAL

=

8192

AFFECTDATA

x

char

name+'\0'

1

int

parentID

// object

3

float

x,y,z

4

float

qx,qy,qz,qw

3

float

sx,sy,sz

// pivot

3

float

x,y,z

4

float

qx,qy,qz,qw

3

float

sx,sy,sz

BASIC3D_CAMERA struct

1

int

attr

1

int

fovtype

1

float

fov

1

int

id

1

AFFECTDATA

Affect

1

int

target

1

float

near

1

float

far

BASIC3D_LIGHT struct

1

int

attr

1

int

id

1

AFFECTDATA

Affect

if (attr&TARGET)

1

int

target

1

int

id_projection_map

1

int

id_projection_shadow

3

float

r,g,b

BASIC3D_HEADER struct

1

int

nobjs

1

int

ncams

1

int

nlights

1

int

nanims

1

int

nmat

1

int

ntex

BASIC3D_INFO struct

1

int

framestart

1

int

frameend

1

int

framerate

BASIC3D_MATERIAL struct

1

int

matID

1

int

diffuseID

1

int

specularID

1

int

bumpID

3

float

r,g,b ambient

3

float

r,g,b color

3

float

r,g,b specular

BASIC3D_TEXTURE struct

1

int

id

x

char

filename+'\0'

BASIC3D_TEXTURE2 struct

1

int

id

x

char

filename+'\0'

2

int

tile u,v

2

float

offset u,v

2

float

scale u,v

4x4

float

transfrom matrix

BASIC3D_ANIMATION

1

int

id

1

int

nkeys

1

int

size

1

int

type

if (type&MORPH)

{

.

1

int

samplerate

.

1

int

nv

.

x (nkeys)

.

.

x (nv)

.

.

.

3

float

x,y,z

}

else

{

.

if (type&ROTATION)

.

{

.

x (nkeys)

.

.

1

int

nkey

.

.

4

float

(qx,qy,qz,qw)

.

}

.

else

.

if (type&TRANSLATION)

.

{

.

x (nkeys)

.

.

1

int

nkey

.

.

3

float

tx,ty,tz

.

}

.

else

.

{

.

x (nkeys)

.

.

1

int

nkey

.

.

3

float

sx,sy,sz

.

.

4

float

qx,qy,qz,qw

.

}

}

BASIC3D_ANIMATION2

1

int

id

1

int

nkeys

1

int

size

1

int

type

if (type&MORPH) only

.

1

int

samplerate

.

1

int

nv

.

3

float

minx,miny,minz

.

3

float

maxx,maxy,maxz

.

x (nkeys)

.

.

x (nv)

.

.

.

1

dword

val

// val=(x shl 20)+(y shl 10)+(z) and x,y,z majorés par (1 shl 10)-1

BASIC3D_ANIMATION3

1

int

id

1

int

nkeys

1

int

size

1

int

type

if (type&MORPH) only

.

1

int

samplerate

.

1

int

nv

.

x (nkeys)

.

.

x (nv)

.

.

.

3

float

x,y,z

BASIC3D_MESH

1

int

attr

1

int

id

1

AFFECTDATA

Affect

1

int

nv

if (nv sup 0)

.

1

int

nf

.

x (nv)

.

.

3

float

x,y,z

.

.

2

float

u,v

.

x (nf)

.

.

3

int

i1,i2,i3

.

.

1

int

smoothing group

.

.

1

int

ntexture

.

if (attr&SKIN)

.

1

int

n

.

if (n esup 0)

.

x (nv)

.

.

.

1

int

nbones

.

.

.

x (nbones)

.

.

.

.

3

float

x,y,z

.

.

.

x (nbones)

.

.

.

.

1

int

bonesID[]

.

.

.

.

1

int

bones[]

.

.

.

.

1

float

weights[]

.

.

.

1

int

n

.

.

.

if (n esup 0)

.

.

.

(n)x8

byte

...

[LZ77 data]

PNG LZ77 style buffer

1

dword

CSize

1

dword

Size

(CSize) byte

data