Just testing the waters here
For starters, I'm trying to make a simple cube with different textures on different sides.
I'm not sure I got all the 3D terminology right btw. I think a mesh consist of one or more polygons (sides), and one or more meshes again is an object (I'm not even thinking about animation at this point
)
The built-in command "CreateObjectBox( x,y,z )" only makes one mesh for a cube, so it seems I can't use that for my purpose? I tried making a cube in Wings3D and Blender. Wings3D also just made one mesh (even if I colored the sides differently, I'm guessing I should made more "materials" but atm I couldn't get it to assign them to only a side. I did manage to make a cube with 6 meshes in Blender though.
I tried:
Exported the blender object as .3ds and .dae,
Also imported the .3ds into Wings3D and exported as .x, 3ds, .dae and .lwo
But none of the objects I import into AppGameKit shows up as anything else than a boring white cube (guessing it's something to do with lighting settings?).
Also, it seems I'm unable to remove any images from a texture stage by setting the image ID to 0 (zero), as described for the command
SetObjectMeshImage (whether made with CreateObjectBox and textured, or loaded with LoadObject). I get an error message stating that "image 0 does not exist". A bug?
Here's my super basic test code so far. Media files included in zip if needed.
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "Cube" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 60, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
// create some light
`CreatePointLight( 1, 0,0,-6, 200, 255,255,255 )
`SetPointLightMode( 1, 1 ) // only pixel lights will be affected by the normal map
objTest = CreateObjectBox( 2, 2, 2 )
`objTest = LoadObject( "Test cube.3ds")
`objTest = LoadObject( "Test cube.dae")
`objTest = LoadObject( "Test cube 2.x")
imgTest = LoadImage( "test.png" )
`SetImageWrapU( imgTest, 0 )
`SetImageWrapV( imgTest, 0 )
`SetObjectImage( objTest, imgTest, 0 )
numeshes = GetObjectNumMeshes( objTest )
for i= 1 to numeshes
SetObjectMeshImage( objTest, i, imgTest, 0 )
`SetObjectMeshImage( objTest, i, 0, 0 )
SetObjectMeshUVScale( objTest, i, 0, .5, .5 )
next i
`SetObjectLightMode( objTest, 1 )
`SetObjectUVScale( objTest, 0, .5, .5 )
SetObjectPosition( objTest, 0, 0, 0 )
SetCameraPosition( 1, 5, 10, -10 )
SetCameraLookAt( 1, 0, 0, 0, 0 )
do
// control the cube
if ( GetRawKeyState( 87 ) ) then RotateObjectLocalX( objTest, 1 )
if ( GetRawKeyState( 83 ) ) then RotateObjectLocalX( objTest, -1 )
if ( GetRawKeyState( 65 ) ) then RotateObjectLocalY( objTest, 1)
if ( GetRawKeyState( 68 ) ) then RotateObjectLocalY( objTest, -1)
if ( GetRawKeyState( 81 ) ) then MoveCameraLocalZ( 1, 0.5 )
if ( GetRawKeyState( 69 ) ) then MoveCameraLocalZ( 1, -0.5 )
Print( ScreenFPS() )
printc ( "Number of meshes: " )
Print( numeshes )
Sync()
loop
Apologies for any typos and strange grammar.