LightEntity debug render in batch

This commit is contained in:
Atlante45 2015-05-17 12:31:14 +02:00
parent 38d3c85664
commit 16340c0fee

View file

@ -12,6 +12,7 @@
#include <glm/gtx/quaternion.hpp> #include <glm/gtx/quaternion.hpp>
#include <gpu/GPUConfig.h> #include <gpu/GPUConfig.h>
#include <gpu/Batch.h>
#include <DeferredLightingEffect.h> #include <DeferredLightingEffect.h>
#include <GLMHelpers.h> #include <GLMHelpers.h>
@ -31,12 +32,7 @@ void RenderableLightEntityItem::render(RenderArgs* args) {
glm::quat rotation = getRotation(); glm::quat rotation = getRotation();
float largestDiameter = glm::max(dimensions.x, dimensions.y, dimensions.z); float largestDiameter = glm::max(dimensions.x, dimensions.y, dimensions.z);
const float MAX_COLOR = 255.0f; glm::vec3 color = toGlm(getXColor());
float colorR = getColor()[RED_INDEX] / MAX_COLOR;
float colorG = getColor()[GREEN_INDEX] / MAX_COLOR;
float colorB = getColor()[BLUE_INDEX] / MAX_COLOR;
glm::vec3 color = glm::vec3(colorR, colorG, colorB);
float intensity = getIntensity(); float intensity = getIntensity();
float exponent = getExponent(); float exponent = getExponent();
@ -49,21 +45,12 @@ void RenderableLightEntityItem::render(RenderArgs* args) {
DependencyManager::get<DeferredLightingEffect>()->addPointLight(position, largestDiameter / 2.0f, DependencyManager::get<DeferredLightingEffect>()->addPointLight(position, largestDiameter / 2.0f,
color, intensity); color, intensity);
} }
#ifdef WANT_DEBUG #ifdef WANT_DEBUG
glm::vec4 color(diffuseR, diffuseG, diffuseB, 1.0f); Q_ASSERT(args->_batch);
glPushMatrix(); gpu::Batch& batch = *args->_batch;
glTranslatef(position.x, position.y, position.z); batch.setModelTransform(getTransformToCenter());
glm::vec3 axis = glm::axis(rotation); DependencyManager::get<DeferredLightingEffect>()->renderWireSphere(batch, 0.5f, 15, 15, glm::vec4(color, 1.0f));
glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
glPushMatrix();
glm::vec3 positionToCenter = center - position;
glTranslatef(positionToCenter.x, positionToCenter.y, positionToCenter.z);
glScalef(dimensions.x, dimensions.y, dimensions.z);
DependencyManager::get<DeferredLightingEffect>()->renderWireSphere(0.5f, 15, 15, color);
glPopMatrix();
glPopMatrix();
#endif #endif
}; };