added setAmbientLight(), setWorldColor()
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include <draw_primitives.h>
|
||||
#include <math3d.h>
|
||||
#include <packet2.h>
|
||||
#include "./light.hpp"
|
||||
#include "../models/mesh.hpp"
|
||||
#include "../models/math/matrix.hpp"
|
||||
#include "../models/screen_settings.hpp"
|
||||
@@ -29,17 +30,18 @@ class GifSender
|
||||
{
|
||||
|
||||
public:
|
||||
GifSender(u32 t_packetSize, ScreenSettings *t_screen);
|
||||
GifSender(u32 t_packetSize, ScreenSettings *t_screen, Light *t_light);
|
||||
~GifSender();
|
||||
|
||||
void initPacket(u8 context);
|
||||
void addObject(RenderData *t_renderData, Mesh &t_mesh, u32 vertexCount, VECTOR *vertices, VECTOR *normals, VECTOR *coordinates, LightBulb *t_bulbs, u16 t_bulbsCount, texbuffer_t *textureBuffer);
|
||||
void addClear(zbuffer_t *t_zBuffer);
|
||||
void addClear(zbuffer_t *t_zBuffer, color_t *rgb);
|
||||
void sendPacket();
|
||||
void sendClear(zbuffer_t *t_zBuffer);
|
||||
void sendClear(zbuffer_t *t_zBuffer, color_t *rgb);
|
||||
static void sendTexture(Texture &texture, texbuffer_t *t_texBuffer);
|
||||
|
||||
private:
|
||||
Light *light;
|
||||
xyz_t *xyz;
|
||||
color_t *rgbaq;
|
||||
texel_t *st;
|
||||
|
||||
@@ -23,10 +23,14 @@ public:
|
||||
Light();
|
||||
~Light();
|
||||
|
||||
static u16 getLightsCount(u32 t_bulbsCount);
|
||||
static void calculateLight(VECTOR *t_lightDirections, VECTOR *t_lightColors, int *t_lightTypes, LightBulb *t_bulbs, u32 t_lightsCount, Vector3 t_objPosition);
|
||||
u16 getLightsCount(u32 t_bulbsCount);
|
||||
|
||||
/** Values from 0.0000F to 1.0000F */
|
||||
void setAmbientLight(const Vector3 &t_rgb);
|
||||
void calculateLight(VECTOR *t_lightDirections, VECTOR *t_lightColors, int *t_lightTypes, LightBulb *t_bulbs, u32 t_lightsCount, Vector3 t_objPosition);
|
||||
|
||||
private:
|
||||
Vector3 ambientLight;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <packet2.h>
|
||||
#include "gif_sender.hpp"
|
||||
#include "vif_sender.hpp"
|
||||
#include "light.hpp"
|
||||
#include "../models/math/plane.hpp"
|
||||
#include "../models/sprite.hpp"
|
||||
#include "../models/screen_settings.hpp"
|
||||
@@ -102,11 +103,19 @@ public:
|
||||
|
||||
void setCameraDefinitions(Matrix *t_worldView, Vector3 *t_cameraPos, Plane *t_planes);
|
||||
|
||||
void setWorldColor(const color_t &t_rgb);
|
||||
|
||||
void endFrame(float fps);
|
||||
|
||||
TextureRepository *getTextureRepository() { return &textureRepo; };
|
||||
void setAmbientLight(const Vector3 &t_rgb) { light.setAmbientLight(t_rgb); }
|
||||
|
||||
TextureRepository *getTextureRepository()
|
||||
{
|
||||
return &textureRepo;
|
||||
};
|
||||
|
||||
private:
|
||||
// We have some GCC bug here. Just try to reorder declarations. For example move worldColor up - game will crash.
|
||||
void changeTexture(Texture *t_tex);
|
||||
u32 lastTextureId;
|
||||
texbuffer_t textureBuffer;
|
||||
@@ -117,12 +126,14 @@ private:
|
||||
void beginFrameIfNeeded();
|
||||
u8 isFrameEmpty;
|
||||
Matrix perspective;
|
||||
Light light;
|
||||
RenderData renderData;
|
||||
TextureRepository textureRepo;
|
||||
ScreenSettings *screen;
|
||||
GifSender *gifSender;
|
||||
VifSender *vifSender;
|
||||
packet2_t *flipPacket;
|
||||
color_t worldColor;
|
||||
void allocateBuffers(float t_screenW, float t_screenH);
|
||||
void initDrawingEnv(float t_screenW, float t_screenH);
|
||||
void setPrim();
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <tamtypes.h>
|
||||
#include <packet2_utils.h>
|
||||
#include "../models/render_data.hpp"
|
||||
#include "./light.hpp"
|
||||
#include "../models/light_bulb.hpp"
|
||||
#include "../models/mesh.hpp"
|
||||
#include "../models/math/matrix.hpp"
|
||||
@@ -24,7 +25,7 @@ class VifSender
|
||||
{
|
||||
|
||||
public:
|
||||
VifSender();
|
||||
VifSender(Light *t_light);
|
||||
~VifSender();
|
||||
|
||||
// TODO refactor
|
||||
@@ -32,6 +33,7 @@ public:
|
||||
void sendMatrices(const RenderData &t_renderData, const Vector3 &t_position, const Vector3 &t_rotation);
|
||||
|
||||
private:
|
||||
Light *light;
|
||||
void uploadMicroProgram();
|
||||
void setDoubleBuffer();
|
||||
void drawVertices(Mesh &t_mesh, u32 t_start, u32 t_end, VECTOR *t_vertices, VECTOR *t_coordinates, prim_t *t_prim, texbuffer_t *textureBuffer);
|
||||
|
||||
Reference in New Issue
Block a user