mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 22:51:20 +02:00
Several experimetations without success
This commit is contained in:
parent
139ba1b71c
commit
6a08c74463
7 changed files with 68 additions and 41 deletions
|
@ -26,7 +26,7 @@
|
||||||
#include "SoundCache.h"
|
#include "SoundCache.h"
|
||||||
#include "AudioSRC.h"
|
#include "AudioSRC.h"
|
||||||
|
|
||||||
int audioInjectorPtrMetaTypeId = qRegisterMetaType<AudioInjector*>();
|
//int audioInjectorPtrMetaTypeId = qRegisterMetaType<AudioInjector*>();
|
||||||
|
|
||||||
AudioInjectorState operator& (AudioInjectorState lhs, AudioInjectorState rhs) {
|
AudioInjectorState operator& (AudioInjectorState lhs, AudioInjectorState rhs) {
|
||||||
return static_cast<AudioInjectorState>(static_cast<uint8_t>(lhs) & static_cast<uint8_t>(rhs));
|
return static_cast<AudioInjectorState>(static_cast<uint8_t>(lhs) & static_cast<uint8_t>(rhs));
|
||||||
|
|
|
@ -213,13 +213,13 @@ void GLBackend::do_setStateStencil(State::StencilActivation activation, State::S
|
||||||
GL_DECR };
|
GL_DECR };
|
||||||
|
|
||||||
if (testFront != testBack) {
|
if (testFront != testBack) {
|
||||||
glStencilOpSeparate(GL_FRONT, STENCIL_OPS[testFront.getFailOp()], STENCIL_OPS[testFront.getPassOp()], STENCIL_OPS[testFront.getDepthFailOp()]);
|
glStencilOpSeparate(GL_FRONT, STENCIL_OPS[testFront.getFailOp()], STENCIL_OPS[testFront.getDepthFailOp()], STENCIL_OPS[testFront.getPassOp()]);
|
||||||
glStencilFuncSeparate(GL_FRONT, COMPARISON_TO_GL[testFront.getFunction()], testFront.getReference(), testFront.getReadMask());
|
glStencilFuncSeparate(GL_FRONT, COMPARISON_TO_GL[testFront.getFunction()], testFront.getReference(), testFront.getReadMask());
|
||||||
|
|
||||||
glStencilOpSeparate(GL_BACK, STENCIL_OPS[testBack.getFailOp()], STENCIL_OPS[testBack.getPassOp()], STENCIL_OPS[testBack.getDepthFailOp()]);
|
glStencilOpSeparate(GL_BACK, STENCIL_OPS[testBack.getFailOp()], STENCIL_OPS[testBack.getDepthFailOp()], STENCIL_OPS[testBack.getPassOp()]);
|
||||||
glStencilFuncSeparate(GL_BACK, COMPARISON_TO_GL[testBack.getFunction()], testBack.getReference(), testBack.getReadMask());
|
glStencilFuncSeparate(GL_BACK, COMPARISON_TO_GL[testBack.getFunction()], testBack.getReference(), testBack.getReadMask());
|
||||||
} else {
|
} else {
|
||||||
glStencilOp(STENCIL_OPS[testFront.getFailOp()], STENCIL_OPS[testFront.getPassOp()], STENCIL_OPS[testFront.getDepthFailOp()]);
|
glStencilOp(STENCIL_OPS[testFront.getFailOp()], STENCIL_OPS[testFront.getDepthFailOp()], STENCIL_OPS[testFront.getPassOp()]);
|
||||||
glStencilFunc(COMPARISON_TO_GL[testFront.getFunction()], testFront.getReference(), testFront.getReadMask());
|
glStencilFunc(COMPARISON_TO_GL[testFront.getFunction()], testFront.getReference(), testFront.getReadMask());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,31 @@ enum DeferredShader_BufferSlot {
|
||||||
static void loadLightProgram(const char* vertSource, const char* fragSource, bool lightVolume, gpu::PipelinePointer& program, LightLocationsPtr& locations);
|
static void loadLightProgram(const char* vertSource, const char* fragSource, bool lightVolume, gpu::PipelinePointer& program, LightLocationsPtr& locations);
|
||||||
static void loadLightVolumeProgram(const char* vertSource, const char* fragSource, bool front, gpu::PipelinePointer& program, LightLocationsPtr& locations);
|
static void loadLightVolumeProgram(const char* vertSource, const char* fragSource, bool front, gpu::PipelinePointer& program, LightLocationsPtr& locations);
|
||||||
|
|
||||||
|
const char no_light_frag[] =
|
||||||
|
R"SCRIBE(
|
||||||
|
//PC 410 core
|
||||||
|
// Generated on Wed Sep 07 12:11:58 2016
|
||||||
|
//
|
||||||
|
// point_light.frag
|
||||||
|
// fragment shader
|
||||||
|
//
|
||||||
|
// Created by Sam Gateau on 9/18/15.
|
||||||
|
// Copyright 2014 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
out vec4 _fragColor;
|
||||||
|
|
||||||
|
void main(void) {
|
||||||
|
_fragColor = vec4(1.0, 1.0, 1.0, 1.0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
)SCRIBE"
|
||||||
|
;
|
||||||
|
|
||||||
void DeferredLightingEffect::init() {
|
void DeferredLightingEffect::init() {
|
||||||
_directionalLightLocations = std::make_shared<LightLocations>();
|
_directionalLightLocations = std::make_shared<LightLocations>();
|
||||||
_directionalAmbientSphereLightLocations = std::make_shared<LightLocations>();
|
_directionalAmbientSphereLightLocations = std::make_shared<LightLocations>();
|
||||||
|
@ -99,12 +124,12 @@ void DeferredLightingEffect::init() {
|
||||||
loadLightProgram(deferred_light_vert, directional_ambient_light_shadow_frag, false, _directionalAmbientSphereLightShadow, _directionalAmbientSphereLightShadowLocations);
|
loadLightProgram(deferred_light_vert, directional_ambient_light_shadow_frag, false, _directionalAmbientSphereLightShadow, _directionalAmbientSphereLightShadowLocations);
|
||||||
loadLightProgram(deferred_light_vert, directional_skybox_light_shadow_frag, false, _directionalSkyboxLightShadow, _directionalSkyboxLightShadowLocations);
|
loadLightProgram(deferred_light_vert, directional_skybox_light_shadow_frag, false, _directionalSkyboxLightShadow, _directionalSkyboxLightShadowLocations);
|
||||||
|
|
||||||
loadLightProgram(deferred_light_vert, local_lights_shading_frag, false, _localLight, _localLightLocations);
|
loadLightProgram(deferred_light_vert, local_lights_shading_frag, true, _localLight, _localLightLocations);
|
||||||
|
|
||||||
loadLightVolumeProgram(deferred_light_point_vert, point_light_frag, false, _pointLightBack, _pointLightLocations);
|
loadLightVolumeProgram(deferred_light_point_vert, no_light_frag, false, _pointLightBack, _pointLightLocations);
|
||||||
loadLightVolumeProgram(deferred_light_point_vert, point_light_frag, true, _pointLightFront, _pointLightLocations);
|
loadLightVolumeProgram(deferred_light_point_vert, no_light_frag, true, _pointLightFront, _pointLightLocations);
|
||||||
loadLightVolumeProgram(deferred_light_spot_vert, spot_light_frag, false, _spotLightBack, _spotLightLocations);
|
loadLightVolumeProgram(deferred_light_spot_vert, no_light_frag, false, _spotLightBack, _spotLightLocations);
|
||||||
loadLightVolumeProgram(deferred_light_spot_vert, spot_light_frag, true, _spotLightFront, _spotLightLocations);
|
loadLightVolumeProgram(deferred_light_spot_vert, no_light_frag, true, _spotLightFront, _spotLightLocations);
|
||||||
|
|
||||||
// Allocate a global light representing the Global Directional light casting shadow (the sun) and the ambient light
|
// Allocate a global light representing the Global Directional light casting shadow (the sun) and the ambient light
|
||||||
_allocatedLights.push_back(std::make_shared<model::Light>());
|
_allocatedLights.push_back(std::make_shared<model::Light>());
|
||||||
|
@ -223,12 +248,14 @@ static void loadLightProgram(const char* vertSource, const char* fragSource, boo
|
||||||
auto state = std::make_shared<gpu::State>();
|
auto state = std::make_shared<gpu::State>();
|
||||||
state->setColorWriteMask(true, true, true, false);
|
state->setColorWriteMask(true, true, true, false);
|
||||||
|
|
||||||
// Stencil test all the light passes for objects pixels only, not the background
|
// state->setStencilTest(true, 0xFF, gpu::State::StencilTest(0, 0xFF, gpu::ALWAYS, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP));
|
||||||
state->setStencilTest(true, 0xFF, gpu::State::StencilTest(0, 0xFF, gpu::NOT_EQUAL, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP));
|
|
||||||
|
|
||||||
if (lightVolume) {
|
if (lightVolume) {
|
||||||
state->setCullMode(gpu::State::CULL_FRONT);
|
state->setStencilTest(true, 0x00, gpu::State::StencilTest(1, 0xFF, gpu::GREATER_EQUAL, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP));
|
||||||
state->setDepthTest(true, false, gpu::GREATER_EQUAL);
|
|
||||||
|
state->setCullMode(gpu::State::CULL_BACK);
|
||||||
|
// state->setCullMode(gpu::State::CULL_FRONT);
|
||||||
|
// state->setDepthTest(true, false, gpu::GREATER_EQUAL);
|
||||||
|
|
||||||
//state->setDepthClampEnable(true);
|
//state->setDepthClampEnable(true);
|
||||||
// TODO: We should use DepthClamp and avoid changing geometry for inside /outside cases
|
// TODO: We should use DepthClamp and avoid changing geometry for inside /outside cases
|
||||||
|
@ -236,6 +263,9 @@ static void loadLightProgram(const char* vertSource, const char* fragSource, boo
|
||||||
state->setBlendFunction(true, gpu::State::ONE, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
state->setBlendFunction(true, gpu::State::ONE, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
// Stencil test all the light passes for objects pixels only, not the background
|
||||||
|
state->setStencilTest(true, 0x00, gpu::State::StencilTest(0, 0x01, gpu::NOT_EQUAL, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP));
|
||||||
|
|
||||||
state->setCullMode(gpu::State::CULL_BACK);
|
state->setCullMode(gpu::State::CULL_BACK);
|
||||||
// additive blending
|
// additive blending
|
||||||
state->setBlendFunction(true, gpu::State::ONE, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
state->setBlendFunction(true, gpu::State::ONE, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
||||||
|
@ -289,25 +319,25 @@ static void loadLightVolumeProgram(const char* vertSource, const char* fragSourc
|
||||||
locations->shadowTransformBuffer = program->getBuffers().findLocation("shadowTransformBuffer");
|
locations->shadowTransformBuffer = program->getBuffers().findLocation("shadowTransformBuffer");
|
||||||
|
|
||||||
auto state = std::make_shared<gpu::State>();
|
auto state = std::make_shared<gpu::State>();
|
||||||
state->setColorWriteMask(true, true, true, false);
|
// state->setColorWriteMask(true, true, true, false);
|
||||||
// state->setColorWriteMask(false, false, false, false);
|
state->setColorWriteMask(false, false, false, false);
|
||||||
|
|
||||||
// Stencil test all the light passes for objects pixels only, not the background
|
// Stencil test all the light passes for objects pixels only, not the background
|
||||||
|
|
||||||
if (front) {
|
if (front) {
|
||||||
state->setCullMode(gpu::State::CULL_FRONT);
|
state->setCullMode(gpu::State::CULL_BACK);
|
||||||
state->setDepthTest(true, false, gpu::LESS_EQUAL);
|
state->setDepthTest(true, false, gpu::LESS_EQUAL);
|
||||||
state->setStencilTest(true, 0xFF, gpu::State::StencilTest(0, 0xFF, gpu::ALWAYS, gpu::State::STENCIL_OP_INCR, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_INCR));
|
state->setStencilTest(true, 0xFF, gpu::State::StencilTest(0, 0xFF, gpu::NOT_EQUAL, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_DECR));
|
||||||
|
|
||||||
//state->setDepthClampEnable(true);
|
// state->setDepthClampEnable(true);
|
||||||
// TODO: We should use DepthClamp and avoid changing geometry for inside /outside cases
|
// TODO: We should use DepthClamp and avoid changing geometry for inside /outside cases
|
||||||
// additive blending
|
// additive blending
|
||||||
// state->setBlendFunction(true, gpu::State::ONE, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
// state->setBlendFunction(true, gpu::State::ONE, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
state->setCullMode(gpu::State::CULL_BACK);
|
state->setCullMode(gpu::State::CULL_FRONT);
|
||||||
state->setDepthTest(true, false, gpu::GREATER_EQUAL);
|
state->setDepthTest(true, false, gpu::LESS_EQUAL);
|
||||||
state->setStencilTest(true, 0xFF, gpu::State::StencilTest(0, 0xFF, gpu::ALWAYS, gpu::State::STENCIL_OP_INCR, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_INCR));
|
state->setStencilTest(true, 0xFF, gpu::State::StencilTest(0, 0xFF, gpu::NOT_EQUAL, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_INCR));
|
||||||
// additive blending
|
// additive blending
|
||||||
// state->setBlendFunction(true, gpu::State::ONE, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
// state->setBlendFunction(true, gpu::State::ONE, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
||||||
}
|
}
|
||||||
|
@ -690,6 +720,9 @@ void RenderDeferredLocals::run(const render::SceneContextPointer& sceneContext,
|
||||||
|
|
||||||
auto textureFrameTransform = gpu::Framebuffer::evalSubregionTexcoordTransformCoefficients(deferredFramebuffer->getFrameSize(), viewport);
|
auto textureFrameTransform = gpu::Framebuffer::evalSubregionTexcoordTransformCoefficients(deferredFramebuffer->getFrameSize(), viewport);
|
||||||
|
|
||||||
|
batch.setProjectionTransform(projMat);
|
||||||
|
batch.setViewTransform(viewTransform, true);
|
||||||
|
|
||||||
// gather lights
|
// gather lights
|
||||||
auto& srcPointLights = deferredLightingEffect->_pointLights;
|
auto& srcPointLights = deferredLightingEffect->_pointLights;
|
||||||
auto& srcSpotLights = deferredLightingEffect->_spotLights;
|
auto& srcSpotLights = deferredLightingEffect->_spotLights;
|
||||||
|
@ -720,8 +753,8 @@ void RenderDeferredLocals::run(const render::SceneContextPointer& sceneContext,
|
||||||
|
|
||||||
|
|
||||||
// before we get to the real lighting, let s try to cull down the number of pixels
|
// before we get to the real lighting, let s try to cull down the number of pixels
|
||||||
{
|
if (false) {
|
||||||
/* if (numPointLights > 0) {
|
if (numPointLights > 0) {
|
||||||
auto mesh = deferredLightingEffect->getPointLightMesh();
|
auto mesh = deferredLightingEffect->getPointLightMesh();
|
||||||
batch.setIndexBuffer(mesh->getIndexBuffer());
|
batch.setIndexBuffer(mesh->getIndexBuffer());
|
||||||
batch.setInputBuffer(0, mesh->getVertexBuffer());
|
batch.setInputBuffer(0, mesh->getVertexBuffer());
|
||||||
|
@ -730,16 +763,14 @@ void RenderDeferredLocals::run(const render::SceneContextPointer& sceneContext,
|
||||||
|
|
||||||
// Point light pipeline
|
// Point light pipeline
|
||||||
batch.setPipeline(deferredLightingEffect->_pointLightBack);
|
batch.setPipeline(deferredLightingEffect->_pointLightBack);
|
||||||
batch._glUniform4fv(deferredLightingEffect->_pointLightLocations->texcoordFrameTransform, 1, reinterpret_cast<const float*>(&textureFrameTransform));
|
|
||||||
|
|
||||||
batch.drawIndexedInstanced(numPointLights, model::Mesh::topologyToPrimitive(pointPart._topology), pointPart._numIndices, pointPart._startIndex, offsetPointLights);
|
batch.drawIndexedInstanced(numPointLights, model::Mesh::topologyToPrimitive(pointPart._topology), pointPart._numIndices, pointPart._startIndex, offsetPointLights);
|
||||||
|
|
||||||
batch.setPipeline(deferredLightingEffect->_pointLightFront);
|
batch.setPipeline(deferredLightingEffect->_pointLightFront);
|
||||||
batch._glUniform4fv(deferredLightingEffect->_pointLightLocations->texcoordFrameTransform, 1, reinterpret_cast<const float*>(&textureFrameTransform));
|
|
||||||
|
|
||||||
batch.drawIndexedInstanced(numPointLights, model::Mesh::topologyToPrimitive(pointPart._topology), pointPart._numIndices, pointPart._startIndex, offsetPointLights);
|
batch.drawIndexedInstanced(numPointLights, model::Mesh::topologyToPrimitive(pointPart._topology), pointPart._numIndices, pointPart._startIndex, offsetPointLights);
|
||||||
} */
|
}
|
||||||
/*
|
|
||||||
if (numSpotLights > 0) {
|
if (numSpotLights > 0) {
|
||||||
auto mesh = deferredLightingEffect->getSpotLightMesh();
|
auto mesh = deferredLightingEffect->getSpotLightMesh();
|
||||||
batch.setIndexBuffer(mesh->getIndexBuffer());
|
batch.setIndexBuffer(mesh->getIndexBuffer());
|
||||||
|
@ -749,15 +780,13 @@ void RenderDeferredLocals::run(const render::SceneContextPointer& sceneContext,
|
||||||
|
|
||||||
// Spot light pipeline
|
// Spot light pipeline
|
||||||
batch.setPipeline(deferredLightingEffect->_spotLightBack);
|
batch.setPipeline(deferredLightingEffect->_spotLightBack);
|
||||||
batch._glUniform4fv(deferredLightingEffect->_spotLightLocations->texcoordFrameTransform, 1, reinterpret_cast<const float*>(&textureFrameTransform));
|
|
||||||
|
|
||||||
batch.drawIndexedInstanced(numSpotLights, model::Mesh::topologyToPrimitive(conePart._topology), conePart._numIndices, conePart._startIndex, offsetSpotLights);
|
batch.drawIndexedInstanced(numSpotLights, model::Mesh::topologyToPrimitive(conePart._topology), conePart._numIndices, conePart._startIndex, offsetSpotLights);
|
||||||
|
|
||||||
batch.setPipeline(deferredLightingEffect->_spotLightFront);
|
batch.setPipeline(deferredLightingEffect->_spotLightFront);
|
||||||
batch._glUniform4fv(deferredLightingEffect->_spotLightLocations->texcoordFrameTransform, 1, reinterpret_cast<const float*>(&textureFrameTransform));
|
|
||||||
|
|
||||||
batch.drawIndexedInstanced(numSpotLights, model::Mesh::topologyToPrimitive(conePart._topology), conePart._numIndices, conePart._startIndex, offsetSpotLights);
|
batch.drawIndexedInstanced(numSpotLights, model::Mesh::topologyToPrimitive(conePart._topology), conePart._numIndices, conePart._startIndex, offsetSpotLights);
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Local light pipeline
|
// Local light pipeline
|
||||||
|
|
|
@ -143,7 +143,8 @@ public:
|
||||||
bool enablePointLight{ true };
|
bool enablePointLight{ true };
|
||||||
bool enableSpotLight{ true };
|
bool enableSpotLight{ true };
|
||||||
|
|
||||||
bool showLightContour{ false }; // false by default
|
// bool showLightContour { false }; // false by default
|
||||||
|
bool showLightContour { true }; // false by default
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void dirty();
|
void dirty();
|
||||||
|
|
|
@ -390,7 +390,7 @@ gpu::PipelinePointer DrawStencilDeferred::getOpaquePipeline() {
|
||||||
|
|
||||||
auto state = std::make_shared<gpu::State>();
|
auto state = std::make_shared<gpu::State>();
|
||||||
state->setDepthTest(true, false, gpu::LESS_EQUAL);
|
state->setDepthTest(true, false, gpu::LESS_EQUAL);
|
||||||
state->setStencilTest(true, 0xFF, gpu::State::StencilTest(STENCIL_OPAQUE, 0xFF, gpu::ALWAYS, gpu::State::STENCIL_OP_REPLACE, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_REPLACE));
|
state->setStencilTest(true, 0xFF, gpu::State::StencilTest(STENCIL_OPAQUE, 0xFF, gpu::ALWAYS, gpu::State::STENCIL_OP_REPLACE, gpu::State::STENCIL_OP_REPLACE, gpu::State::STENCIL_OP_KEEP));
|
||||||
state->setColorWriteMask(0);
|
state->setColorWriteMask(0);
|
||||||
|
|
||||||
_opaquePipeline = gpu::Pipeline::create(program, state);
|
_opaquePipeline = gpu::Pipeline::create(program, state);
|
||||||
|
|
|
@ -30,17 +30,19 @@ out vec4 _texCoord0;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
|
|
||||||
instanceID = lightIndex[gl_InstanceID];
|
int instanceID = lightIndex[gl_InstanceID];
|
||||||
Light light = getLight(instanceID);
|
Light light = getLight(instanceID);
|
||||||
vec4 sphereVertex = inPosition;
|
vec4 sphereVertex = inPosition;
|
||||||
|
vec3 lightOrigin = getLightPosition(light);
|
||||||
vec4 sphereParam = getLightVolumeGeometry(light);
|
vec4 sphereParam = getLightVolumeGeometry(light);
|
||||||
|
|
||||||
sphereVertex.xyz *= sphereParam.w;
|
sphereVertex.xyz *= sphereParam.w;
|
||||||
|
|
||||||
|
sphereVertex.xyz += lightOrigin;
|
||||||
|
|
||||||
// standard transform
|
// standard transform
|
||||||
TransformCamera cam = getTransformCamera();
|
TransformCamera cam = getTransformCamera();
|
||||||
TransformObject obj = getTransformObject();
|
<$transformWorldToClipPos(cam, sphereVertex, gl_Position)$>;
|
||||||
<$transformModelToClipPos(cam, obj, sphereVertex, gl_Position)$>;
|
|
||||||
|
|
||||||
vec4 projected = gl_Position / gl_Position.w;
|
vec4 projected = gl_Position / gl_Position.w;
|
||||||
projected.xy = (projected.xy + 1.0) * 0.5;
|
projected.xy = (projected.xy + 1.0) * 0.5;
|
||||||
|
|
|
@ -25,11 +25,10 @@ uniform lightIndexBuffer {
|
||||||
int lightIndex[120];
|
int lightIndex[120];
|
||||||
};
|
};
|
||||||
out vec4 _texCoord0;
|
out vec4 _texCoord0;
|
||||||
flat out int instanceID;
|
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
vec4 coneVertex = inPosition;
|
vec4 coneVertex = inPosition;
|
||||||
instanceID = lightIndex[gl_InstanceID];
|
int instanceID = lightIndex[gl_InstanceID];
|
||||||
Light light = getLight(instanceID);
|
Light light = getLight(instanceID);
|
||||||
vec3 lightPos = getLightPosition(light);
|
vec3 lightPos = getLightPosition(light);
|
||||||
vec4 coneParam = getLightVolumeGeometry(light);
|
vec4 coneParam = getLightVolumeGeometry(light);
|
||||||
|
@ -53,10 +52,6 @@ void main(void) {
|
||||||
|
|
||||||
// standard transform
|
// standard transform
|
||||||
TransformCamera cam = getTransformCamera();
|
TransformCamera cam = getTransformCamera();
|
||||||
|
|
||||||
<! TransformObject obj = getTransformObject();
|
|
||||||
<$transformModelToClipPos(cam, obj, coneVertex, gl_Position)$>; !>
|
|
||||||
|
|
||||||
<$transformWorldToClipPos(cam, coneVertex, gl_Position)$>;
|
<$transformWorldToClipPos(cam, coneVertex, gl_Position)$>;
|
||||||
|
|
||||||
vec4 projected = gl_Position / gl_Position.w;
|
vec4 projected = gl_Position / gl_Position.w;
|
||||||
|
|
Loading…
Reference in a new issue