#1 : Use separate FC and BG colors

This commit is contained in:
ABelliqueux 2021-07-03 11:57:06 +02:00
parent 93331f49fa
commit 800be60cb6
5 changed files with 8 additions and 6 deletions

View File

@ -5,6 +5,7 @@
#define CENTERX SCREENXRES/2
#define CENTERY SCREENYRES/2
#define FOV CENTERX
#define FOG_COLOR {128, 128, 128} // Default to neutral grey
#define CLEAR_COLOR_R 0
#define CLEAR_COLOR_G 0
#define CLEAR_COLOR_B 0

View File

@ -11,7 +11,7 @@
// PSX setup
void setLightEnv(DRAWENV draw[2], CVECTOR * BGc, VECTOR * BKc, MATRIX * cmat);
void init(DISPENV disp[2], DRAWENV draw[2], short db, MATRIX * cmat, CVECTOR * BG, VECTOR * BK );
void init(DISPENV disp[2], DRAWENV draw[2], short db, MATRIX * cmat, CVECTOR * BG, VECTOR * BK, VECTOR * FC );
void ScrRst(void);
void display(DISPENV * disp, DRAWENV * draw, u_long * otdisc, char * primbuff, char ** nextprim, char * db);

View File

@ -26,7 +26,7 @@ void transformMesh(CAMERA * camera, MESH * mesh){
void drawPoly(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpri, u_long * ot, char * db, DRAWENV * draw) {
long nclip, t = 0;
// mesh is POLY_GT3 ( triangle )
for (int i = 0; i < (mesh->totalVerts);) {
for (int i = 0; i < (mesh->totalVerts) && (mesh->totalVerts - i) > 2;) {
if (mesh->index[t].code == 4) {
t = drawTri(mesh, Flag, atime, camMode, nextpri, ot, db, draw, t, i);
i += 3;

View File

@ -54,8 +54,9 @@ int primcnt=0; // Primitive counter
char * nextpri = primbuff[0]; // Primitive counter
char db = 0; // Current buffer counter
// Lighting
CVECTOR BGc = {128, 128, 128, 0}; // Default Far color - This can be set in each level.
CVECTOR BGc = {128, 128, 128, 0}; // Default Far color - This can be set in each level.
VECTOR BKc = {128, 128, 128, 0}; // Back color
VECTOR FC = FOG_COLOR; // Far (Fog) color
SVECTOR lgtang = {0, 0, 0};
MATRIX rotlgt, light;
short vs;
@ -130,7 +131,7 @@ int main() {
}
levelWas = level;
// Init dislay, Gte..
init(disp, draw, db, curLvl.cmat, curLvl.BGc, curLvl.BKc);
init(disp, draw, db, curLvl.cmat, curLvl.BGc, curLvl.BKc, &FC);
// Init Pads
InitPAD(controllers[0].pad, 34, controllers[1].pad, 34);
StartPAD();

View File

@ -12,7 +12,7 @@ void setLightEnv(DRAWENV draw[2], CVECTOR * BGc, VECTOR * BKc, MATRIX * cmat){
SetColorMatrix(cmat);
};
void init(DISPENV disp[2], DRAWENV draw[2], short db, MATRIX * cmat, CVECTOR * BGc, VECTOR * BKc) {
void init(DISPENV disp[2], DRAWENV draw[2], short db, MATRIX * cmat, CVECTOR * BGc, VECTOR * BKc, VECTOR * FC) {
ResetCallback();
// Init pad
//~ PadInit(0);
@ -37,7 +37,6 @@ void init(DISPENV disp[2], DRAWENV draw[2], short db, MATRIX * cmat, CVECTOR * B
}
// Set Draw area color
setLightEnv(draw, BGc, BKc, cmat);
// Set Draw area clear flag
draw[0].isbg = 1;
draw[1].isbg = 1;
@ -53,6 +52,7 @@ void init(DISPENV disp[2], DRAWENV draw[2], short db, MATRIX * cmat, CVECTOR * B
FNT_SCR_BG,
FNT_SCR_MAX_CHAR
);
SetFarColor(FC->vx, FC->vy, FC->vz);
// TODO : Move this to level files
SetFogNearFar( FOG_NEAR, FOG_FAR, SCREENXRES );
};