mirror of
https://github.com/overte-org/overte.git
synced 2025-06-20 21:00:06 +02:00
fix shader issue on mac
This commit is contained in:
parent
61ea59d63b
commit
1b69b38835
3 changed files with 23 additions and 23 deletions
|
@ -12,27 +12,27 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
<@include gpu/Transform.slh@>
|
<@include gpu/Transform.slh@>
|
||||||
|
|
||||||
<$declareStandardTransform()$>
|
<$declareStandardTransform()$>
|
||||||
|
|
||||||
varying vec2 varTexcoord;
|
varying vec2 varTexcoord;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
const vec4 UNIT_QUAD[4] = vec4[4](
|
const vec4 UNIT_QUAD[4] = vec4[4](
|
||||||
vec4(-1.0, -1.0, 0.0, 1.0),
|
vec4(-1.0, -1.0, 0.0, 1.0),
|
||||||
vec4(1.0, -1.0, 0.0, 1.0),
|
vec4(1.0, -1.0, 0.0, 1.0),
|
||||||
vec4(-1.0, 1.0, 0.0, 1.0),
|
vec4(-1.0, 1.0, 0.0, 1.0),
|
||||||
vec4(1.0, 1.0, 0.0, 1.0)
|
vec4(1.0, 1.0, 0.0, 1.0)
|
||||||
);
|
);
|
||||||
vec4 pos = UNIT_QUAD[gl_VertexID];
|
vec4 pos = UNIT_QUAD[gl_VertexID];
|
||||||
|
|
||||||
// standard transform but applied to the Texcoord
|
// standard transform but applied to the Texcoord
|
||||||
vec4 tc = vec4((pos.xy + 1) * 0.5, pos.zw);
|
vec4 tc = vec4((pos.xy + 1) * 0.5, pos.zw);
|
||||||
|
|
||||||
TransformObject obj = getTransformObject();
|
TransformObject obj = getTransformObject();
|
||||||
<$transformModelToWorldPos(obj, tc, tc)$>
|
<$transformModelToWorldPos(obj, tc, tc)$>
|
||||||
|
|
||||||
gl_Position = pos;
|
gl_Position = pos;
|
||||||
varTexcoord = tc.xy;
|
varTexcoord = tc.xy;
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@ uniform mat4 transformCamera_viewInverse;
|
||||||
<$worldPos$> = (<$objectTransform$>._model * <$modelPos$>);
|
<$worldPos$> = (<$objectTransform$>._model * <$modelPos$>);
|
||||||
}
|
}
|
||||||
<@else@>
|
<@else@>
|
||||||
<$worldPos$> = vec3(transformObject_model * <$modelPos$>);
|
<$worldPos$> = (transformObject_model * <$modelPos$>);
|
||||||
<@endif@>
|
<@endif@>
|
||||||
<@endfunc@>
|
<@endfunc@>
|
||||||
|
|
||||||
|
|
|
@ -644,12 +644,12 @@ void DeferredLightingEffect::render(RenderArgs* args) {
|
||||||
model.postRotate(spotRotation);
|
model.postRotate(spotRotation);
|
||||||
model.postTranslate(glm::vec3(0.0f, 0.0f, -light->getMaximumRadius() * (1.0f + SCALE_EXPANSION * 0.5f)));
|
model.postTranslate(glm::vec3(0.0f, 0.0f, -light->getMaximumRadius() * (1.0f + SCALE_EXPANSION * 0.5f)));
|
||||||
|
|
||||||
float base = expandedRadius * glm::tan(light->getSpotAngle());
|
float base = expandedRadius * glm::tan(light->getSpotAngle());
|
||||||
float height = expandedRadius;
|
float height = expandedRadius;
|
||||||
model.postScale(glm::vec3(base, base, height));
|
model.postScale(glm::vec3(base, base, height));
|
||||||
|
|
||||||
batch.setModelTransform(model);
|
batch.setModelTransform(model);
|
||||||
auto& mesh = getSpotLightMesh();
|
auto mesh = getSpotLightMesh();
|
||||||
|
|
||||||
|
|
||||||
batch.setIndexBuffer(mesh->getIndexBuffer());
|
batch.setIndexBuffer(mesh->getIndexBuffer());
|
||||||
|
@ -935,11 +935,11 @@ void DeferredLightingEffect::setGlobalSkybox(const model::SkyboxPointer& skybox)
|
||||||
}
|
}
|
||||||
|
|
||||||
model::MeshPointer DeferredLightingEffect::getSpotLightMesh() {
|
model::MeshPointer DeferredLightingEffect::getSpotLightMesh() {
|
||||||
if (!_spotLightMesh) {
|
if (!_spotLightMesh) {
|
||||||
_spotLightMesh.reset(new model::Mesh());
|
_spotLightMesh.reset(new model::Mesh());
|
||||||
|
|
||||||
int slices = 32;
|
int slices = 32;
|
||||||
int stacks = 1;
|
int stacks = 1;
|
||||||
int vertices = (stacks + 2) * slices;
|
int vertices = (stacks + 2) * slices;
|
||||||
int baseTriangles = slices - 2;
|
int baseTriangles = slices - 2;
|
||||||
int indices = 6 * slices * stacks + 3 * baseTriangles;
|
int indices = 6 * slices * stacks + 3 * baseTriangles;
|
||||||
|
|
Loading…
Reference in a new issue