Fix issue #2: Update light matrix on rotation
This commit is contained in:
parent
03f20778eb
commit
e6560cc1d6
12
src/main.c
12
src/main.c
@ -36,8 +36,6 @@ u_long overlaySize = 0;
|
||||
#include "../levels/level0.h"
|
||||
#include "../levels/level1.h"
|
||||
|
||||
//FIXME : Refresh BGc, lightmatrix on ovly upload...
|
||||
|
||||
volatile u_char level = 0;
|
||||
// level 1 : 8003F05C -2147225508
|
||||
// level 0 : 800AF744 -2146764988
|
||||
@ -60,7 +58,10 @@ char db = 0; // Current buffer counter
|
||||
CVECTOR BGc = {128, 128, 128, 0}; // Default Far color - This can be set in each level.
|
||||
VECTOR BKc = {128, 128, 128, 0}; // Back color
|
||||
MATRIX rotlgt;
|
||||
MATRIX rotactor;
|
||||
SVECTOR lgtang = {0, 0, 0};
|
||||
SVECTOR invang = {0, 0, 0};
|
||||
SVECTOR actorang = {0, 0, 0};
|
||||
MATRIX light;
|
||||
short vs;
|
||||
CAMERA camera = {0};
|
||||
@ -561,7 +562,12 @@ int main() {
|
||||
}
|
||||
}
|
||||
// Find and apply light rotation matrix
|
||||
RotMatrix(&lgtang, &rotlgt);
|
||||
|
||||
// Update light rotation on actor
|
||||
// Find rotmat from actor angle
|
||||
RotMatrix_gte(&curLvl.actorPtr->rot, &rotactor);
|
||||
RotMatrix_gte(&lgtang, &rotlgt);
|
||||
MulMatrix0(&rotactor, &rotlgt, &rotlgt);
|
||||
MulMatrix0(curLvl.lgtmat, &rotlgt, &light);
|
||||
SetLightMatrix(&light);
|
||||
// Set camera
|
||||
|
@ -5,7 +5,7 @@ void setLightEnv(DRAWENV draw[2], CVECTOR * BGc, VECTOR * BKc, MATRIX * cmat){
|
||||
setRGB0(&draw[0], BGc->r, BGc->g, BGc->b);
|
||||
setRGB0(&draw[1], BGc->r, BGc->g, BGc->b);
|
||||
// Set Farcolor from here
|
||||
//~ SetFarColor( BGc->r, BGc->g, BGc->b );
|
||||
SetFarColor( BGc->r, BGc->g, BGc->b );
|
||||
// Set Ambient color
|
||||
SetBackColor( BKc->vx, BKc->vy, BKc->vz );
|
||||
// Set Light matrix
|
||||
@ -53,12 +53,7 @@ void init(DISPENV disp[2], DRAWENV draw[2], short db, MATRIX * cmat, CVECTOR * B
|
||||
FNT_SCR_BG,
|
||||
FNT_SCR_MAX_CHAR
|
||||
);
|
||||
// TODO : Move these to level files
|
||||
SetFarColor( 128, 128, 128 );
|
||||
//~ // Set Ambient color
|
||||
//~ SetBackColor( BKc->vx, BKc->vy, BKc->vz );
|
||||
//~ // Set Light matrix
|
||||
//~ SetColorMatrix(cmat);
|
||||
// TODO : Move this to level files
|
||||
SetFogNearFar( FOG_NEAR, FOG_FAR, SCREENXRES );
|
||||
};
|
||||
void ScrRst(void){
|
||||
|
Loading…
Reference in New Issue
Block a user