Bug with entitytexture and loadanimmesh

BlitzMax Forums/MiniB3D Module/Bug with entitytexture and loadanimmesh

ckob(Posted 2007) [#1]

Import sidesign.minib3d


Local width = 1024 , height = 768 , depth = 32 , mode = 0

Graphics3D width,height,depth,mode,Canvass


Local cam=CreateCamera()
PositionEntity cam,0,0,-30
	
	
Local light = CreateLight()

texfile$ = RequestFile("Pick Base Texture","bmp,png,jpg")
DebugLog texfile$
BaseTex = LoadTexture(texfile$)
				
				
Local ent1=LoadAnimMesh( "base.b3d" )
EntityTexture ent1,Basetex,0,0



	PositionEntity ent1,0,0,150
	ScaleEntity ent1,5,5,5


'glShadeModel(GL_SMOOTH)


AmbientLight 128,128,128
light_sun = CreateLight(1)
LightColor light_sun,200,200,100
RotateEntity light_sun,60,-90,0

CameraClsColor cam,0,0,128




Local cx#=0
Local cy#=0
Local cz#=0

Local pitch#=30
Local yaw#=40
Local roll#=130

' used by fps code
Local old_ms=MilliSecs()
Local renders
Local fps

While Not KeyDown(KEY_ESCAPE)

	
	




	If KeyHit(KEY_ENTER) Then DebugStop

	' control camera

	If KeyDown(KEY_UP) Then cz#=cz#+1.0
	If KeyDown(KEY_LEFT) Then cx#=cx#-1.0
	If KeyDown(KEY_RIGHT) Then cx#=cx#+1.0
	If KeyDown(KEY_DOWN) Then cz#=cz#-1.0
	
	If KeyDown(KEY_W) Then pitch#=pitch#-1.0
	If KeyDown(KEY_A) Then yaw#=yaw#+1.0
	If KeyDown(KEY_S) Then pitch#=pitch#+1.0
	If KeyDown(KEY_D) Then yaw#=yaw#-1.0

	MoveEntity cam,cx#*0.5,cy#*0.5,cz#*0.5
	RotateEntity ent1,pitch#,yaw#,roll#
	
	cx#=0
	cy#=0
	cz#=0

	
	RenderWorld
	renders=renders+1

	
	
	' calculate fps
	If MilliSecs()-old_ms>=1000
		old_ms=MilliSecs()
		fps=renders
		renders=0
	EndIf
	
'	DebugText 0,0,"FPS: "+String(fps)

	Flip
	
Wend
End




Try that it doesn't seem to work.


klepto2(Posted 2007) [#2]
I don't have the abbility to check it now, but I have an idea:
If you load meshes they don't have real textures, instead there are different brushes for each surface.

Here is a possible solution: [Maybe Pseudo code]

Function TextureLoadedMesh(Mesh:TMesh,Tex:TTexture,Index:Int = 0)
	For Local Surf:TSurface = EachIn Mesh.Surf_list
		BrushTexture(Surf.Brush,Tex,Index)
	Next
End Function



ckob(Posted 2007) [#3]
that doesn't seem to work either. I can't figure out whats going on with this I've looked through the source of minib3d on the loadanimmesh and its the same bit as loadmesh so im not sure why it isn't working.


ckob(Posted 2007) [#4]
can anyone else try this to confirm it does not work? I'm wondering if this is just my crappy machine.


Extron(Posted 2007) [#5]
Hi !

This work perfectly for me, animated mesh or not, single or multi surface, single or multi texture, etc...


ckob(Posted 2007) [#6]
hmm doesnt work here.

AMD 64 3000
1 GB Ram
FX 5600 - 256 MB

probebly my piece of crap video card. But i can't see why because this works in Blitz3d. I know Minib3d uses opengl but what the hell.