Mulittextured Animating .B3d file ...

Blitz3D Forums/Blitz3D Programming/Mulittextured Animating .B3d file ...

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

Hi Again,

It's very odd. If you delete the animation bit from this code chunk below ('keys' & 'anim' section), it starts being a multimaterial mesh again. Any ideas from my code where I'm going wrong?

Remember I'm just animating objects and not a soft skin model.

thx,

Mike

;*****************
;* .B3D Exporter *
;*****************

Include "b3dfile.bb"

;**** Open file for writting *****

Global filename$="c:\test\temp.b3d"

Global file=WriteFile( filename$ )

b3dSetFile( file )

;**********Title *****************

b3dBeginChunk( "BB3D" )
b3dWriteInt( 1 ) ; Version


;********* Get textures *********

b3dBeginChunk( "TEXS" )

;-- Texture 1 START ---

b3dWriteString( "c:\test\texturea.bmp") ; Texture file name
b3dWriteInt( 1 ) ; Texture flag
b3dWriteInt( 1 ) ; Blend type
b3dWritefloat( 0 ) ; X position
b3dWritefloat( 0 ) ; Y position
b3dWritefloat( 1 ) ; X Scale
b3dWritefloat( 1 ) ; Y Scale
b3dWritefloat( 1 ) ; Rotation

;-- Texture 1 END ---

;-- Texture 2 START ---

b3dWriteString( "c:\test\textureb.bmp") ; Texture file name
b3dWriteInt( 1 ) ; Texture flag
b3dWriteInt( 1 ) ; Blend type
b3dWritefloat( 0 ) ; X position
b3dWritefloat( 0 ) ; Y position
b3dWritefloat( 1 ) ; X Scale
b3dWritefloat( 1 ) ; Y Scale
b3dWritefloat( 1 ) ; Rotation

;-- Texture 2 END ---

;etc.

b3dEndChunk() ;end of Textures chunk

;********* Create brushes *********

b3dBeginChunk( "BRUS" )

;-- Brush defaults ---

b3dWriteInt( 1 ) ; Default textures per chunk
b3dWriteString( "default") ; Default brush name
b3dWritefloat( 1 ) ; Default R
b3dWritefloat( 0 ) ; Default G
b3dWritefloat( 1 ) ; Default B
b3dWritefloat( 1 ) ; Default Alpha
b3dWritefloat( 1 ) ; Default Shininess
b3dWriteInt( 1 ) ; Default Blend type
b3dWriteInt( 1 ) ; Default FX type
b3dWriteInt( 0 ) ; Default texture number

;---Brush 1 START ---

b3dWriteString( "brusha") ; brush 1 name
b3dWritefloat( 1 ) ; Default R
b3dWritefloat( 1 ) ; Default G
b3dWritefloat( 1 ) ; Default B
b3dWritefloat( 1 ) ; Alpha
b3dWritefloat( 1 ) ; Shininess
b3dWriteInt( 1 ) ; Blend type
b3dWriteInt( 1 ) ; FX type
b3dWriteInt( 0 ) ; texture number

;---Brush 1 END ---

;---Brush 2 START ---

b3dWriteString( "brushb") ; brush 2 name
b3dWritefloat( 1 ) ; Default R
b3dWritefloat( 1 ) ; Default G
b3dWritefloat( 1 ) ; Default B
b3dWritefloat( 1 ) ; Alpha
b3dWritefloat( 1 ) ; Shininess
b3dWriteInt( 1 ) ; Blend type
b3dWriteInt( 1 ) ; FX type
b3dWriteInt( 1 ) ; texture number

;---Brush 2 END ---

b3dEndChunk() ;end of brushes chunk

;********** NODES ***********

b3dBeginChunk( "NODE" )
b3dWriteString( "MAIN_NODE") ; Node name

b3dWritefloat( 1 ) ; X pos
b3dWritefloat( 1 ) ; Y pos
b3dWritefloat( 1 ) ; Z pos
b3dWritefloat( 1 ) ; X scale
b3dWritefloat( 1 ) ; Y scale
b3dWritefloat( 1 ) ; Z scale
b3dWritefloat( 1 ) ; W rotation
b3dWritefloat( 1 ) ; X rotation
b3dWritefloat( 1 ) ; Y rotation
b3dWritefloat( 1 ) ; Z rotation

;********** Meshes ***********

;-------------------------------------------------------------

b3dBeginChunk( "MESH" )

b3dWriteInt( 1 ) ; Brush number

;--- VERTS ---

b3dBeginChunk( "VRTS" )

b3dWriteInt( 2 ) ; Flags (0=no, 1=with normals, 2=with colour)
b3dWriteInt( 1 ) ; texture coords set
b3dWriteInt( 2 ) ; coords per set

;-- vert 1 data --

b3dWritefloat( 0 ) ; X pos
b3dWritefloat( -5 ) ; Y pos
b3dWritefloat( 5 ) ; Z pos

b3dWritefloat( 1 ) ; R
b3dWritefloat( 1 ) ; G
b3dWritefloat( 1 ) ; B
b3dWritefloat( 1 ) ; Alpha

