Stuff I've fixed so far.

This commit is contained in:
2023-01-19 20:24:43 -08:00
parent e60002b8dc
commit 97fd59f28d
12 changed files with 72 additions and 43 deletions

View File

@ -78,7 +78,7 @@ void RenderPipeline::renderSceneCamera(Scene *scene, Camera *camera) {
// Create a new render ID. Long story short this is a really dirty way of
// not sending parameters to shaders more than we need.
this->renderId++;
this->renderId--;
// Get the list of things to render first.
std::vector<struct RenderPipelineItem> pipelineItems;
@ -106,6 +106,9 @@ void RenderPipeline::renderSceneCamera(Scene *scene, Camera *camera) {
item.mesh = mesh;
item.pass = *itPass;
// Validate the pass
assertNotNull(item.pass.shaderProgram);
// Do we need to get the W Vector?
if(item.pass.needsW) {
assertUnreachable();// TODO: Add distance from camera for W vector.
@ -169,13 +172,16 @@ void RenderPipeline::renderSceneCamera(Scene *scene, Camera *camera) {
// Bind the program.
if(boundProgram != item.pass.shaderProgram) {
boundProgram->bind();
boundProgram = item.pass.shaderProgram;
boundProgram->bind();
}
// Bind the textures to the slots
auto itTextureSlot = item.pass.textureSlots.begin();
while(itTextureSlot != item.pass.textureSlots.end()) {
// Assert texture isn't null, just don't include it.
assertNotNull(itTextureSlot->second);
if(boundTextures[itTextureSlot->first] != itTextureSlot->second) {
itTextureSlot->second->bind(itTextureSlot->first);
boundTextures[itTextureSlot->first] = itTextureSlot->second;

View File

@ -22,7 +22,7 @@ namespace Dawn {
class RenderPipeline {
private:
int_fast16_t renderId;
int_fast16_t renderId = -1;
public:
RenderManager *renderManager;

View File

@ -52,14 +52,6 @@ namespace Dawn {
*/
virtual RenderPipeline * getRenderPipeline() = 0;
/**
* Returns the default shader, the default shader will be applied to the
* materials first.
*
* @return Reference to the default shader.
*/
virtual Shader * getDefaultShader() = 0;
/**
* Returns the UI Shader used by the game's UI engine.
*

View File

@ -11,9 +11,9 @@ namespace Dawn {
class Material;
struct ShaderPass {
ShaderProgram *shaderProgram;
int32_t orderShader;
bool_t needsW;
ShaderProgram *shaderProgram = nullptr;
int32_t orderShader = 0;
bool_t needsW = false;
// Parameters
std::map<shaderparameter_t, struct Color> colorValues;
@ -29,7 +29,7 @@ namespace Dawn {
class Shader {
public:
int_fast16_t renderId;
int_fast16_t renderId = 0;
/**
* Compile all programs for this shader. This amy not remain forever as I