Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[init]: Uploading working psp project, need to integrate mc.c
git-svn-id: https://euler.es/svn/aleiva/metaballs/trunk@1 e8494bbb-81f8-4217-a32d-3071ae8498ff
- Loading branch information
0 parents
commit 728f309
Showing
11 changed files
with
1,287 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
TARGET = metaballs | ||
OBJS = metaballs.o cube.o callbacks.o | ||
|
||
INCDIR = | ||
CFLAGS = -O2 -G0 -Wall | ||
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti | ||
ASFLAGS = $(CFLAGS) | ||
|
||
LIBDIR = | ||
LDFLAGS = | ||
LIBS = -lglut -lGLU -lGL -lm -lc -lpsputility -lpspdebug -lpspge -lpspdisplay -lpspctrl -lpspsdk -lpspvfpu -lpsplibc -lpspuser -lpspkernel -lpsprtc | ||
|
||
EXTRA_TARGETS = EBOOT.PBP | ||
PSP_EBOOT_TITLE = Metaballs [TsT] | ||
|
||
PSPSDK=$(shell psp-config --pspsdk-path) | ||
include $(PSPSDK)/lib/build.mak |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* PSP Software Development Kit - http://www.pspdev.org | ||
* ----------------------------------------------------------------------- | ||
* Licensed under the BSD license, see LICENSE in PSPSDK root for details. | ||
* | ||
* Copyright (c) 2005 Jesper Svennevid | ||
*/ | ||
|
||
#include <pspkernel.h> | ||
#include <pspdisplay.h> | ||
#include <pspdebug.h> | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include <math.h> | ||
#include <string.h> | ||
#include <time.h> | ||
|
||
PSP_MODULE_INFO("TEst", 0, 1, 1); | ||
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER); | ||
|
||
static int exitRequest = 0; | ||
|
||
int running() | ||
{ | ||
return !exitRequest; | ||
} | ||
|
||
int exitCallback(int arg1, int arg2, void *common) | ||
{ | ||
exitRequest = 1; | ||
return 0; | ||
} | ||
|
||
int callbackThread(SceSize args, void *argp) | ||
{ | ||
int cbid; | ||
|
||
cbid = sceKernelCreateCallback("Exit Callback", exitCallback, NULL); | ||
sceKernelRegisterExitCallback(cbid); | ||
|
||
sceKernelSleepThreadCB(); | ||
|
||
return 0; | ||
} | ||
|
||
int setupCallbacks(void) | ||
{ | ||
int thid = 0; | ||
|
||
thid = sceKernelCreateThread("update_thread", callbackThread, 0x11, 0xFA0, 0, 0); | ||
if(thid >= 0) | ||
{ | ||
sceKernelStartThread(thid, 0, 0); | ||
} | ||
|
||
return thid; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#ifndef common_callbacks_h | ||
#define common_callbacks_h | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
int running(); | ||
int setupCallbacks(void); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
cp EBOOT.PBP /cygdrive/h/PSP/GAME/hello/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
#include <GL/gl.h> | ||
#include <GL/glut.h> | ||
|
||
#include "cube.h" | ||
#include "mcdef.h" | ||
|
||
void initCube(cube* cube0) | ||
{ | ||
int i; | ||
|
||
for(i=0;i<8;i++) { | ||
cube0->vertexs[i].sel = FALSE; | ||
} | ||
|
||
cube0->vertexs[0].x = -POS; cube0->vertexs[0].y = -POS; cube0->vertexs[0].z = POS; | ||
cube0->vertexs[1].x = POS; cube0->vertexs[1].y = -POS; cube0->vertexs[1].z = POS; | ||
cube0->vertexs[2].x = POS; cube0->vertexs[2].y = -POS; cube0->vertexs[2].z = -POS; | ||
cube0->vertexs[3].x = -POS; cube0->vertexs[3].y = -POS; cube0->vertexs[3].z = -POS; | ||
cube0->vertexs[4].x = -POS; cube0->vertexs[4].y = POS; cube0->vertexs[4].z = POS; | ||
cube0->vertexs[5].x = POS; cube0->vertexs[5].y = POS; cube0->vertexs[5].z = POS; | ||
cube0->vertexs[6].x = POS; cube0->vertexs[6].y = POS; cube0->vertexs[6].z = -POS; | ||
cube0->vertexs[7].x = -POS; cube0->vertexs[7].y = POS; cube0->vertexs[7].z = -POS; | ||
|
||
cube0->edges[0].a = &cube0->vertexs[0]; cube0->edges[0].b = &cube0->vertexs[1]; | ||
cube0->edges[1].a = &cube0->vertexs[1]; cube0->edges[1].b = &cube0->vertexs[2]; | ||
cube0->edges[2].a = &cube0->vertexs[2]; cube0->edges[2].b = &cube0->vertexs[3]; | ||
cube0->edges[3].a = &cube0->vertexs[3]; cube0->edges[3].b = &cube0->vertexs[0]; | ||
cube0->edges[4].a = &cube0->vertexs[4]; cube0->edges[4].b = &cube0->vertexs[5]; | ||
cube0->edges[5].a = &cube0->vertexs[5]; cube0->edges[5].b = &cube0->vertexs[6]; | ||
cube0->edges[6].a = &cube0->vertexs[6]; cube0->edges[6].b = &cube0->vertexs[7]; | ||
cube0->edges[7].a = &cube0->vertexs[7]; cube0->edges[7].b = &cube0->vertexs[4]; | ||
cube0->edges[8].a = &cube0->vertexs[0]; cube0->edges[8].b = &cube0->vertexs[4]; | ||
cube0->edges[9].a = &cube0->vertexs[1]; cube0->edges[9].b = &cube0->vertexs[5]; | ||
cube0->edges[10].a = &cube0->vertexs[2]; cube0->edges[10].b = &cube0->vertexs[6]; | ||
cube0->edges[11].a = &cube0->vertexs[3]; cube0->edges[11].b = &cube0->vertexs[7]; | ||
|
||
} | ||
|
||
void printCube(cube cube0, unsigned char index) | ||
{ | ||
int i, j, k, e; | ||
|
||
|
||
//glPointSize( 1.0f ); | ||
//glDisable( GL_POINT_SMOOTH ); | ||
|
||
/* | ||
glBegin( GL_LINES ); | ||
for(i=0;i<12;i++) { | ||
if( cube0.edges[i].a->sel || cube0.edges[i].b->sel ) { | ||
glColor3f( 0.0f, 1.0f, 0.0f ); | ||
if(cube0.edges[i].a->sel) { | ||
glColor3f( 1.0f, 0.0f, 0.0f ); | ||
} | ||
glVertex3f( cube0.edges[i].a->x, cube0.edges[i].a->y, cube0.edges[i].a->z ); | ||
glColor3f( 0.0f, 1.0f, 0.0f ); | ||
if(cube0.edges[i].b->sel) | ||
glColor3f( 1.0f, 0.0f, 0.0f ); | ||
glVertex3f( cube0.edges[i].b->x, cube0.edges[i].b->y, cube0.edges[i].b->z ); | ||
} | ||
else { | ||
glColor3f( 0.0f, 1.0f, 0.0f ); | ||
glVertex3f( cube0.edges[i].a->x, cube0.edges[i].a->y, cube0.edges[i].a->z ); | ||
glVertex3f( cube0.edges[i].b->x, cube0.edges[i].b->y, cube0.edges[i].b->z ); | ||
} | ||
} | ||
glEnd(); | ||
*/ | ||
//glPointSize( 10.0f ); | ||
//glEnable( GL_POINT_SMOOTH ); | ||
|
||
glBegin( GL_POINTS ); | ||
|
||
for(i=0;i<8;i++) { | ||
if( cube0.vertexs[i].sel ) | ||
glColor3f( 1.0f, 0.0f, 0.0f ); | ||
else | ||
glColor3f( 0.0f, 1.0f, 0.0f ); | ||
glVertex3f( cube0.vertexs[i].x, cube0.vertexs[i].y, cube0.vertexs[i].z ); | ||
} | ||
|
||
glEnd(); | ||
|
||
glBegin( GL_TRIANGLES ); | ||
//glColor4f( 1.0f, 0.0f, 0.0f, 0.5f ); | ||
glColor3f( 0.5f, 0.0f, 0.0f ); | ||
|
||
|
||
for( e = 0; e < 4; e++ ) | ||
{ | ||
i = cube_table[index][(e*3)]; | ||
j = cube_table[index][(e*3)+1]; | ||
k = cube_table[index][(e*3)+2]; | ||
|
||
if( (i > -1) && (j > -1) && (k > -1) ) { | ||
glColor3f( 1.0f, 0.0f, 0.0f ); | ||
glVertex3f( (cube0.edges[i].a->x + cube0.edges[i].b->x) / 2, | ||
(cube0.edges[i].a->y + cube0.edges[i].b->y) / 2, | ||
(cube0.edges[i].a->z + cube0.edges[i].b->z) / 2 ); | ||
glColor3f( 0.0f, 1.0f, 0.0f ); | ||
glVertex3f( (cube0.edges[j].a->x + cube0.edges[j].b->x) / 2, | ||
(cube0.edges[j].a->y + cube0.edges[j].b->y) / 2, | ||
(cube0.edges[j].a->z + cube0.edges[j].b->z) / 2 ); | ||
glColor3f( 0.0f, 0.0f, 1.0f ); | ||
glVertex3f( (cube0.edges[k].a->x + cube0.edges[k].b->x) / 2, | ||
(cube0.edges[k].a->y + cube0.edges[k].b->y) / 2, | ||
(cube0.edges[k].a->z + cube0.edges[k].b->z) / 2 ); | ||
} | ||
} | ||
|
||
glEnd(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Header file for cube functions & structures. | ||
* | ||
* GlooB / TsT | ||
* | ||
* v 0.7beta | ||
* | ||
*/ | ||
|
||
/* Constants definitions for cube. | ||
*/ | ||
#define NUM_CUBE_PERMS 256 | ||
#define NUM_CUBE_VERTEX 8 | ||
#define NUM_CUBE_EDGES 12 | ||
#define NUM_CUBE_SAMPLES 15 | ||
#define NUM_CUBE_ROTS 24 | ||
|
||
#define TRUE 1 | ||
#define FALSE 0 | ||
|
||
#define POS 10 | ||
|
||
typedef struct { | ||
GLfloat x; | ||
GLfloat y; | ||
GLfloat z; | ||
GLboolean sel; | ||
} vertex; | ||
|
||
typedef struct { | ||
vertex* a; | ||
vertex* b; | ||
} edge; | ||
|
||
typedef struct { | ||
vertex vertexs[8]; | ||
edge edges[12]; | ||
} cube; | ||
|
||
|
||
void initCube(cube *c); | ||
void printCube(cube c, unsigned char i); | ||
|
Empty file.
Oops, something went wrong.