mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 16:55:07 +02:00
Fixing lighting and atmosphere
This commit is contained in:
parent
e024d23366
commit
e12e4ece34
6 changed files with 12 additions and 11 deletions
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue