mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 23:55:24 +02:00
parabola and particle shader fixes
This commit is contained in:
parent
7dd80d0180
commit
a7dec8fb75
5 changed files with 14 additions and 39 deletions
|
@ -149,7 +149,7 @@ void main(void) {
|
|||
vec3 UP = vec3(0, 1, 0);
|
||||
vec3 modelUpWorld;
|
||||
<$transformModelToWorldDir(cam, obj, UP, modelUpWorld)$>
|
||||
vec3 upWorld = mix(UP, normalize(modelUpWorld), particle.rotateWithEntity);
|
||||
vec3 upWorld = mix(UP, normalize(modelUpWorld), float(particle.rotateWithEntity));
|
||||
vec3 upEye = normalize(view3 * upWorld);
|
||||
vec3 FORWARD = vec3(0, 0, -1);
|
||||
vec3 particleRight = normalize(cross(FORWARD, upEye));
|
||||
|
|
|
@ -39,7 +39,4 @@ void main(void) {
|
|||
// Procedural Shaders are expected to be Gamma corrected so let's bring back the RGB in linear space for the rest of the pipeline
|
||||
color = pow(color, vec3(2.2));
|
||||
_fragColor = vec4(color, 0.0);
|
||||
|
||||
// FIXME: scribe does not yet scrub out else statements
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<@include gpu/Transform.slh@>
|
||||
<$declareStandardTransform()$>
|
||||
|
||||
layout(std140, binding=0) uniform parabolaData {
|
||||
struct ParabolaData {
|
||||
vec3 velocity;
|
||||
float parabolicDistance;
|
||||
vec3 acceleration;
|
||||
|
@ -20,34 +20,38 @@ layout(std140, binding=0) uniform parabolaData {
|
|||
vec4 color;
|
||||
int numSections;
|
||||
ivec3 spare;
|
||||
}
|
||||
|
||||
layout(std140, binding=0) uniform parabolaData {
|
||||
ParabolaData _parabolaData;
|
||||
};
|
||||
|
||||
layout(location=0) out vec4 _color;
|
||||
|
||||
void main(void) {
|
||||
_color = color;
|
||||
_color = _parabolaData.color;
|
||||
|
||||
float t = parabolicDistance * (float(gl_VertexID / 2) / float(numSections));
|
||||
float t = _parabolaData.parabolicDistance * (float(gl_VertexID / 2) / float(_parabolaData.numSections));
|
||||
|
||||
vec4 pos = vec4(velocity * t + 0.5 * acceleration * t * t, 1);
|
||||
vec4 pos = vec4(_parabolaData.velocity * t + 0.5 * _parabolaData.acceleration * t * t, 1);
|
||||
const float EPSILON = 0.00001;
|
||||
vec4 normal;
|
||||
|
||||
TransformCamera cam = getTransformCamera();
|
||||
TransformObject obj = getTransformObject();
|
||||
if (dot(acceleration, acceleration) < EPSILON) {
|
||||
if (dot(_parabolaData.acceleration, _parabolaData.acceleration) < EPSILON) {
|
||||
// Handle case where acceleration == (0, 0, 0)
|
||||
vec3 eyeUp = vec3(0, 1, 0);
|
||||
vec3 worldUp;
|
||||
<$transformEyeToWorldDir(cam, eyeUp, worldUp)$>
|
||||
normal = vec4(normalize(cross(velocity, worldUp)), 0);
|
||||
normal = vec4(normalize(cross(_parabolaData.velocity, worldUp)), 0);
|
||||
} else {
|
||||
normal = vec4(normalize(cross(velocity, acceleration)), 0);
|
||||
normal = vec4(normalize(cross(_parabolaData.velocity, _parabolaData.acceleration)), 0);
|
||||
}
|
||||
if (gl_VertexID % 2 == 0) {
|
||||
pos += 0.5 * width * normal;
|
||||
pos += 0.5 * _parabolaData.width * normal;
|
||||
} else {
|
||||
pos -= 0.5 * width * normal;
|
||||
pos -= 0.5 * _parabolaData.width * normal;
|
||||
}
|
||||
|
||||
<$transformModelToClipPos(cam, obj, pos, gl_Position)$>
|
||||
|
|
|
@ -142,10 +142,6 @@ const gpu::PipelinePointer DrawItemSelection::getDrawItemBoundPipeline() {
|
|||
if (!_drawItemBoundPipeline) {
|
||||
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::render::program::drawItemBounds);
|
||||
|
||||
//_drawItemBoundPosLoc = program->getUniforms().findLocation("inBoundPos");
|
||||
//_drawItemBoundDimLoc = program->getUniforms().findLocation("inBoundDim");
|
||||
//_drawCellLocationLoc = program->getUniforms().findLocation("inCellLocation");
|
||||
|
||||
auto state = std::make_shared<gpu::State>();
|
||||
|
||||
state->setDepthTest(true, false, gpu::LESS_EQUAL);
|
||||
|
@ -194,10 +190,6 @@ void DrawItemSelection::run(const RenderContextPointer& renderContext, const Ite
|
|||
auto itemCell = scene->getSpatialTree().getCellLocation(item.getCell());
|
||||
glm::ivec4 cellLocation(0, 0, 0, itemCell.depth);
|
||||
|
||||
//batch._glUniform4iv(_drawCellLocationLoc, 1, ((const int*)(&cellLocation)));
|
||||
//batch._glUniform3fv(_drawItemBoundPosLoc, 1, (const float*)(&itemBound.getCorner()));
|
||||
//batch._glUniform3fv(_drawItemBoundDimLoc, 1, (const float*)(&itemBound.getScale()));
|
||||
|
||||
batch.draw(gpu::LINES, 24, 0);
|
||||
}
|
||||
}
|
||||
|
@ -209,10 +201,6 @@ void DrawItemSelection::run(const RenderContextPointer& renderContext, const Ite
|
|||
auto itemCell = scene->getSpatialTree().getCellLocation(item.getCell());
|
||||
glm::ivec4 cellLocation(0, 0, 1, itemCell.depth);
|
||||
|
||||
//batch._glUniform4iv(_drawCellLocationLoc, 1, ((const int*)(&cellLocation)));
|
||||
//batch._glUniform3fv(_drawItemBoundPosLoc, 1, (const float*)(&itemBound.getCorner()));
|
||||
//batch._glUniform3fv(_drawItemBoundDimLoc, 1, (const float*)(&itemBound.getScale()));
|
||||
|
||||
batch.draw(gpu::LINES, 24, 0);
|
||||
}
|
||||
}
|
||||
|
@ -224,10 +212,6 @@ void DrawItemSelection::run(const RenderContextPointer& renderContext, const Ite
|
|||
auto itemCell = scene->getSpatialTree().getCellLocation(item.getCell());
|
||||
glm::ivec4 cellLocation(0, 0, 0, itemCell.depth);
|
||||
|
||||
//batch._glUniform4iv(_drawCellLocationLoc, 1, ((const int*)(&cellLocation)));
|
||||
//batch._glUniform3fv(_drawItemBoundPosLoc, 1, (const float*)(&itemBound.getCorner()));
|
||||
//batch._glUniform3fv(_drawItemBoundDimLoc, 1, (const float*)(&itemBound.getScale()));
|
||||
|
||||
batch.draw(gpu::LINES, 24, 0);
|
||||
}
|
||||
}
|
||||
|
@ -238,9 +222,6 @@ void DrawItemSelection::run(const RenderContextPointer& renderContext, const Ite
|
|||
auto itemBound = item.getBound();
|
||||
auto itemCell = scene->getSpatialTree().getCellLocation(item.getCell());
|
||||
glm::ivec4 cellLocation(0, 0, 1, itemCell.depth);
|
||||
//batch._glUniform4iv(_drawCellLocationLoc, 1, ((const int*)(&cellLocation)));
|
||||
//batch._glUniform3fv(_drawItemBoundPosLoc, 1, (const float*)(&itemBound.getCorner()));
|
||||
//batch._glUniform3fv(_drawItemBoundDimLoc, 1, (const float*)(&itemBound.getScale()));
|
||||
|
||||
batch.draw(gpu::LINES, 24, 0);
|
||||
}
|
||||
|
|
|
@ -33,9 +33,6 @@ void DrawStatusConfig::dirtyHelper() {
|
|||
const gpu::PipelinePointer DrawStatus::getDrawItemBoundsPipeline() {
|
||||
if (!_drawItemBoundsPipeline) {
|
||||
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::render::program::drawItemBounds);
|
||||
//_drawItemBoundPosLoc = program->getUniforms().findLocation("inBoundPos");
|
||||
//_drawItemBoundDimLoc = program->getUniforms().findLocation("inBoundDim");
|
||||
//_drawItemCellLocLoc = program->getUniforms().findLocation("inCellLocation");
|
||||
|
||||
auto state = std::make_shared<gpu::State>();
|
||||
|
||||
|
@ -55,10 +52,6 @@ const gpu::PipelinePointer DrawStatus::getDrawItemBoundsPipeline() {
|
|||
const gpu::PipelinePointer DrawStatus::getDrawItemStatusPipeline() {
|
||||
if (!_drawItemStatusPipeline) {
|
||||
gpu::ShaderPointer program = gpu::Shader::createProgram(shader::render::program::blurGaussianDepthAwareV);
|
||||
//_drawItemStatusPosLoc = program->getUniforms().findLocation("");
|
||||
//_drawItemStatusDimLoc = program->getUniforms().findLocation("");
|
||||
//_drawItemStatusValue0Loc = program->getUniforms().findLocation("");
|
||||
//_drawItemStatusValue1Loc = program->getUniforms().findLocation("");
|
||||
|
||||
auto state = std::make_shared<gpu::State>();
|
||||
|
||||
|
|
Loading…
Reference in a new issue