-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move Push/Pop Layer stuff to pl3DPipeline
This is what calls `Eval()` to make layer animations work, so that's now hooked up for plGLPipeline. I don't love this approach because it feels weird doing it in the shader class, and I suspect we need to know about layer overrides when the shader is being generated, but... for now it sorta works.
- Loading branch information
Showing
6 changed files
with
125 additions
and
97 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
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
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 |
---|---|---|
|
@@ -42,14 +42,14 @@ You can contact Cyan Worlds, Inc. by email [email protected] | |
|
||
#include "plGLMaterialShaderRef.h" | ||
#include "plGLDevice.h" | ||
#include "plGLPipeline.h" | ||
|
||
#include <epoxy/gl.h> | ||
|
||
#include "HeadSpin.h" | ||
#include "hsBitVector.h" | ||
|
||
#include "hsGMatState.inl" | ||
#include "plPipeline.h" | ||
#include "plPipeDebugFlags.h" | ||
|
||
#include "plDrawable/plGBufferGroup.h" | ||
|
@@ -230,7 +230,7 @@ void main() { | |
fragColor = vec4(currColor, currAlpha); | ||
})"; | ||
|
||
plGLMaterialShaderRef::plGLMaterialShaderRef(hsGMaterial* mat, plPipeline* pipe) | ||
plGLMaterialShaderRef::plGLMaterialShaderRef(hsGMaterial* mat, plGLPipeline* pipe) | ||
: plGLDeviceRef(), fMaterial(mat), fPipeline(pipe), fVertShaderRef(0), fFragShaderRef(0) | ||
{ | ||
ISetupShaderContexts(); | ||
|
@@ -274,16 +274,22 @@ void plGLMaterialShaderRef::SetupTextureRefs() | |
if (!layer) | ||
continue; | ||
|
||
layer = fPipeline->IPushOverAllLayer(layer); | ||
|
||
// Load the image | ||
plBitmap* img = plBitmap::ConvertNoRef(layer->GetTexture()); | ||
|
||
if (!img) | ||
if (!img) { | ||
layer = fPipeline->IPopOverAllLayer(layer); | ||
continue; | ||
} | ||
|
||
plGLTextureRef* texRef = static_cast<plGLTextureRef*>(img->GetDeviceRef()); | ||
|
||
if (!texRef->fRef) | ||
if (!texRef->fRef) { | ||
layer = fPipeline->IPopOverAllLayer(layer); | ||
continue; | ||
} | ||
|
||
fPipeline->CheckTextureRef(layer); | ||
|
||
|
@@ -325,6 +331,7 @@ void plGLMaterialShaderRef::SetupTextureRefs() | |
glUniform1i(this->uTexture[i], numTextures); | ||
LOG_GL_ERROR_CHECK("Uniform Texture failed") | ||
|
||
layer = fPipeline->IPopOverAllLayer(layer); | ||
numTextures++; | ||
} | ||
} | ||
|
@@ -580,12 +587,12 @@ uint32_t plGLMaterialShaderRef::IHandleMaterial(uint32_t layer, std::shared_ptr< | |
|
||
// Ignoring the bit about self-rendering cube maps | ||
|
||
plLayerInterface* currLay = /*IPushOverBaseLayer*/ fMaterial->GetLayer(layer); | ||
plLayerInterface* currLay = fPipeline->IPushOverBaseLayer(fMaterial->GetLayer(layer)); | ||
|
||
if (fPipeline->IsDebugFlagSet(plPipeDbg::kFlagBumpW) && (currLay->GetMiscFlags() & hsGMatState::kMiscBumpDu)) | ||
currLay = fMaterial->GetLayer(++layer); | ||
|
||
//currLay = IPushOverAllLayer(currLay); | ||
currLay = fPipeline->IPushOverAllLayer(currLay); | ||
|
||
hsGMatState state = ICompositeLayerState(currLay); | ||
|
||
|
@@ -627,6 +634,9 @@ uint32_t plGLMaterialShaderRef::IHandleMaterial(uint32_t layer, std::shared_ptr< | |
//ISetBumpMatrices(currLay); | ||
} | ||
|
||
currLay = fPipeline->IPopOverAllLayer(currLay); | ||
currLay = fPipeline->IPopOverBaseLayer(currLay); | ||
|
||
std::shared_ptr<plVaryingNode> vVtxColor = IFindVariable<plVaryingNode>("vVtxColor", "vec4"); | ||
|
||
std::shared_ptr<plTempVariableNode> fBaseAlpha = std::make_shared<plTempVariableNode>("baseAlpha", "float"); | ||
|
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 |
---|---|---|
|
@@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email [email protected] | |
#include "hsGMatState.h" | ||
|
||
class hsGMaterial; | ||
class plPipeline; | ||
class plGLPipeline; | ||
class plLayerInterface; | ||
|
||
enum plGLShaderConstants : GLuint { | ||
|
@@ -100,7 +100,7 @@ class plGLMaterialShaderRef : public plGLDeviceRef | |
|
||
protected: | ||
hsGMaterial* fMaterial; | ||
plPipeline* fPipeline; | ||
plGLPipeline* fPipeline; | ||
GLuint fVertShaderRef; | ||
GLuint fFragShaderRef; | ||
|
||
|
@@ -142,7 +142,7 @@ class plGLMaterialShaderRef : public plGLDeviceRef | |
void Link(plGLMaterialShaderRef** back) { plGLDeviceRef::Link((plGLDeviceRef**)back); } | ||
plGLMaterialShaderRef* GetNext() { return (plGLMaterialShaderRef*)fNext; } | ||
|
||
plGLMaterialShaderRef(hsGMaterial* mat, plPipeline* pipe); | ||
plGLMaterialShaderRef(hsGMaterial* mat, plGLPipeline* pipe); | ||
virtual ~plGLMaterialShaderRef(); | ||
|
||
void Release(); | ||
|
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
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