forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Terrain rendering

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Grover



Joined: 23 Feb 2005
Posts: 50

PostPosted: Mon May 16, 2005 2:59 pm    Post subject: Terrain rendering Reply with quote

This is my first effort on PSP .. and after 10 hrs.. I must say this little device is damn sweet.



Im using alot of nems gear, and will post all the source with some minor additions (like a sin/cos and few other bits). Also I have made a simple windows output too - so you can test on windows before making an EBOOT.PBP. Will post this in the next day or so, once I have clean it up a bit :-)

Heres the EBOOT.PBP.. controls are actually on the triangle, cross, square and circle, for forwards, back, left and right. Cheers..

http://users.on.net/~dlannan//Files/PSP/Terrain.zip
_________________
Bye.
Back to top
View user's profile Send private message
ace11



Joined: 12 May 2005
Posts: 3

PostPosted: Mon May 16, 2005 3:10 pm    Post subject: Re: Terrain rendering Reply with quote

WoW! Great work!
Back to top
View user's profile Send private message Send e-mail
Thanhda



Joined: 09 Apr 2005
Posts: 331
Location: Canada

PostPosted: Mon May 16, 2005 3:20 pm    Post subject: Reply with quote

nice work, too bad dont have psp1.0. too bad doesnt work on pspe
_________________
There are 10 types of people in the world: Those who understand binary, and those who don't...


Last edited by Thanhda on Mon May 16, 2005 3:32 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Grover



Joined: 23 Feb 2005
Posts: 50

PostPosted: Mon May 16, 2005 3:32 pm    Post subject: Reply with quote

Heres the source.. it wasnt _that_ bad :-) ..

Also I must send thanks to Nem and the original writer of glvox.. Andrea. Theres alot of their code that did this.. I just tied it together :-) .. Also in the TerrainSrc.zip I have included a simple image convertor. Converts almost any standard windows image type to unsigned short data array.. (JPGs, PNG, BMP, TGA.. etc etc).
Usage: ConvImage <image file> <target name>
Target name gets attached to the word Data. So then you can ref the image in your code easily.

Also included in the source, for people who want to do some dev (with Nems PG lib only!!) you can run the code on windows and see it runnning without a V1.0 PSP. Its just a simple blit .. but useful for quick dev. I expect most of Nems other source should work with this.. once the sce functions are complete - let those with V1.5 out there do some sort of dev too..

http://users.on.net/~dlannan//Files/PSP/TerrainSrc.zip

I havent filled out many sce functions yet.. but should have most done in a day or so, including audio and threads..
_________________
Bye.
Back to top
View user's profile Send private message
Drakonite
Site Admin


Joined: 17 Jan 2004
Posts: 989

PostPosted: Tue May 17, 2005 1:16 am    Post subject: Reply with quote

Screenshot looks nifty but please keep release announcements in the general forum. Thanks.
_________________
Shoot Pixels Not People!
Makeshift Development
Back to top
View user's profile Send private message Visit poster's website
Grover



Joined: 23 Feb 2005
Posts: 50

PostPosted: Tue May 17, 2005 1:35 am    Post subject: Reply with quote

Soz Drakonite - I never look at general discussions cos I thought it perm locked :-) .. good to see it back! :-)

BTW the sources has an emul of sorts to play with too - so people without v1.0 PSPs can dev.. and see what ppl are making.
_________________
Bye.


Last edited by Grover on Wed May 18, 2005 2:41 am; edited 1 time in total
Back to top
View user's profile Send private message
Shito



Joined: 11 May 2005
Posts: 21

PostPosted: Tue May 17, 2005 1:35 am    Post subject: Reply with quote

Well, the guy also posted the sources after all.
And with an image convertor that could be quite handy to anyone wanting to code a little bit. Ok by now we all have developped our own ways of converting a bitmap or whatever image into a c file for the weird BGR PSP format, but I sure know mine is not as handy as this simple exe, and I'll be giving it a try as soon as I get home.

So I vote let him live. :)
Back to top
View user's profile Send private message
Grover



Joined: 23 Feb 2005
Posts: 50

PostPosted: Wed May 18, 2005 12:17 am    Post subject: Reply with quote

I found lots of bugs in ImageConv.. sorry to those who tried it. I really dont know how I got any usable data!!! Anyhow.. its all fixed now, and I am providing the source so you can see how simple it actually is to do :-)
http://users.on.net/~dlannan//Files/PSP/ConvImage16.zip

