mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-09 15:30:41 +00:00
Reworks the $Core::commonShaderPath variable usage to be a static variable in ShaderGen for efficiency(only one getVariable when shadergen is initialized), as well as implements the ability to set a default value, and ensures that it tries to set a path even if the pref variable is missing which is important for ported projects from older builds.
This commit is contained in:
parent
3d7c1bbbf7
commit
7567ca10c3
17 changed files with 65 additions and 55 deletions
|
|
@ -46,6 +46,7 @@
|
|||
#include "gfx/gl/gfxGLStateCache.h"
|
||||
#include "gfx/gl/gfxGLVertexAttribLocation.h"
|
||||
#include "gfx/gl/gfxGLVertexDecl.h"
|
||||
#include "shaderGen/shaderGen.h"
|
||||
|
||||
GFXAdapter::CreateDeviceInstanceDelegate GFXGLDevice::mCreateDeviceInstance(GFXGLDevice::createInstance);
|
||||
|
||||
|
|
@ -781,8 +782,8 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
|
|||
ShaderData *shaderData;
|
||||
|
||||
shaderData = new ShaderData();
|
||||
shaderData->setField("OGLVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/colorV.glsl"));
|
||||
shaderData->setField("OGLPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/colorP.glsl"));
|
||||
shaderData->setField("OGLVertexShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/colorV.glsl"));
|
||||
shaderData->setField("OGLPixelShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/colorP.glsl"));
|
||||
shaderData->setField("pixVersion", "2.0");
|
||||
shaderData->registerObject();
|
||||
mGenericShader[GSColor] = shaderData->getShader();
|
||||
|
|
@ -791,8 +792,8 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
|
|||
Sim::getRootGroup()->addObject(shaderData);
|
||||
|
||||
shaderData = new ShaderData();
|
||||
shaderData->setField("OGLVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/modColorTextureV.glsl"));
|
||||
shaderData->setField("OGLPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/modColorTextureP.glsl"));
|
||||
shaderData->setField("OGLVertexShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/modColorTextureV.glsl"));
|
||||
shaderData->setField("OGLPixelShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/modColorTextureP.glsl"));
|
||||
shaderData->setSamplerName("$diffuseMap", 0);
|
||||
shaderData->setField("pixVersion", "2.0");
|
||||
shaderData->registerObject();
|
||||
|
|
@ -802,8 +803,8 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
|
|||
Sim::getRootGroup()->addObject(shaderData);
|
||||
|
||||
shaderData = new ShaderData();
|
||||
shaderData->setField("OGLVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/addColorTextureV.glsl"));
|
||||
shaderData->setField("OGLPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/addColorTextureP.glsl"));
|
||||
shaderData->setField("OGLVertexShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/addColorTextureV.glsl"));
|
||||
shaderData->setField("OGLPixelShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/addColorTextureP.glsl"));
|
||||
shaderData->setSamplerName("$diffuseMap", 0);
|
||||
shaderData->setField("pixVersion", "2.0");
|
||||
shaderData->registerObject();
|
||||
|
|
@ -813,8 +814,8 @@ void GFXGLDevice::setupGenericShaders( GenericShaderType type )
|
|||
Sim::getRootGroup()->addObject(shaderData);
|
||||
|
||||
shaderData = new ShaderData();
|
||||
shaderData->setField("OGLVertexShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/textureV.glsl"));
|
||||
shaderData->setField("OGLPixelShaderFile", String(Con::getVariable("$Core::CommonShaderPath")) + String("/fixedFunction/gl/textureP.glsl"));
|
||||
shaderData->setField("OGLVertexShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/textureV.glsl"));
|
||||
shaderData->setField("OGLPixelShaderFile", ShaderGen::smCommonShaderPath + String("/fixedFunction/gl/textureP.glsl"));
|
||||
shaderData->setSamplerName("$diffuseMap", 0);
|
||||
shaderData->setField("pixVersion", "2.0");
|
||||
shaderData->registerObject();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue