This is now driving me mad...
I have NEVER been able to get lighting of any kind to work in any of my games, beyond ambient, and, now I know I just need help. The lighting sample isn't clear on how the lighting terms work (for me at least) and, all I want to do is create the effect of a spotlight over the table...
PLEASE can someone help?
//Dark GDK - The Game Creators - www.thegamecreators.com
// the wizard has created a very simple project that uses Dark GDK
// it contains the basic code for a GDK application
// whenever using Dark GDK you must ensure you include the header file
#include "DarkGDK.h"
// the main entry point for the application is this function
void DarkGDK ( void )
{
//Main Settings
dbSyncOn ( );
dbSyncRate ( 0 );
dbSetDisplayMode ( 800, 600, 32 );
dbColorBackdrop ( dbRGB ( 0, 0, 0 ) ); // color backdrop black
dbSetNormalizationOn ( );
dbSetShadowShadingOn ( 1, 1, 2000, 1 );
//Default Camera(!) ( 0 )
dbAutoCamOff ( );
dbPositionCamera ( 40, 40, 40 );
dbPointCamera ( 0, 125, 5, 0 );
//Lights!
dbHideLight ( 0 );
dbMakeLight ( 1 );
dbSetDirectionalLight ( 1, 0, 100, 0 );
dbSetLightRange ( 1, 2000 );
dbPositionLight ( 1, 0, 100, 0 );
dbShowLight ( 1 );
dbPointLight ( 1, 0, -100, 0 );
dbColorLight ( 1, dbRGB ( 255, 255, 255 ) );
//Table
dbMakeObjectPlain ( 1, 475, 226 );
dbLoadImage ( "Green.bmp", 1 );
dbTextureObject ( 1, 1 );
dbSetObjectTexture ( 1, 0, 1 );
dbPositionObject ( 1, 0, 0, 0 );
dbXRotateObject ( 1, 90 );
dbSetObjectCollisionOn ( 1 );
//CueBall
dbMakeObjectSphere ( 2, 10 );
dbSetObjectSmoothing ( 2, 100 );
dbPositionObject ( 2, 125, 5, 0 );
dbColorObject ( 2, dbRGB ( 0, 0, 0 ) );
dbSetObjectCollisionOn ( 2 );
//Other Balls
//floats
// our main loop
while ( LoopGDK ( ) )
{
dbPrint ( "Esc To Exit" );
dbPrint ( "W - Move Forwards" );
dbPrint ( "S - Move Back" );
dbPrint ( "A - Strafe Left" );
dbPrint ( "D - Strafe Right" );
dbPrint ( "Use Mouse to pan around." );
//wasd movment
if ( dbKeyState ( 17 ) ) // w - forwards
{
dbMoveCamera ( 0, 3 );
};
if ( dbKeyState ( 31 ) ) // s - backwards
{
dbMoveCamera ( 0, -3 );
};
if ( dbKeyState ( 30 ) ) // a - strafe left
{
dbTurnCameraLeft ( 0, 90 );
dbMoveCamera ( 0, 1.5 );
dbTurnCameraRight ( 0, 90 );
};
if ( dbKeyState ( 32 ) ) // d - strafe right
{
dbTurnCameraRight ( 0, 90 );
dbMoveCamera ( 0, 1.5 );
dbTurnCameraLeft ( 0, 90 );
};
//mousemove camera
if ( dbMouseMoveX ( ) )
{
float mx = dbMouseX ( );
float my = dbMouseY ( );
float mz = dbMouseZ ( );
dbYRotateCamera ( dbWrapValue ( mx + 0.01 ) );
dbXRotateCamera ( dbWrapValue ( my + 0.01 ) );
dbZRotateCamera ( dbWrapValue ( mz ) );
};
if ( dbMouseMoveY ( ) )
{
float mx = dbMouseX ( );
float my = dbMouseY ( );
float mz = dbMouseZ ( );
dbYRotateCamera ( dbWrapValue ( mx + 0.01 ) );
dbXRotateCamera ( dbWrapValue ( my + 0.01 ) );
dbZRotateCamera ( dbWrapValue ( mz ) );
};
// show frame rate
char szFPS [ 256 ] = "";
strcpy ( szFPS, "fps = " );
strcat ( szFPS, dbStr ( dbScreenFPS ( ) ) );
dbText ( dbScreenWidth ( ) - 20 - dbTextWidth ( szFPS ), dbScreenHeight ( ) - 40, szFPS );
// update the screen
dbSync ( );
}
// return back to windows
return;
}
The offending result:
Any help much appreciated,
HUGE thanks in advance,
G0DL355
--------------
So Endeth What Was Begotten From That Moste Darkest and Forgotten Of Times...