Also I have fixed a fair bit in the Windows emul part of the code, along with the BGR thing. It may run a bit slow depending on your processor. Also fixed up alot of very silly coding errors..
http://users.on.net/~dlannan//Files/PSP/TerrainSrc2.zip

Finally heres a screeny of the Windows PC Emul.. and it actaully looks like this on PSP now :-)


And on PSP..


hopefully game demo following soon.. :-)

Also, those who build the terrain source will need to add a sky map.. at the moment it doesnt move.. but anything > 480x150 would work fine.

Cheers..
_________________
Bye.
Back to top
View user's profile Send private message
annerajb



Joined: 31 Mar 2005
Posts: 40

PostPosted: Wed May 18, 2005 8:35 am    Post subject: Reply with quote

i have to make the sky.c but how do i do it
and how can i add custom heightmaps what tool do i need?
Back to top
View user's profile Send private message MSN Messenger
Grover



Joined: 23 Feb 2005
Posts: 50

PostPosted: Wed May 18, 2005 11:25 am    Post subject: Reply with quote

hi. to make a sky.c use:
ConvImage <image name> Sky
there should be a working ConvImage.exe in the Src zip.

As for heightfiled, it currently uses a simple perlin noise function to build it:
ComputeMap() does this.
To place your own heightmap, simply dont call ComputeMap(). And set the array HMap to a list of height values (0->255).

Many things can be modified to change the way the height map is made/used. And at the moment the height map is a 256x256 map, this also is easily modified.
_________________
Bye.
Back to top
View user's profile Send private message
annerajb



Joined: 31 Mar 2005
Posts: 40

PostPosted: Wed May 18, 2005 11:43 am    Post subject: Reply with quote

if it isn to much trouble to you grover could you edit for me the glvox.c
computemap and change it so the terrain is all flat.
and how can i change the camera angles so it aims higher or lower.
thx for your help
Back to top
View user's profile Send private message MSN Messenger
Grover



Joined: 23 Feb 2005
Posts: 50

PostPosted: Wed May 18, 2005 12:12 pm    Post subject: Reply with quote

Replace your xmain in glvox with this.
Also make a RED 256x256 pixel height map. Convert it with ConvImage using this:
ConvImage16.exe <your red image> HeightMap

Full red represents highest point, black represents lowest.. and shade in between.. is.. erm.. inbetween :-)


Also at the top of the glvox file add the line:
Code:

#include "HeightMap.c"


The following is the xmain replacement.

Code:

// *******************************************************************

int xmain( void )
{
   static char flipper = 1;
   int x, y;
    //
    // Main loop
    //
    //   a     = angle
    //   x0,y0 = current position
    //   s     = speed constant
    //   ss    = current forward/backward speed
    //   sa    = angular speed
    //
    gl_a=0;
   gl_x0=0x0;
   gl_y0=0x0;
    gl_s=4096;
    gl_ss=100.0f;
    gl_sa=0;

    //
    // Compute the height map
    //

   // Uncomment this to have a perlin noise generated heightmap
//   ComputeMap();

   // Copy in a heightmap into the HMap array
   for(y=0; y<256; y++)
   {
      for(x=0; x<256; x++)
      {
         HMap[x + y * 256] = HeightMapData[x + y * 256];
      }
   }
   calc_light(0,0,255,255);

   pgcPuts("Loading...");
   
   while(app_running)
   {
      Video = pgGetVramAddr(0,0);
      pgScreenFrame(2,flipper);

//      pgcCls();
      // Rather than a screen clear, render half of the screen as a background
      pgBitBlt(0, 0, 1694, 150, 1, SkyData, 1);

      flipper = 1-flipper;
      glvox_main();
      input_key();
      pgScreenFlipV();
   }

   pgScreenFrame(1,0);
   pgcCls();

   return 0;
}

// *******************************************************************


_________________
Bye.
Back to top
View user's profile Send private message
annerajb



Joined: 31 Mar 2005
Posts: 40

PostPosted: Thu May 19, 2005 12:50 am    Post subject: Reply with quote

thx now i am adding a menu screen but how can i make the the apps change from MenuInput (); to input_key();
right now what it does is continue running MenuInput ();
and does not run input_key()
Code:
// *******************************************************************
//
// This is a port of a classic old voxel terrain renderer. Andrea kindly
// released his code back in 2000 so here it is again but on PSP!!!
//
// The other person that needs thanking is Nem - your hello world, sound
// and pg lib made there way here, I hope thats ok? :-)
//
// The rest of it is written by Grover.. for anyone to use, and abuse.
// The windows rendering is incomplete and only a few sce functions have
// been emulated - its an ongoing thing, so it will get filled out in the
// next week or so...
//                        Grover - May 2005.
//                        dlannan@gagagames.com
//

// *******************************************************************
// Credits for Original Glvox writer -  Andrea "6502" Griffini, programmer
//                                             agriff@ix.netcom.com
//                                         http://vv.val.net/~agriffini
//
// *******************************************************************

#include "syscall.h"
#include "pg.h"
#include "_clib.h"

// *******************************************************************
// Not yet used.. yet..
#include "HeightMap.c"
#include "Sky.c"
//#include "Pause.c"
//#include "Water1.c"

// *******************************************************************

#ifdef WIN32
#include "win32_psp.h"
#endif

// *******************************************************************

#define PIXELSKIP      4

#define CLOCKS_PER_SEC   1000000

float FOV=3.141592654/4;   // half of the xy field of view

// *******************************************************************

#define BUFFER_WIDTH    ((512/PIXELSKIP)+1)
#define BUFFER_HEIGHT   271

// *******************************************************************
// These dont seem to hurt the ps2 compiler..

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

// *******************************************************************

typedef unsigned char byte;

#define MAP_W      256
#define MAP_H      256
#define MAP_MASK   0xFFFF

// *******************************************************************

unsigned char app_running = 1;

//unsigned short *HMap = (unsigned short *)Water1Data;                  // Height field

unsigned char HMap[MAP_W*MAP_H];                  // Color map
unsigned char CMap[MAP_W*MAP_H];                  // Color map
unsigned char LMap[MAP_W*MAP_H];

unsigned short *Video;
// unsigned char Video[BUFFER_WIDTH * BUFFER_HEIGHT];      // Off-screen buffer

static float gl_ss, gl_sa, gl_a, gl_s;
static int gl_x0, gl_y0;

// *******************************************************************
//
// Reduces a value to 0..255 (used in height field computation)
//
int Clamp(int x)
{
  return (x<0 ? 0 : (x>255 ? 255 : x));
}

// *******************************************************************

static void calc_light( int x1, int y1, int x2, int y2 )
{
  int i, j, k, c, z ;
  int max=0;
  float norm;
  float t;

  for(z = 0; z < 256 * 256; z++)
     LMap[z] = 0;

//for( k = 2 ; k >= 1; k -- )
  for( c = 0 ; c < 2 ; c ++ )
  {
    for( i = y1 ; i <= y2 ; i ++ )
    {
      for( j = x1 ; j <= x2 ; j ++ )
      {
        int h00 = HMap[ ((i-1) * MAP_W + (j-1)) & MAP_MASK ];
        int h01 = HMap[ ((i-1) * MAP_W + (j+1)) & MAP_MASK ];
        int h10 = HMap[ ((i+1) * MAP_W + (j-1)) & MAP_MASK ];
        int h11 = HMap[ ((i+1) * MAP_W + (j+1)) & MAP_MASK ];
        int dx  = h11 - h00 ;
        int dy  = h10 - h01 ;
        int d   = dx * dx + dy * dy ;

        if( c == 0 )
        {
           if( max < d ) max = d;
        } else
        {
//           t = (float)sqrtu(d) * norm * 0.5f;
           t = (float)sqrtu(d) * norm;
//         t -= 2.0f;
         t *= 0.5f;
         // Some evil replacements until I find a solution for the gcc c.lt.s problem
           if( (*(unsigned int *)&t) & 0x80000000 ) t = 0.0f;
//           if( t < 0.0f ) t = 0.0f;
           if( ((int )t) > 255) t = 255.0f;
//           if( t > 255.0f ) t = 255.0f;
           LMap[ (i * MAP_W + j) & MAP_MASK ] = ((int)t);
           LMap[ (i * MAP_W + j) & MAP_MASK ] ^= 0xFF;
        }
      }
     norm = 512.0f / (float)sqrtu(max);
    }
  }
}

