Changed behaviou of max billboard sizes.

This commit is contained in:
Jonathas Costa
2017-12-08 13:03:36 -05:00
parent 5eb11cfc49
commit b031245a19
3 changed files with 23 additions and 4 deletions
@@ -877,7 +877,7 @@ void RenderableBillboardsCloud::render(const RenderData& data, RendererTasks&) {
// Almost Working
glm::dmat4 invMVPParts = glm::inverse(modelMatrix) * glm::inverse(data.camera.combinedViewMatrix()) *
glm::dmat4 invMVPParts = worldToModelTransform * glm::inverse(data.camera.combinedViewMatrix()) *
glm::inverse(glm::dmat4(projectionMatrix));
glm::dvec3 orthoRight = glm::dvec3(glm::normalize(glm::dvec3(invMVPParts * glm::dvec4(1.0, 0.0, 0.0, 0.0))));
glm::dvec3 orthoUp = glm::dvec3(glm::normalize(glm::dvec3(invMVPParts * glm::dvec4(0.0, 1.0, 0.0, 0.0))));
@@ -159,12 +159,29 @@ void main() {
if ((height > maxBillboardSize) ||
(width > maxBillboardSize)) {
//return;
// Set maximum size as Carter's instructions
float correctionScale = height > maxBillboardSize ? maxBillboardSize / (topRight.y - bottomLeft.y) :
maxBillboardSize / (topRight.x - bottomLeft.x);
scaledRight = correctionScale * scaleMultiply * right/2.0f;
scaledUp = correctionScale * scaleMultiply * up/2.0f;
initialPosition = z_normalization(vec4(modelViewProjectionTransform *
dvec4(dpos.xyz - scaledRight - scaledUp, dpos.w)));
vs_screenSpaceDepth = initialPosition.w;
secondPosition = z_normalization(vec4(modelViewProjectionTransform *
dvec4(dpos.xyz + scaledRight - scaledUp, dpos.w)));
crossCorner = z_normalization(vec4(modelViewProjectionTransform *
dvec4(dpos.xyz + scaledUp + scaledRight, dpos.w)));
thirdPosition = z_normalization(vec4(modelViewProjectionTransform *
dvec4(dpos.xyz + scaledUp - scaledRight, dpos.w)));
// Fade-out
float maxVar = 3.0f * maxBillboardSize;
float minVar = maxBillboardSize;
ta = 1.0f - ( (var - minVar)/(maxVar - minVar) );
if (ta == 0.0f)
return;
return;
}
else if (width < 2.0f * minBillboardSize) {
//return;
+3 -1
View File
@@ -9,7 +9,9 @@ return {
-- A regular 1280x720 window
SGCTConfig = sgct.config.single{1280, 720},
-- SGCTConfig = sgct.config.single{1280, 720, scene={orientation = { yaw = 120, pitch = 15, roll = 0.0 }}},
--SGCTConfig = "${CONFIG}/single_two_win.xml",
--SGCTConfig = "${CONFIG}/single_two_win.xml",
--SGCTConfig = "${CONFIG}/spout_output.xml",
-- A regular 1920x1080 window
--SGCTConfig = sgct.config.single{1920, 1080},