Uffff... I made this. This example helped me:
#include "DarkGDK.h"
// the main entry point for the application is this function
void DarkGDK ( void )
{
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
dbAutoCamOff();
int iBox = 1;
int iFloor = 2;
dbMakeObjectPlain( iFloor, 100, 100 );
dbRotateObject( iFloor, 270, 0, 0 );
// make primitive object box
dbMakeObjectBox( iBox, 10, 10, 10 );
// make mesh from file
//dbLoadObject( "char.x", iBox, 1 );
//dbRotateObject( iBox, 270, 0, 0 );
dbPositionObject( iBox, 0, 20, 0 );
dbPositionCamera( 0, 100, 100 );
dbPointCamera( 0, 20, 0 );
dbHideLight( 0 );
dbMakeLight( 1 );
dbSetPointLight( 1, 50, 100, 50 );
dbSetLightRange( 1, 500 );
dbSetShadowShadingOn( iBox, -1, 255, 1 );
dbPositionLight( 0, 50, 100, 50 );
// our main loop
while ( LoopGDK ( ) )
{
dbText(0, 0, dbStr( dbScreenFPS() ) );
dbYRotateObject( iBox, dbObjectAngleY( iBox ) + 0.5 );
// update the screen
dbSync ( );
}
// return back to windows
return;
}
stencilshadow.fx mast lay in the project folder, or in other folder if you change dir (for example dbSetDir("media\\"); ).
But other problem is "quads" (see red shadow on the picture). When pot rotates, quads sharply jumps... How to smooth this "teeth"? Maybe, I need to use other shader for my objects?