mirror of
https://github.com/overte-org/overte.git
synced 2025-04-16 23:26:25 +02:00
fix the color blending on Mac
This commit is contained in:
parent
e6bba04151
commit
449ca6df6d
2 changed files with 24 additions and 22 deletions
|
@ -53,7 +53,7 @@ void Skybox::render(gpu::Batch& batch, const ViewFrustum& viewFrustum, const Sky
|
|||
static gpu::BufferPointer theBuffer;
|
||||
static gpu::Stream::FormatPointer theFormat;
|
||||
static gpu::BufferPointer theConstants;
|
||||
const int SKYBOX_CONSTANTS_SLOT = 3;
|
||||
int SKYBOX_CONSTANTS_SLOT = 0; // need to be defined by the compilation of the shader
|
||||
if (!thePipeline) {
|
||||
auto skyVS = gpu::ShaderPointer(gpu::Shader::createVertex(std::string(Skybox_vert)));
|
||||
auto skyFS = gpu::ShaderPointer(gpu::Shader::createPixel(std::string(Skybox_frag)));
|
||||
|
@ -61,12 +61,15 @@ void Skybox::render(gpu::Batch& batch, const ViewFrustum& viewFrustum, const Sky
|
|||
|
||||
gpu::Shader::BindingSet bindings;
|
||||
bindings.insert(gpu::Shader::Binding(std::string("cubeMap"), 0));
|
||||
bindings.insert(gpu::Shader::Binding(std::string("skyboxBuffer"), SKYBOX_CONSTANTS_SLOT));
|
||||
|
||||
if (!gpu::Shader::makeProgram(*skyShader, bindings)) {
|
||||
|
||||
}
|
||||
|
||||
SKYBOX_CONSTANTS_SLOT = skyShader->getBuffers().findLocation("skyboxBuffer");
|
||||
if (SKYBOX_CONSTANTS_SLOT == gpu::Shader::INVALID_LOCATION) {
|
||||
SKYBOX_CONSTANTS_SLOT = skyShader->getUniforms().findLocation("skyboxBuffer");
|
||||
}
|
||||
|
||||
auto skyState = gpu::StatePointer(new gpu::State());
|
||||
|
||||
thePipeline = gpu::PipelinePointer(gpu::Pipeline::create(skyShader, skyState));
|
||||
|
|
|
@ -15,25 +15,24 @@
|
|||
|
||||
<$declareStandardTransform()$>
|
||||
|
||||
struct Skybox {
|
||||
vec4 _color;
|
||||
};
|
||||
|
||||
<@if GPU_FEATURE_PROFILE == GPU_CORE @>
|
||||
uniform skyboxBuffer {
|
||||
Skybox _skybox;
|
||||
};
|
||||
Skybox getSkybox() {
|
||||
return _skybox;
|
||||
}
|
||||
<@else@>
|
||||
uniform vec4 skyboxBuffer[1];
|
||||
Skybox getSkybox() {
|
||||
Skybox _skybox;
|
||||
_skybox._color = skyboxBuffer[0];
|
||||
|
||||
return _skybox;
|
||||
}
|
||||
struct Skybox {
|
||||
vec4 _color;
|
||||
};
|
||||
|
||||
<@if GPU_FEATURE_PROFILE == GPU_CORE @>
|
||||
uniform skyboxBuffer {
|
||||
Skybox _skybox;
|
||||
};
|
||||
Skybox getSkybox() {
|
||||
return _skybox;
|
||||
}
|
||||
<@else@>
|
||||
uniform vec4 skyboxBuffer[1];
|
||||
Skybox getSkybox() {
|
||||
Skybox _skybox;
|
||||
_skybox._color = skyboxBuffer[0];
|
||||
return _skybox;
|
||||
}
|
||||
<@endif@>
|
||||
|
||||
varying vec3 normal;
|
||||
|
|
Loading…
Reference in a new issue