Fixing lighting and atmosphere

This commit is contained in:
Bradley Austin Davis 2015-09-21 13:51:08 -07:00
parent e024d23366
commit e12e4ece34
6 changed files with 12 additions and 11 deletions

View file

@ -643,7 +643,7 @@ void SkeletonModel::renderBoundingCollisionShapes(gpu::Batch& batch, float alpha
glm::vec3 topPoint = _translation + _boundingCapsuleLocalOffset + (0.5f * _boundingCapsuleHeight) * glm::vec3(0.0f, 1.0f, 0.0f);
deferredLighting->renderSolidSphereInstance(batch,
Transform().setTranslation(topPoint).postScale(_boundingCapsuleRadius * 2.0),
Transform().setTranslation(topPoint).postScale(_boundingCapsuleRadius),
glm::vec4(0.6f, 0.6f, 0.8f, alpha));
// draw a yellow sphere at the capsule bottom point
@ -651,7 +651,7 @@ void SkeletonModel::renderBoundingCollisionShapes(gpu::Batch& batch, float alpha
glm::vec3 axis = topPoint - bottomPoint;
deferredLighting->renderSolidSphereInstance(batch,
Transform().setTranslation(bottomPoint).postScale(_boundingCapsuleRadius * 2.0),
Transform().setTranslation(bottomPoint).postScale(_boundingCapsuleRadius),
glm::vec4(0.8f, 0.8f, 0.6f, alpha));
// draw a green cylinder between the two points

View file

@ -40,7 +40,7 @@ void Sphere3DOverlay::render(RenderArgs* args) {
batch->setModelTransform(Transform());
Transform transform = _transform;
transform.postScale(getDimensions());
transform.postScale(getDimensions() * 0.5f);
if (_isSolid) {
DependencyManager::get<DeferredLightingEffect>()->renderSolidSphereInstance(*batch, transform, sphereColor);
} else {

View file

@ -53,15 +53,17 @@ void RenderableSphereEntityItem::render(RenderArgs* args) {
gpu::Batch& batch = *args->_batch;
glm::vec4 sphereColor(toGlm(getXColor()), getLocalRenderAlpha());
Transform modelTransform = getTransformToCenter();
modelTransform.postScale(0.5f);
if (_procedural->ready()) {
batch.setModelTransform(getTransformToCenter()); // use a transform with scale, rotation, registration point and translation
_procedural->prepare(batch, getDimensions());
batch.setModelTransform(modelTransform); // use a transform with scale, rotation, registration point and translation
_procedural->prepare(batch, getDimensions() / 2.0f);
auto color = _procedural->getColor(sphereColor);
batch._glColor4f(color.r, color.g, color.b, color.a);
DependencyManager::get<GeometryCache>()->renderSphere(batch);
} else {
batch.setModelTransform(Transform());
DependencyManager::get<DeferredLightingEffect>()->renderSolidSphereInstance(batch, getTransformToCenter(), sphereColor);
DependencyManager::get<DeferredLightingEffect>()->renderSolidSphereInstance(batch, modelTransform, sphereColor);
}

View file

@ -589,7 +589,6 @@ void DeferredLightingEffect::render(RenderArgs* args) {
} else {
Transform model;
model.setTranslation(glm::vec3(light->getPosition().x, light->getPosition().y, light->getPosition().z));
model.postScale(expandedRadius);
batch.setModelTransform(model);
batch._glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
geometryCache->renderSphere(batch);

View file

@ -199,7 +199,7 @@ bool Environment::findCapsulePenetration(const glm::vec3& start, const glm::vec3
void Environment::renderAtmosphere(gpu::Batch& batch, ViewFrustum& viewFrustum, const EnvironmentData& data) {
// FIXME atmosphere rendering is broken in some way,
// should probably be replaced by a procedual skybox and put on the marketplace
return;
//return;
glm::vec3 center = data.getAtmosphereCenter();

View file

@ -330,7 +330,7 @@ void GeometryCache::buildShapes() {
}
faceNormal = glm::normalize(faceNormal);
for (size_t j = 0; j < 3; ++j) {
vertices.push_back(glm::normalize(originalVertices[i + j]) * 0.5f);
vertices.push_back(glm::normalize(originalVertices[i + j]));
vertices.push_back(faceNormal);
}
}
@ -369,7 +369,7 @@ void GeometryCache::buildShapes() {
vertices.reserve(originalVertices.size() * 2);
for (size_t i = 0; i < originalVertices.size(); i += 3) {
for (int j = 0; j < 3; ++j) {
vertices.push_back(originalVertices[i + j] * 0.5f);
vertices.push_back(originalVertices[i + j]);
vertices.push_back(originalVertices[i + j]);
indices.push_back(i + j + startingIndex);
}
@ -398,7 +398,7 @@ void GeometryCache::buildShapes() {
}
faceNormal = glm::normalize(faceNormal);
for (int j = 0; j < 3; ++j) {
vertices.push_back(glm::normalize(originalVertices[i + j]) * 0.5f);
vertices.push_back(glm::normalize(originalVertices[i + j]));
vertices.push_back(faceNormal);
indices.push_back(i + j + startingIndex);
}