// *******************************************************************
//
// Heightfield and colormap computation
//
void MakeMap1(void)
{
  int x,y,p,i,j,k,k2,p2;

  //
  // Start from a plasma clouds fractal
  //
  for(y=0; y<256; y++)
   {
      for(x=0; x<256; x++)
      {
        HMap[x + y * 256] = HeightMapData1[x + y * 256];
      }
   }
  calc_light(0,0,255,255);// all terrain black if uncommented
  //
  // Color computation (derivative of the height field)
  //
  /*for ( i=0; i<256*256; i+=256 )
    for ( j=0; j<256; j++ )
    {
      k=128+(HMap[((i+256)&0xFF00)+((j+1)&255)]-HMap[i+j])*4;
      if ( k<0 ) k=0; if (k>255) k=255;
      CMap[i+j]=k;
    }
   
   calc_light(0,0,255,255);
  //
  // Smoothing
  //
    for ( i=0; i<256*256; i+=256 )
      for ( j=0; j<256; j++ )
      {
        HMap[i+j]=(HMap[((i+256)&0xFF00)+j]+HMap[i+((j+1)&0xFF)]+
                   HMap[((i-256)&0xFF00)+j]+HMap[i+((j-1)&0xFF)])>>2;
      }*/
}

// *******************************************************************

int lasty[BUFFER_WIDTH],         // Last pixel drawn on a given column
    lastc[BUFFER_WIDTH];         // Color of last pixel on a column
    lastx0[BUFFER_WIDTH];         // Color of last pixel on a column
    lasty0[BUFFER_WIDTH];         // Color of last pixel on a column
   lastl[BUFFER_WIDTH];

//
// Draw a "section" of the landscape; x0,y0 and x1,y1 and the xy coordinates
// on the height field, hy is the viewpoint height, s is the scaling factor
// for the distance. x0,y0,x1,y1 are 16.16 fixed point numbers and the
// scaling factor is a 16.8 fixed point value.
//
void Line(int x0,int y0,int x1,int y1,int hy,int s,int depth)
{
   int   state = 0;
  int i,sx,sy;
  int hys=hy*s;

  // Compute xy speed
  sx=(x1-x0)/BUFFER_WIDTH; sy=(y1-y0)/BUFFER_WIDTH;
  for ( i=0; i<BUFFER_WIDTH-PIXELSIZE; i++ )
  {
    int l,c,y,h,u0,v0,u1,v1,a,b,h0,h1,h2,h3;

    //
    // Compute the xy coordinates; a and b will be the position inside the
    // single map cell (0..255).
    //
    u0=(x0>>16)&0xFF;    a=(x0>>8)&255;
    v0=((y0>>8)&0xFF00); b=(y0>>8)&255;
    u1=(u0+1)&0xFF;
    v1=(v0+256)&0xFF00;

    //
    // Fetch the height at the four corners of the square the point is in
    //
    h0=HMap[u0+v0]; h2=HMap[u0+v1];
    h1=HMap[u1+v0]; h3=HMap[u1+v1];
    h0=(h0<<8)+a*(h1-h0);
    h2=(h2<<8)+a*(h3-h2);
    h= (h0<<8)+b*(h2-h0);

    //
    // Fetch the color at the four corners of the square the point is in
    //
    h0=LMap[u0+v0]; h2=LMap[u0+v1];
    h1=LMap[u1+v0]; h3=LMap[u1+v1];
    h0=(h0<<8)+a*(h1-h0);
    h2=(h2<<8)+a*(h3-h2);
    l=((h0<<8)+b*(h2-h0));


    //
    // Compute screen height using the scaling factor
    //
   y=(h/256.0f)*(s/256.0f);
   y-=hys;
   y>>=11;
   y+=BUFFER_HEIGHT/2;

    //
    // Draw the column
    //
    if ( y<(a=lasty[i]) && y > 0 )
    {
      int ubl= l;
      int lastubl= lastl[i];
      int lastlastubl = lastl[i-1];
      int ubstep;
      int sc,cc;

      int endy = BUFFER_HEIGHT;
      if(lasty[i]<BUFFER_HEIGHT)
         endy = lasty[i];
      ubstep = (((lastubl - ubl)) / (endy-y)) ;

      for(a = y; (a<lasty[i]) && (a < BUFFER_HEIGHT); a++)
      {
         unsigned short *Vptr = &Video[i*PIXELSKIP + a * 512];
         unsigned short Val = ((ubl & 0x7fffffff) >> 16);// & 0x001f | 0x0e0 | 0x7c00;
         Val = ((Val >> 3) & 0x1f) | (((Val >> 3) & 0x1f) << 10) | (((Val >> 3) & 0x1f) << 5);
         cc = PIXELSKIP;

         while(cc--)
            *Vptr++ = Val;
           
         ubl +=ubstep;
      }
      lasty[i]=y;
    }

   lastx0[i]=x0;
   lasty0[i]=y0;
    lastc[i]=c;
   lastl[i]=l;

    //
    // Advance to next xy position
    //
    x0+=sx; y0+=sy;
  }
}

