Chalkey I've 2 objects 1 light 3 vectors and 1 shader
#include "DarkGDK.h"
void DarkGDK ( void )
{
if (dbCheckDisplayMode(800,600,32)==1)
dbSetDisplayMode (800,600,32);
dbAutoCamOff();
dbSetAmbientLight(50);
dbSyncOn();
dbSyncRate(60);
dbHideMouse();
dbSetGlobalCollisionOff();
dbBackdropOn();
dbColorBackdrop(0);
dbRandomize(dbTimer());
dbLoadImage("textures\Teste\Earth1.dds", 1,1);
dbLoadImage("textures\Teste\Normal.tga",2,1);
dbLoadImage("FX\CrateSpecular.tga",3,2);
dbLoadImage("textures\MarsMap_2500x1250.jpg",4,1);
dbLoadImage("textures\starmap.jpg",5,1);
//Mars
dbLoadEffect("FX\NormalMap21.fx",1,0);
dbMakeObjectSphere(1,5,100,100);
dbTextureObject(1,0,1);
dbTextureObject(1,1,2);
dbTextureObject(1,2,3);
dbSetObjectFilter(1,2);
dbSetEffectTechnique(1,"NormalSpecular");
dbSetObjectEffect(1,1);
dbFadeObject(1,120);
//STARMAP
dbMakeObjectPlain(3,100.0f,100.0f);
dbTextureObject(3,5);
dbPositionObject(3,dbObjectPositionX(1),dbObjectPositionY(1),dbObjectPositionZ(1)-50);
dbFadeObject(3,200);
float zoom=dbObjectSize(1)*3.0f;
float cameraX=-45.0f;
int gamma = 255;
dbYRotateObject(1,-163.0f);
int difuse = 255;
int specular = 90;
int ambience = 0;
int emissive = 90;
int power = 20;
dbMakeVector4(1);
dbMakeVector4(2);
dbMakeVector4(3);
dbMakeObjectSphere(2,16.0,8,16);
dbPositionObject(2,80.0f,0.0f,5.0f);
dbHideObject(2);
dbColorObject(2,dbRGB(255,255,255));
dbSetVector4(1,dbObjectPositionX(2),dbObjectPositionY(2),dbObjectPositionZ(2),0.0f);
dbSetVector4(2,1.0,1.0,1.0,0.0002f);
dbSetEffectConstantVector(1,"Light1Pos",1);
dbSetEffectConstantVector(1,"Light1Col",2);
float light1=0.0f;
while (LoopGDK() )
{
char str[128];
sprintf(str,"FPS: %d Polygons: %d ",dbScreenFPS(),dbStatistic(1));
dbText(0,10,str);
dbPositionCamera(dbObjectPositionX(1),dbObjectPositionY(1),dbObjectPositionZ(1)+zoom);
dbPointCamera(0.0f,0.0f,0.0f);
dbSetVector4(1,dbSin(cameraX)*zoom +dbObjectPositionX(1),0.0f,dbCos(cameraX)*zoom+dbObjectPositionZ(1),0.0f);
dbSetEffectConstantVector(1,"Light1Pos",1);
dbPositionObject(2,dbXVector4(1),dbYVector4(1),dbZVector4(1));
if(dbLeftKey()==1)
cameraX+=.75f;
if(dbRightKey()==1)
cameraX-=.75f;
if(strcmp(dbInKey(),"w")==0)
zoom+=.25f;
if(strcmp(dbInKey(),"s")==0 && zoom > dbObjectSize(1))//*3.0f)
zoom-=.25f;
dbSetVector4(3,dbCameraPositionX(),dbCameraPositionY(),dbCameraPositionZ(),0.0f);
dbSetEffectConstantVector(1,"EyePos",3);
dbYRotateObject(1,dbWrapValue(dbObjectAngleY(1)+.2f));
dbSync();
}
}