samples: correct image paths & include <math.h>

This commit is contained in:
T_chan 2022-01-31 16:59:05 +00:00
parent f5436fd31b
commit fdac490e34
13 changed files with 70 additions and 26 deletions

View File

@ -12,6 +12,9 @@
#ifdef __DREAMCAST__
extern uint8_t romdisk[];
KOS_INIT_ROMDISK(romdisk);
#define IMAGE_FILENAME "/rd/disk_1555.dtex"
#else
#define IMAGE_FILENAME "../samples/depth_funcs/alpha_testing/romdisk/disk_1555.dtex"
#endif
texture t;
@ -125,7 +128,7 @@ int main(int argc, char **argv)
InitGL(640, 480);
//loads a dtex texture. see the /romdisk folder for more files
dtex_to_gl_texture(&t, "/rd/disk_1555.dtex");
dtex_to_gl_texture(&t, IMAGE_FILENAME);
ReSizeGLScene(640, 480);
DrawGLScene();
while(1) {

View File

@ -2,6 +2,7 @@
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#ifdef __DREAMCAST__
#include <kos.h>
@ -14,6 +15,9 @@
#ifdef __DREAMCAST__
extern uint8 romdisk[];
KOS_INIT_ROMDISK(romdisk);
#define IMAGE_FILENAME "/rd/flag1.bmp"
#else
#define IMAGE_FILENAME "../samples/lerabot01/romdisk/flag1.bmp"
#endif
#include "../loadbmp.h"
@ -36,7 +40,7 @@ void LoadGLTextures() {
exit(0);
}
if (!ImageLoad("/rd/flag1.bmp", image1)) {
if (!ImageLoad(IMAGE_FILENAME, image1)) {
exit(1);
}

View File

@ -1,6 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <math.h>
#ifdef __DREAMCAST__
#include <kos.h>
@ -17,7 +18,7 @@ extern uint8_t romdisk[];
KOS_INIT_ROMDISK(romdisk);
#define IMAGE_FILENAME "/rd/NeHe.bmp"
#else
#define IMAGE_FILENAME "samples/lights/romdisk/NeHe.bmp"
#define IMAGE_FILENAME "../samples/lights/romdisk/NeHe.bmp"
#endif
#include "../loadbmp.h"

View File

@ -16,7 +16,7 @@ extern uint8_t romdisk[];
KOS_INIT_ROMDISK(romdisk);
#define IMAGE_FILENAME "/rd/NeHe.bmp"
#else
#define IMAGE_FILENAME "samples/mipmap/romdisk/NeHe.bmp"
#define IMAGE_FILENAME "../samples/mipmap/romdisk/NeHe.bmp"
#endif
#include "../loadbmp.h"

View File

@ -26,8 +26,8 @@ KOS_INIT_ROMDISK(romdisk);
#define IMAGE1_FILENAME "/rd/wp001vq.pvr"
#define IMAGE2_FILENAME "/rd/FlareWS_256.pvr"
#else
#define IMAGE1_FILENAME "samples/multitexture_arrays/romdisk/wp001vq.pvr"
#define IMAGE2_FILENAME "samples/multitexture_arrays/romdisk/FlareWS_256.pvr"
#define IMAGE1_FILENAME "../samples/multitexture_arrays/romdisk/wp001vq.pvr"
#define IMAGE2_FILENAME "../samples/multitexture_arrays/romdisk/FlareWS_256.pvr"
#endif
/* Load a PVR texture - located in pvr-texture.c */

View File

@ -13,11 +13,11 @@
#include "GL/glkos.h"
#ifdef __DREAMCAST__
#define IMAGE_FILENAME "/rd/NeHe.bmp"
extern uint8_t romdisk[];
KOS_INIT_ROMDISK(romdisk);
#define IMAGE_FILENAME "/rd/NeHe.bmp"
#else
#define IMAGE_FILENAME "samples/nehe06/romdisk/NeHe.bmp"
#define IMAGE_FILENAME "../samples/nehe06/romdisk/NeHe.bmp"
#endif
#include "../loadbmp.h"

View File

@ -12,11 +12,11 @@
#include "GL/glext.h"
#ifdef __DREAMCAST__
#define IMG_PATH "/rd/NeHe.tex"
extern uint8 romdisk[];
KOS_INIT_ROMDISK(romdisk);
#define IMG_PATH "/rd/NeHe.tex"
#else
#define IMG_PATH "samples/nehe06_4444twid/romdisk/NeHe.tex"
#define IMG_PATH "../samples/nehe06_4444twid/romdisk/NeHe.tex"
#endif
/* floats for x rotation, y rotation, z rotation */

View File

@ -13,6 +13,9 @@
#ifdef __DREAMCAST__
extern uint8 romdisk[];
KOS_INIT_ROMDISK(romdisk);
#define IMG_PATH "/rd/NeHe.tex"
#else
#define IMG_PATH "../samples/nehe06_vq/romdisk/NeHe.tex"
#endif
/* floats for x rotation, y rotation, z rotation */
@ -149,7 +152,7 @@ void LoadGLTextures() {
exit(0);
}
if (!ImageLoad("/rd/NeHe.tex", image1)) {
if (!ImageLoad(IMG_PATH, image1)) {
exit(1);
}

View File

@ -29,6 +29,9 @@
#ifdef __DREAMCAST__
extern uint8 romdisk[];
KOS_INIT_ROMDISK(romdisk);
#define IMG_PATH "/rd/glass.pvr"
#else
#define IMG_PATH "../samples/nehe08/romdisk/glass.pvr"
#endif
static GLfloat xrot; /* X Rotation */
@ -156,11 +159,11 @@ int main(int argc, char **argv) {
glEnable(GL_LIGHT0);
/* Set up the textures */
texture[0] = glTextureLoadPVR("/rd/glass.pvr", 0, 0);
texture[0] = glTextureLoadPVR(IMG_PATH, 0, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
texture[1] = glTextureLoadPVR("/rd/glass.pvr", 0, 0);
texture[1] = glTextureLoadPVR(IMG_PATH, 0, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

View File

@ -19,6 +19,17 @@ int32_t delaytime;
#ifdef __DREAMCAST__
extern uint8_t romdisk[];
KOS_INIT_ROMDISK(romdisk);
#define IMG_LOGO_PATH "/rd/logo.bmp"
#define IMG_MASK1_PATH "/rd/mask1.bmp"
#define IMG_IMAGE1_PATH "/rd/image1.bmp"
#define IMG_MASK2_PATH "/rd/mask2.bmp"
#define IMG_IMAGE2_PATH "/rd/image2.bmp"
#else
#define IMG_LOGO_PATH "../samples/nehe20/romdisk/logo.bmp"
#define IMG_MASK1_PATH "../samples/nehe20/romdisk/mask1.bmp"
#define IMG_IMAGE1_PATH "../samples/nehe20/romdisk/image1.bmp"
#define IMG_MASK2_PATH "../samples/nehe20/romdisk/mask2.bmp"
#define IMG_IMAGE2_PATH "../samples/nehe20/romdisk/image2.bmp"
#endif
#include "../loadbmp.h"
@ -75,11 +86,11 @@ int LoadGLTextures() // Load Bitmaps And Conv
Image TextureImage[5];
if ((ImageLoad("/rd/logo.bmp", &TextureImage[0])) && // Logo Texture
(ImageLoad("/rd/mask1.bmp", &TextureImage[1])) && // First Mask
(ImageLoad("/rd/image1.bmp", &TextureImage[2])) && // First Image
(ImageLoad("/rd/mask2.bmp", &TextureImage[3])) && // Second Mask
(ImageLoad("/rd/image2.bmp", &TextureImage[4]))) // Second Image
if ((ImageLoad(IMG_LOGO_PATH, &TextureImage[0])) && // Logo Texture
(ImageLoad(IMG_MASK1_PATH, &TextureImage[1])) && // First Mask
(ImageLoad(IMG_IMAGE1_PATH, &TextureImage[2])) && // First Image
(ImageLoad(IMG_MASK2_PATH, &TextureImage[3])) && // Second Mask
(ImageLoad(IMG_IMAGE2_PATH, &TextureImage[4]))) // Second Image
{
Status=TRUE; // Set The Status To TRUE
glGenTextures(5, &texture[0]); // Create Five Textures

View File

@ -15,6 +15,9 @@
#ifdef __DREAMCAST__
extern uint8_t romdisk[];
KOS_INIT_ROMDISK(romdisk);
#define IMG_PATH "/rd/NeHe.tex"
#else
#define IMG_PATH "../samples/paletted/romdisk/NeHe.tex"
#endif
/* floats for x rotation, y rotation, z rotation */
@ -113,7 +116,7 @@ void LoadGLTextures() {
exit(0);
}
if (!LoadPalettedTex("/rd/NeHe.tex", image1)) {
if (!LoadPalettedTex(IMG_PATH, image1)) {
exit(1);
}

View File

@ -17,6 +17,11 @@
#include <kos.h>
extern uint8 romdisk[];
KOS_INIT_ROMDISK(romdisk);
#define IMG_PATH "/rd/NeHe.pcx"
#define IMG_ALPHA_PATH "/rd/NeHe-Alpha.pcx"
#else
#define IMG_PATH "../samples/paletted_pcx/romdisk/NeHe.pcx"
#define IMG_ALPHA_PATH "../samples/paletted_pcx/romdisk/NeHe-Alpha.pcx"
#endif
/* floats for x rotation, y rotation, z rotation */
@ -140,11 +145,11 @@ void LoadGLTextures() {
// Load Texture
Image image1, image2;
if(!LoadPalettedPCX("/rd/NeHe.pcx", &image1)) {
if(!LoadPalettedPCX(IMG_PATH, &image1)) {
exit(1);
}
if(!LoadPalettedPCX("/rd/NeHe-Alpha.pcx", &image2)) {
if(!LoadPalettedPCX(IMG_ALPHA_PATH, &image2)) {
exit(1);
}

View File

@ -16,6 +16,17 @@
#include <kos.h>
extern uint8 romdisk[];
KOS_INIT_ROMDISK(romdisk);
#define IMG_FACADE00_PATH "/rd/facade00.tga"
#define IMG_FACADE01_PATH "/rd/facade01.tga"
#define IMG_FACADE02_PATH "/rd/facade02.tga"
#define IMG_FLOOR_PATH "/rd/floor.tga"
#define IMG_LIGHTMAP_PATH "/rd/lightmap.tga"
#else
#define IMG_FACADE00_PATH "../samples/zclip/romdisk/facade00.tga"
#define IMG_FACADE01_PATH "../samples/zclip/romdisk/facade01.tga"
#define IMG_FACADE02_PATH "../samples/zclip/romdisk/facade02.tga"
#define IMG_FLOOR_PATH "../samples/zclip/romdisk/floor.tga"
#define IMG_LIGHTMAP_PATH "../samples/zclip/romdisk/lightmap.tga"
#endif
/* Image type - contains height, width, and data */
@ -119,9 +130,9 @@ GLboolean LoadTGA(TextureImage *texture, const char *filename) // Loads A TGA
// Load Bitmaps And Convert To Textures
void LoadGLTextures() {
const char* filenames [] = {
"/rd/facade00.tga",
"/rd/facade01.tga",
"/rd/facade02.tga"
IMG_FACADE00_PATH,
IMG_FACADE01_PATH,
IMG_FACADE02_PATH
};
GLubyte i;
@ -129,11 +140,11 @@ void LoadGLTextures() {
LoadTGA(&textures[i], filenames[i]);
}
if(!LoadTGA(&road, "/rd/floor.tga")) {
if(!LoadTGA(&road, IMG_FLOOR_PATH)) {
fprintf(stderr, "Error loading road texture");
}
if(!LoadTGA(&lightmap, "/rd/lightmap.tga")) {
if(!LoadTGA(&lightmap, IMG_LIGHTMAP_PATH)) {
fprintf(stderr, "Error loading lightmap texture");
}
}