// *******************************************************************
//
// Draw the view from the point x0,y0 (16.16) looking at angle a
//
void View(int x0,int y0,float aa)
{
  int d,p;
  int a,b,h,u0,v0,u1,v1,h0,h1,h2,h3;

  int p1, p2, p3, p4;

  for ( d=0; d<BUFFER_WIDTH; d++ )
  {
    lasty[d]=BUFFER_HEIGHT;
    lastc[d]=-1;
    lastx0[d]=0;
    lasty0[d]=0;
  }

  u0=(x0>>16)&0xFF;    a=(x0>>8)&255;
  v0=((y0>>8)&0xFF00); b=(y0>>8)&255;
  u1=(u0+1)&0xFF;
  v1=(v0+256)&0xFF00;

  h0=HMap[u0+v0]; h2=HMap[u0+v1];
  h1=HMap[u1+v0]; h3=HMap[u1+v1];
  h0=(h0<<8)+a*(h1-h0);
  h2=(h2<<8)+a*(h3-h2);
  h=((h0<<8)+b*(h2-h0))>>16;

  p=0;
  for ( d=0; d<500; d+=1+(d>>6))
  {

    p1 = (int)((float)x0+(float)d*65535.0f*fcos(aa-FOV)) ;//<< 16;
   p2 = (int)((float)y0+(float)d*65535.0f*fsin(aa-FOV)) ;//<< 16;
   p3 = (int)((float)x0+(float)d*65535.0f*fcos(aa+FOV)) ;//<< 16;
   p4 = (int)((float)y0+(float)d*65535.0f*fsin(aa+FOV)) ;//<< 16;
    Line(p1,p2,p3,p4,
         h-30,BUFFER_HEIGHT*128/(d+1),d );
  }
}

// *******************************************************************
void IngameMenuInput( void )//aqui van lo q hace cada booton en el menu ingame

   {
   static unsigned long pad,pad1,lastpad;
   pad1=pgiGetpad();
      
   if ((pad1&CTRL_START)!=0) {
      //;//   sesupone q corra makemap1
   }
   lastpad=pad;
}

// *******************************************************************
void InGameMenu( void )
   {
   pgcPuts("Pause");
   pgScreenFrame(1,0);
   //pgBitBlt(0, 0, 1694, 272, 1, Pause, 1);// Rather than a screen clear, render half of the screen as a background
   IngameMenuInput();
   pgScreenFrame(1,0);
   }
// *******************************************************************
void input_key( void )
{
   static unsigned long pad,pad1,lastpad;
   pad1=pgiGetpad();
      
   if ((pad1&CTRL_START)!=0) {//MENU
      gl_ss = 0;
      gl_sa = 0;
      InGameMenu;// pause screen
   }
   if ((pad1&CTRL_SELECT)!=0) {//jump now stop
      gl_ss = 0;
   }
   if ((pad1&CTRL_LEFT )!=0) {//left changed the CTRL_CIRCLE to CTRL_LEFT
      gl_sa += 0.005f;
   }
   if ((pad1&CTRL_RIGHT)!=0) {//right changed the CTRL_SQUARE to CTRL_RIGHT
      gl_sa -= 0.005f;
   }
   if ((pad1&CTRL_TRIANGLE)!=0) {
       gl_ss = gl_s;//up modified original should have +=
      
   }
   if ((pad1&CTRL_CROSS)!=0) {
      gl_ss -= gl_s;//problem if you remove -  dosnt stop
   }
   lastpad=pad;
}

// *******************************************************************


void Run( void )
   {
   
   pgScreenFrame(1,0);
   MakeMap1();
   pgBitBlt(0, 0, 1694, 150, 1, SkyData, 1);// Rather than a screen clear, render half of the screen as a background
      
   }
// *******************************************************************

