AEM little bit of progress there.
paint directly on a 3D object by Van B.
// 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"
void plot_memimage(int mem,int x,int y,int col,int res);
void update_memimage(int mem,int img);
void create_memimage(int mem,int img,int wid,int hig);
// the main entry point for the application is this function
void DarkGDK ( void )
{
dbSyncOn();
dbBackdropOn();
dbAutoCamOff();
dbSetCameraRange(0.5, 30000);
dbRandomize(dbTimer());
int colour_res=512;
int terrain_res;
float colour_res1;
float terrain_res1;
//` movement
float g_fSpeed = 0.05;
float g_fTurn = 0.3;
create_memimage(1,1,colour_res,colour_res);
for( int x=0;x <= colour_res;x++)
{
for( int y=0;y <= colour_res;y++)
{
plot_memimage(1,x,y,dbRnd(255),colour_res);
}
}
terrain_res=256*3;
colour_res1=colour_res;
terrain_res1=terrain_res;
dbMakeObjectPlain(1,terrain_res,terrain_res);
dbTextureObject( 1,1);
dbRotateObject (1,270,0,0);
dbPositionObject( 1,terrain_res/2.0,0,terrain_res/2.0);
update_memimage(1,1);
//` position the camera
dbPositionCamera(385,23,100);
DWORD col=dbRgb(255,255,255);
int cy = 0;
int lastmb = 0;
int mb = 0, mx = 0, my = 0;
float mv = 0.0f;
int pick = 0;
float CameraAngleY = 0;
float CameraAngleX = 0;
while ( LoopGDK ( ) )
{
lastmb = mb;
mb=dbMouseClick();
mx=dbMouseX();
my=dbMouseY();
mv = dbUpKey()-dbDownKey();
dbMoveCamera( g_fSpeed*mv);
if (mb==1)
{
pick=dbPickObject(mx,my,1,1);
if (pick>0)
{
float curx=dbCameraPositionX()+dbGetPickVectorX();
float curz=dbCameraPositionZ()+dbGetPickVectorZ();
float px=(curx/terrain_res)*colour_res;
float py=(curz/terrain_res)*colour_res;
plot_memimage(1,px,py,dbRgb(255,255,0),colour_res);
if (dbRnd(10)==1)update_memimage(1,1);
}
}
if (mb==0 && lastmb==1) update_memimage(1,1);
if (mb==2)
{
//if (lastmb != 2) dbMouseMoveX() + dbMouseMoveY();
//` store old camera angle
float OldCamAngleY = CameraAngleY;
float OldCamAngleX = CameraAngleX;
//` store new camera angle
CameraAngleY = dbWrapValue ( CameraAngleY + dbMouseMoveX ( ) * 0.4 );
CameraAngleX = dbWrapValue ( CameraAngleX + dbMouseMoveY ( ) * 0.4 );
dbRotateCamera(dbCurveAngle ( CameraAngleX, OldCamAngleX, 24 ),dbCurveAngle ( CameraAngleY, OldCamAngleY, 24 ),0);
}
// Camera Y Angle
cy =dbCameraPositionY();
if (cy<3.0 ) cy=3.0;
dbPositionCamera(dbCameraPositionX(),cy,dbCameraPositionZ());
// update the screen
dbSync ( );
}
// return back to windows
return;
}
void create_memimage(int mem,int img,int wid,int hig)
{
int size=(wid*hig*4)+12;
if (dbMemblockExist(mem)==1){dbDeleteMemblock( mem);}
dbMakeMemblock(mem,size);
dbWriteMemblockDword( mem,0,wid);
dbWriteMemblockDword( mem,4,hig);
dbWriteMemblockDword( mem,8,32);
if (dbImageExist(img)==1) dbDeleteImage( img);
dbMakeImageFromMemblock( img,mem);
}
void plot_memimage(int mem,int x,int y,int col,int res)
{
x=res-x;
if (dbMemblockExist(mem)==0)return;
if (x<0 || y<0) return;
if (x>=res || y>=res) return;
int pos=12+((x+(y*res))*4);
dbWriteMemblockByte( mem,pos+0,dbRgbB(col));
dbWriteMemblockByte( mem,pos+1,dbRgbG(col));
dbWriteMemblockByte( mem,pos+2,dbRgbR(col));
dbWriteMemblockByte( mem,pos+3,0);
}
void update_memimage(int mem,int img)
{
if (dbMemblockExist(mem)==0) return;
if (dbImageExist(img) == 1) dbDeleteImage(img);
dbMakeImageFromMemblock( img,mem);
if (img==1)dbTextureObject( 1,1);
}
so now , that i can paint any clean RGB color i can transform it later on to a radom selected texture to attached to that color.
im thinking about 3 kind of textures on each color, meaning a simple grass can come in 3 forms i just hope that it will do the seamless ok , if not there is no way im using super high texutres cause then we will have a major fps drop considering we need
a few alpha blend textures for each terrain or segments and atleast one more for the normal map, if we want a specular we would need another.. at the end AEM wasnt as i planed , as it will still be extremly awesome using random created textures from stamps and even can randomize it again and again each time you enter the level so that could be awesome.
ok im taking a break for now , will continue later on.
matty whats up with Fulcrum ?
Tech whats going on with the computer ?
Hassan whats going on with the Mech animation?
p.s (edit)
here is the seamless code Van B gave me yesterday
// 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"
void repeat_paste(int i,int x,int y,int res);
// 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 );
int img=1;
dbLoadImage("leaf1.png",img); img++;
dbLoadImage("leaf2.png",img); img++;
dbLoadImage("leaf3.png",img); img++;
dbLoadImage("leaf4.png",img); img++;
dbLoadImage("leaf5.png",img); img++;
dbLoadImage("leaf6.png",img); img++;
dbLoadImage("leaf7.png",img); img++;
dbLoadImage("leaf8.png",img); img++;
dbLoadImage("leaf9.png",img); img++;
dbLoadImage("leaf10.png",img); img++;
img--;
int res=1024;
dbRandomize( dbTimer());
if (dbBitmapExist(1)==1) dbDeleteBitmap(1);
dbCreateBitmap(1,res,res);
for (int x=0;x <= res;x = x+16)
{
for (int y=0;y <= res;y = y+16)
{
repeat_paste(dbRnd(img-1)+1,x,y,res);
}
}
for (int n=0; n<= 2000;n++)
{
repeat_paste(dbRnd(img-1)+1,dbRnd(res),dbRnd(res),res);
}
dbGetImage(1000,0,0,1024,1024,1);
dbSetCurrentBitmap(0);
dbDeleteBitmap(1);
//`test loop
dbHideMouse();
dbMakeObjectPlain( 1,1000,1000);
dbTextureObject( 1,1000);
dbPositionCamera (0,0,-400);
dbSetObjectCull( 1,0);
dbSetObjectLight( 1,0);
dbScaleObjectTexture( 1,8.0,8.0);
// our main loop
while ( LoopGDK ( ) )
{
dbRotateCamera( dbMouseY(),dbMouseX(),0);
// update the screen
dbSync ( );
}
// return back to windows
return;
}
void repeat_paste(int i,int x,int y,int res)
{
dbPasteImage( i,x,y,1);
dbPasteImage(i,x-res,y,1);
dbPasteImage(i,x+res,y,1);
dbPasteImage(i,x,y-res,1);
dbPasteImage(i,x,y+res,1);
}
and image files attached.