mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 14:18:24 +02:00
CR comments
This commit is contained in:
parent
e12e4ece34
commit
0c0af812c2
3 changed files with 12 additions and 7 deletions
|
@ -18,6 +18,10 @@
|
||||||
|
|
||||||
QString const Sphere3DOverlay::TYPE = "sphere";
|
QString const Sphere3DOverlay::TYPE = "sphere";
|
||||||
|
|
||||||
|
// Sphere overlays should fit inside a cube of the specified dimensions, hence it needs to be a half unit sphere.
|
||||||
|
// However, the geometry cache renders a UNIT sphere, so we need to scale down.
|
||||||
|
static const float SPHERE_OVERLAY_SCALE = 0.5f;
|
||||||
|
|
||||||
Sphere3DOverlay::Sphere3DOverlay(const Sphere3DOverlay* Sphere3DOverlay) :
|
Sphere3DOverlay::Sphere3DOverlay(const Sphere3DOverlay* Sphere3DOverlay) :
|
||||||
Volume3DOverlay(Sphere3DOverlay)
|
Volume3DOverlay(Sphere3DOverlay)
|
||||||
{
|
{
|
||||||
|
@ -40,7 +44,7 @@ void Sphere3DOverlay::render(RenderArgs* args) {
|
||||||
batch->setModelTransform(Transform());
|
batch->setModelTransform(Transform());
|
||||||
|
|
||||||
Transform transform = _transform;
|
Transform transform = _transform;
|
||||||
transform.postScale(getDimensions() * 0.5f);
|
transform.postScale(getDimensions() * SPHERE_OVERLAY_SCALE);
|
||||||
if (_isSolid) {
|
if (_isSolid) {
|
||||||
DependencyManager::get<DeferredLightingEffect>()->renderSolidSphereInstance(*batch, transform, sphereColor);
|
DependencyManager::get<DeferredLightingEffect>()->renderSolidSphereInstance(*batch, transform, sphereColor);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -24,6 +24,11 @@
|
||||||
#include "../render-utils/simple_vert.h"
|
#include "../render-utils/simple_vert.h"
|
||||||
#include "../render-utils/simple_frag.h"
|
#include "../render-utils/simple_frag.h"
|
||||||
|
|
||||||
|
// Sphere entities should fit inside a cube entity of the same size, so a sphere that has dimensions 1x1x1
|
||||||
|
// is a half unit sphere. However, the geometry cache renders a UNIT sphere, so we need to scale down.
|
||||||
|
static const float SPHERE_ENTITY_SCALE = 0.5f;
|
||||||
|
|
||||||
|
|
||||||
EntityItemPointer RenderableSphereEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
EntityItemPointer RenderableSphereEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||||
return std::make_shared<RenderableSphereEntityItem>(entityID, properties);
|
return std::make_shared<RenderableSphereEntityItem>(entityID, properties);
|
||||||
}
|
}
|
||||||
|
@ -54,10 +59,10 @@ void RenderableSphereEntityItem::render(RenderArgs* args) {
|
||||||
gpu::Batch& batch = *args->_batch;
|
gpu::Batch& batch = *args->_batch;
|
||||||
glm::vec4 sphereColor(toGlm(getXColor()), getLocalRenderAlpha());
|
glm::vec4 sphereColor(toGlm(getXColor()), getLocalRenderAlpha());
|
||||||
Transform modelTransform = getTransformToCenter();
|
Transform modelTransform = getTransformToCenter();
|
||||||
modelTransform.postScale(0.5f);
|
modelTransform.postScale(SPHERE_ENTITY_SCALE);
|
||||||
if (_procedural->ready()) {
|
if (_procedural->ready()) {
|
||||||
batch.setModelTransform(modelTransform); // use a transform with scale, rotation, registration point and translation
|
batch.setModelTransform(modelTransform); // use a transform with scale, rotation, registration point and translation
|
||||||
_procedural->prepare(batch, getDimensions() / 2.0f);
|
_procedural->prepare(batch, getDimensions());
|
||||||
auto color = _procedural->getColor(sphereColor);
|
auto color = _procedural->getColor(sphereColor);
|
||||||
batch._glColor4f(color.r, color.g, color.b, color.a);
|
batch._glColor4f(color.r, color.g, color.b, color.a);
|
||||||
DependencyManager::get<GeometryCache>()->renderSphere(batch);
|
DependencyManager::get<GeometryCache>()->renderSphere(batch);
|
||||||
|
|
|
@ -197,10 +197,6 @@ bool Environment::findCapsulePenetration(const glm::vec3& start, const glm::vec3
|
||||||
}
|
}
|
||||||
|
|
||||||
void Environment::renderAtmosphere(gpu::Batch& batch, ViewFrustum& viewFrustum, const EnvironmentData& data) {
|
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;
|
|
||||||
|
|
||||||
glm::vec3 center = data.getAtmosphereCenter();
|
glm::vec3 center = data.getAtmosphereCenter();
|
||||||
|
|
||||||
// transform the model transform to the center of our atmosphere
|
// transform the model transform to the center of our atmosphere
|
||||||
|
|
Loading…
Reference in a new issue