(づ。◕‿‿◕。)づ

This commit is contained in:
SamGondelman 2019-05-16 18:31:45 -07:00
parent 283cc18269
commit 3eac2cf1d6
5 changed files with 15 additions and 7 deletions

View file

@ -21,7 +21,6 @@
#define GPU_TEXTURE_TRANSFORM_OBJECT 31 #define GPU_TEXTURE_TRANSFORM_OBJECT 31
#define GPU_RESOURCE_BUFFER_SLOT0_TEXTURE 35 #define GPU_RESOURCE_BUFFER_SLOT0_TEXTURE 35
#define GPU_RESOURCE_BUFFER_SLOT1_TEXTURE 36 #define GPU_RESOURCE_BUFFER_SLOT1_TEXTURE 36
#define GPU_RESOURCE_BUFFER_SLOT0_STORAGE 0 #define GPU_RESOURCE_BUFFER_SLOT0_STORAGE 0

View file

@ -430,7 +430,7 @@ void Procedural::setupUniforms() {
} }
_standardInputsBuffer->setSubData(0, _standardInputs); _standardInputsBuffer->setSubData(0, _standardInputs);
batch.setUniformBuffer(0, _standardInputsBuffer, 0, sizeof(StandardInputs)); batch.setUniformBuffer(procedural::slot::buffer::Inputs, _standardInputsBuffer, 0, sizeof(StandardInputs));
}); });
} }

View file

@ -24,7 +24,7 @@ LAYOUT(binding=PROCEDURAL_TEXTURE_CHANNEL3) uniform sampler2D iChannel3;
// comptability with existing procedural shaders that previously relied on these // comptability with existing procedural shaders that previously relied on these
// inputs as uniforms, not members of a UBO // inputs as uniforms, not members of a UBO
LAYOUT_STD140(binding=0) uniform standardInputsBuffer { LAYOUT_STD140(binding=PROCEDURAL_BUFFER_INPUTS) uniform standardInputsBuffer {
// Offset 0 // Offset 0
vec4 date; vec4 date;
// Offset 16, acts as vec4 for alignment purposes // Offset 16, acts as vec4 for alignment purposes

View file

@ -14,17 +14,24 @@
#ifndef PROCEDURAL_SHADER_CONSTANTS_H #ifndef PROCEDURAL_SHADER_CONSTANTS_H
#define PROCEDURAL_SHADER_CONSTANTS_H #define PROCEDURAL_SHADER_CONSTANTS_H
#define PROCEDURAL_BUFFER_INPUTS 7
#define PROCEDURAL_UNIFORM_CUSTOM 220 #define PROCEDURAL_UNIFORM_CUSTOM 220
#define PROCEDURAL_TEXTURE_CHANNEL0 0 #define PROCEDURAL_TEXTURE_CHANNEL0 2
#define PROCEDURAL_TEXTURE_CHANNEL1 1 #define PROCEDURAL_TEXTURE_CHANNEL1 3
#define PROCEDURAL_TEXTURE_CHANNEL2 2 #define PROCEDURAL_TEXTURE_CHANNEL2 4
#define PROCEDURAL_TEXTURE_CHANNEL3 3 #define PROCEDURAL_TEXTURE_CHANNEL3 5
// <! // <!
namespace procedural { namespace slot { namespace procedural { namespace slot {
namespace buffer {
enum Bufffer {
Inputs = PROCEDURAL_BUFFER_INPUTS,
};
}
namespace uniform { namespace uniform {
enum Uniform { enum Uniform {

View file

@ -174,6 +174,7 @@ void MeshPartPayload::render(RenderArgs* args) {
outColor = procedural->getColor(outColor); outColor = procedural->getColor(outColor);
procedural->prepare(batch, _drawTransform.getTranslation(), _drawTransform.getScale(), _drawTransform.getRotation(), 0, // FIXME: pass in _created procedural->prepare(batch, _drawTransform.getTranslation(), _drawTransform.getScale(), _drawTransform.getRotation(), 0, // FIXME: pass in _created
ProceduralProgramKey(outColor.a < 1.0f)); ProceduralProgramKey(outColor.a < 1.0f));
batch._glColor4f(outColor.r, outColor.g, outColor.b, outColor.a);
} else { } else {
// apply material properties // apply material properties
if (RenderPipelines::bindMaterials(_drawMaterials, batch, args->_renderMode, args->_enableTexturing)) { if (RenderPipelines::bindMaterials(_drawMaterials, batch, args->_renderMode, args->_enableTexturing)) {
@ -469,6 +470,7 @@ void ModelMeshPartPayload::render(RenderArgs* args) {
outColor = procedural->getColor(outColor); outColor = procedural->getColor(outColor);
procedural->prepare(batch, _drawTransform.getTranslation(), _drawTransform.getScale(), _drawTransform.getRotation(), 0,// FIXME: pass in _created procedural->prepare(batch, _drawTransform.getTranslation(), _drawTransform.getScale(), _drawTransform.getRotation(), 0,// FIXME: pass in _created
ProceduralProgramKey(outColor.a < 1.0f, _shapeKey.isDeformed(), _shapeKey.isDualQuatSkinned())); ProceduralProgramKey(outColor.a < 1.0f, _shapeKey.isDeformed(), _shapeKey.isDualQuatSkinned()));
batch._glColor4f(outColor.r, outColor.g, outColor.b, outColor.a);
} else { } else {
// apply material properties // apply material properties
if (RenderPipelines::bindMaterials(_drawMaterials, batch, args->_renderMode, args->_enableTexturing)) { if (RenderPipelines::bindMaterials(_drawMaterials, batch, args->_renderMode, args->_enableTexturing)) {