b3dWritefloat( 0 ) ; U
b3dWritefloat( 0 ) ; V

;-- vert 2 data --

b3dWritefloat( 0 ) ; X pos
b3dWritefloat( 5 ) ; Y pos
b3dWritefloat( 5 ) ; Z pos

b3dWritefloat( 1 ) ; R
b3dWritefloat( 1 ) ; G
b3dWritefloat( 1 ) ; B
b3dWritefloat( 1 ) ; Alpha

b3dWritefloat( 1 ) ; U
b3dWritefloat( 0 ) ; V

;-- vert 3 data --

b3dWritefloat( 0 ) ; X pos
b3dWritefloat( -5 ) ; Y pos
b3dWritefloat( -5 ) ; Z pos

b3dWritefloat( 1 ) ; R
b3dWritefloat( 1 ) ; G
b3dWritefloat( 1 ) ; B
b3dWritefloat( 1 ) ; Alpha

b3dWritefloat( 0 ) ; U
b3dWritefloat( 1 ) ; V

;-- vert 4 data --

b3dWritefloat( 0 ) ; X pos
b3dWritefloat( 5 ) ; Y pos
b3dWritefloat( 5 ) ; Z pos

b3dWritefloat( 1 ) ; R
b3dWritefloat( 1 ) ; G
b3dWritefloat( 1 ) ; B
b3dWritefloat( 1 ) ; Alpha

b3dWritefloat( 1 ) ; U
b3dWritefloat( 0 ) ; V

;-- vert 5 data --

b3dWritefloat( 0 ) ; X pos
b3dWritefloat( 5 ) ; Y pos
b3dWritefloat( -5 ) ; Z pos

b3dWritefloat( 1 ) ; R
b3dWritefloat( 1 ) ; G
b3dWritefloat( 1 ) ; B
b3dWritefloat( 1 ) ; Alpha

b3dWritefloat( 1 ) ; U
b3dWritefloat( 1 ) ; V

;-- vert 6 data --

b3dWritefloat( 0 ) ; X pos
b3dWritefloat( -5 ) ; Y pos
b3dWritefloat( -5 ) ; Z pos

b3dWritefloat( 1 ) ; R
b3dWritefloat( 1 ) ; G
b3dWritefloat( 1 ) ; B
b3dWritefloat( 1 ) ; Alpha

b3dWritefloat( 0 ) ; U
b3dWritefloat( 1 ) ; V


b3dEndChunk() ;end of verts chunk

;--- TRIS ----

b3dBeginChunk( "TRIS" )

b3dWriteInt( 1 ) ; Brush used for tris

;-- Tris 1 data --

b3dWriteInt( 0 ) ; Tri point A
b3dWriteInt( 1 ) ; Tri point B
b3dWriteInt( 2 ) ; Tri point C

b3dEndChunk() ;end of tris chunk

;--------------
;--- TRIS b----

b3dBeginChunk( "TRIS" )

b3dWriteInt( 2 ) ; Brush used for tris

;-- Tris 2 data --

b3dWriteInt( 3 ) ; Tri point A
b3dWriteInt( 4 ) ; Tri point B
b3dWriteInt( 5 ) ; Tri point C

b3dEndChunk() ;end of tris chunk

b3dEndChunk() ;end of MESH chunk

;-------------------------------------------------------------

;--- KEYS ----

b3dBeginChunk( "KEYS" )

b3dWriteInt( 4 ) ; Flags (1=pos, 2=scale, 4=rot)
b3dWriteInt( 1 ) ; key position

b3dWritefloat( 0 ) ; W rot
b3dWritefloat( 0 ) ; X rot
b3dWritefloat( 0 ) ; Y rot
b3dWritefloat( 0 ) ; Z rot

b3dEndChunk() ;end of Keys chunk

;-------------

b3dBeginChunk( "KEYS" )

b3dWriteInt( 4 ) ; Flags (1=pos, 2=scale, 4=rot)
b3dWriteInt( 100 ) ; key position

; b3dWritefloat( 1 ) ; X pos
; b3dWritefloat( 1 ) ; Y pos
; b3dWritefloat( 1 ) ; Z pos

; b3dWriteint( 1 ) ; X scale
; b3dWriteint( 1 ) ; Y scale
; b3dWriteint( 1 ) ; Z scale

b3dWritefloat( 180 ) ; W rot
b3dWritefloat( 0 ) ; X rot
b3dWritefloat( 0 ) ; Y rot
b3dWritefloat( 0 ) ; Z rot

b3dEndChunk()

;etc.

;-------------
;--- ANIM ----

b3dBeginChunk( "ANIM" )

b3dWriteInt( 0 ) ; Flag (unused, default=0)
b3dWriteInt( 101 ) ; animation length in frames
b3dWritefloat( 60 ) ; animation speed in frames per second (default=60)

b3dEndChunk() ;end of anim chunk

;--------------

b3dEndChunk() ;end of NODE chunk

;---- END ------

b3dEndChunk() ;end of BB3D chunk

CloseFile file

While Not KeyHit(1)

Wend