void MenuInput( void )
   {
   static unsigned long pad,pad1,lastpad;
   pad1=pgiGetpad();
   
   if ((pad1&CTRL_CROSS)!=0) {
      
      pgcPuts("Running");
      Run();//   sesupone q corra makemap1
      
   }
   lastpad=pad;
   
}

// *******************************************************************
   

void glvox_main( void )
{
      View(gl_x0,gl_y0,gl_a);

      //
      // Update position/angle
      //
      gl_x0+=gl_ss*fcos(gl_a);
      gl_y0+=gl_ss*fsin(gl_a);
      gl_a+=gl_sa;
      gl_sa*=0.975f;
}

// *******************************************************************


int xmain( void )
{
   static char flipper = 1;
   
    //
    // Main loop
    //
    //   a     = angle
    //   x0,y0 = current position
    //   s     = speed constant
    //   ss    = current forward/backward speed
    //   sa    = angular speed
    //
    gl_a=0;
   gl_x0=0x0;
   gl_y0=0x0;
    gl_s=4096;
    gl_ss=100.0f;
    gl_sa=0;

    //
    // Compute the height map
   
   // Uncomment this to have a perlin noise generated heightmap
   

   // Copy in a heightmap into the HMap array
   
   

   
   
   while(app_running)
   {
      Video = pgGetVramAddr(0,0);
      pgScreenFrame(2,flipper);

      pgcCls();
      pgcPuts("Menu");
      MenuInput();//this are menu screen controls i have problems here how can i change the input from MenuInput (); to input_key();
      flipper = 1-flipper;
      glvox_main();
     
    
      pgScreenFlipV();
   }

   pgScreenFrame(1,0);
   pgcCls();

   return 0;
}

// *******************************************************************

Back to top
View user's profile Send private message MSN Messenger
skippy911



Joined: 06 May 2005
Posts: 46

PostPosted: Thu May 19, 2005 1:56 am    Post subject: Reply with quote

Grover can you post a binary of your emu I cant get it to compile :(
Back to top
View user's profile Send private message
Grover



Joined: 23 Feb 2005
Posts: 50

PostPosted: Thu May 19, 2005 5:00 am    Post subject: Reply with quote

No probs.. but erm.. it will be just my demo? Its basically a dev tool - so you really need to be able to build it to try your own apps.

Heres the PC exe:
http://users.on.net/~dlannan//Files/PSP/GLVOX.exe


The idea is that you can make your own demos without a PSP.. then when you get access to a V1.0 PSP.. you can build an EBOOT.PBP and run it without modifying your code. BTW close the command window to exit the app. I use the command line window for stdout.. and stderr.. very useful.

BTW there are a few 'known' bugs I have left in the Src.. this source is for everyone to use, but please dont expect me to write your game/demo for you :-)
_________________
Bye.
Back to top
View user's profile Send private message
skippy911



Joined: 06 May 2005
Posts: 46

PostPosted: Thu May 19, 2005 6:00 am    Post subject: Reply with quote

Maybe it is just my pc, windows xp japanese, but I cant get the exe to run :( Says it is not a vlid win32 application.
Back to top
View user's profile Send private message
Shito



Joined: 11 May 2005
Posts: 21

PostPosted: Thu May 19, 2005 6:03 am    Post subject: Reply with quote

Grover wrote:
I found lots of bugs in ImageConv.. sorry to those who tried it. I really dont know how I got any usable data!!! Anyhow.. its all fixed now, and I am providing the source so you can see how simple it actually is to do :-)
http://users.on.net/~dlannan//Files/PSP/ConvImage16.zip

Can't seem to compile this code, could you post the exe please ? ^^
Back to top
View user's profile Send private message
Thanhda



Joined: 09 Apr 2005
Posts: 331
Location: Canada

PostPosted: Thu May 19, 2005 6:45 am    Post subject: Reply with quote

Shito wrote:
Grover wrote:
I found lots of bugs in ImageConv.. sorry to those who tried it. I really dont know how I got any usable data!!! Anyhow.. its all fixed now, and I am providing the source so you can see how simple it actually is to do :-)
http://users.on.net/~dlannan//Files/PSP/ConvImage16.zip

Can't seem to compile this code, could you post the exe please ? ^^


it converts the sky image to a c file. the sky.c is not included. this program converts the image file to a c file.

you can also run the program without the sky, you just got to comment out 2 lines of code.
_________________
There are 10 types of people in the world: Those who understand binary, and those who don't...
Back to top
View user's profile Send private message Visit poster's website
Thanhda



Joined: 09 Apr 2005
Posts: 331
Location: Canada

PostPosted: Thu May 19, 2005 6:49 am    Post subject: Reply with quote

Grover wrote:
No probs.. but erm.. it will be just my demo? Its basically a dev tool - so you really need to be able to build it to try your own apps.

Heres the PC exe:
http://users.on.net/~dlannan//Files/PSP/GLVOX.exe


The idea is that you can make your own demos without a PSP.. then when you get access to a V1.0 PSP.. you can build an EBOOT.PBP and run it without modifying your code. BTW close the command window to exit the app. I use the command line window for stdout.. and stderr.. very useful.

BTW there are a few 'known' bugs I have left in the Src.. this source is for everyone to use, but please dont expect me to write your game/demo for you :-)


this is a definetly good idea. i myself have done this for the ps2. but remember to make sure that the code will work on both psp and pc, you have to make sure that the code can compile into both an exe and a pbp. for example. if you toss a DX call to the windows version, it may work, but will not work under psp.

to skippy911: to clear this out, Grover isnt running a emu. its just that he written 2 mains that run on both pc and the psp.

skippy911 wrote:
Maybe it is just my pc, windows xp japanese, but I cant get the exe to run :( Says it is not a vlid win32 application.


What code line is not exactly working?
if you want to run a quick test and too lazy to convert the sky file
comment the line

Code:

#include "Sky.c"

pgBitBlt(0, 0, 1694, 150, 1, SkyData, 1);


located in glvox.c

what ends up happening is that the sky is no longer there, and you may see some trails of the terrain because it does not refresh the sky.

this is what it should end up looking like

http://geocities.com/tsune_l/GLVOX.zip
_________________
There are 10 types of people in the world: Those who understand binary, and those who don't...
Back to top
View user's profile Send private message Visit poster's website
Shito



Joined: 11 May 2005
Posts: 21

PostPosted: Thu May 19, 2005 7:08 am    Post subject: Reply with quote

Thanhda wrote:
Shito wrote:
Grover wrote:
I found lots of bugs in ImageConv.. sorry to those who tried it. I really dont know how I got any usable data!!! Anyhow.. its all fixed now, and I am providing the source so you can see how simple it actually is to do :-)
http://users.on.net/~dlannan//Files/PSP/ConvImage16.zip

Can't seem to compile this code, could you post the exe please ? ^^

it converts the sky image to a c file. the sky.c is not included. this program converts the image file to a c file.
you can also run the program without the sky, you just got to comment out 2 lines of code.

Mmm, actually I was just asking for ConvImage.exe ^^
Back to top
View user's profile Send private message
Thanhda



Joined: 09 Apr 2005
Posts: 331
Location: Canada

PostPosted: Thu May 19, 2005 7:14 am    Post subject: Reply with quote

Shito wrote:
Thanhda wrote:
Shito wrote:
Grover wrote:
I found lots of bugs in ImageConv.. sorry to those who tried it. I really dont know how I got any usable data!!! Anyhow.. its all fixed now, and I am providing the source so you can see how simple it actually is to do :-)
http://users.on.net/~dlannan//Files/PSP/ConvImage16.zip

Can't seem to compile this code, could you post the exe please ? ^^

it converts the sky image to a c file. the sky.c is not included. this program converts the image file to a c file.
you can also run the program without the sky, you just got to comment out 2 lines of code.

Mmm, actually I was just asking for ConvImage.exe ^^


do you have visual studio?

if not i uploaded the binary at http://geocities.com/tsune_l/ConvImage16.zip
_________________
There are 10 types of people in the world: Those who understand binary, and those who don't...
Back to top
View user's profile Send private message Visit poster's website
Grover



Joined: 23 Feb 2005
Posts: 50

PostPosted: Thu May 19, 2005 8:33 am    Post subject: Reply with quote

Skippy - not your fault.. GLVOX.exe was corrupted on upload.. Reuploading now.. sorry about that.

Have a new one in a zip try this:
http://users.on.net/~dlannan//Files/PSP/GLVOX.zip

Turns out my host doesnt like exe's :-) .. thats why convimage16 probably is broken.. fixing now.. use this like to dl
http://users.on.net/~dlannan//Files/PSP/ConvImage16.zip

Sorry for all the trouble.. will have to remember that little gotcha.
_________________
Bye.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group