How to do multitexturing of objects correctly?
WorldObjectID=LoadWorld()
function LoadWorld()
WorldObjectID=LoadObjectWithChildren("Map/SP_Showcase.x") `````````````````````````````````` load map
SetObjectScalePermanent(WorldObjectID,0.1,0.1,0.1)
SetObjectScreenCulling(WorldObjectID,0) // portal culling would work best in this kind of level
// Beware: the Material order is important
// most 3D model formats create groups for every texture
// so one Material/Texture-Set for every mesh
Diffuse=LoadImage("Map/pk01_gra_floor01_d.png") `````````````````` load materials
AddMaterial(Diffuse) ``````````````````````````````````````` applying a material to a specific mesh
Diffuse=LoadImage("Map/pk01_roof01_d.png")
AddMaterial(Diffuse)
Diffuse=LoadImage("Map/pk01_wall03b_d.png")
AddMaterial(Diffuse
Diffuse=LoadImage("Map/pk01_tile_floor01b_d.png")
AddMaterial(Diffuse)
Diffuse=LoadImage("Map/pk01_pan_floor02b_d.png")
AddMaterial(Diffuse)
Diffuse=LoadImage("Map/pk01_trims01b_d.png")
AddMaterial(Diffuse)
Diffuse=LoadImage("Map/pk01_door01b_d.png")
AddMaterial(Diffuse)
SetObjectMaterials(WorldObjectID) ```````````````````````applying all materials to specific mesh
RemoveMaterials()
endfunction WorldObjectID
function SetObjectMaterials(WorldObjectID)
for MeshID=1 to GetObjectNumMeshes(WorldObjectID) ````````````the task of looping over the entire main map of meshes
if Material[MeshID-1].Diffuse>0
SetObjectMeshImage(WorldObjectID,MeshID,Material[MeshID-1].Diffuse,0)
endif
next MeshID
endfunction
function AddMaterial(Diffuse)
TempMaterial as MatData
if GetImageExists(Diffuse)
TempMaterial.Diffuse=Diffuse
SetImageWrapU(TempMaterial.Diffuse,1)
SetImageWrapV(TempMaterial.Diffuse,1)
endif
Material.insert(TempMaterial)
endfunction
function RemoveMaterials()
Material.length=-1
endfunction
This is an example of loading a map from a fps creator into an app game kit.
Did I write everything correctly?
The code doesn't work for some reason.
Although it worked in the examples.
programming is a hobby, not a job.
P.S. in google and youtube - nikename pavelman- it is not me!