fixed odd regression where door collision broke (and trying to fix the weird flickering with using the aliased camera UBO for the deferred pass)
This commit is contained in:
parent
07f2a7d17b
commit
142f584684
@ -117,9 +117,9 @@
|
||||
"pipelines": {
|
||||
"deferred": true,
|
||||
"gui": true,
|
||||
"vsync": true, // vsync on vulkan side rather than engine-side
|
||||
"vsync": false, // vsync on vulkan side rather than engine-side
|
||||
"hdr": true,
|
||||
"vxgi": true, // to-do: fix issues
|
||||
"vxgi": false, // to-do: fix issues
|
||||
"culling": false,
|
||||
"bloom": true,
|
||||
"dof": false,
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
[ 0, 0, 0, 0 ]
|
||||
],
|
||||
"shader": {
|
||||
"mode": 10,
|
||||
"mode": 0,
|
||||
"scalar": 16,
|
||||
"parameters": [ 0, 0, 0, "time" ]
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
// enable if shaderNonUniform is not supported
|
||||
// Nvidia hardware does not require nonuniformEXT, but AMD does
|
||||
#endif
|
||||
|
||||
// implicit variables
|
||||
#ifndef MULTISAMPLING
|
||||
#define MULTISAMPLING 1
|
||||
@ -20,8 +19,11 @@
|
||||
#ifndef MAX_SHADOWS
|
||||
#define MAX_SHADOWS ubo.settings.lighting.maxShadows
|
||||
#endif
|
||||
#ifndef USE_CAMERA_VIEWPORT
|
||||
#define USE_CAMERA_VIEWPORT 0
|
||||
#endif
|
||||
#ifndef VIEW_MATRIX
|
||||
#if VXGI
|
||||
#if VXGI || !USE_CAMERA_VIEWPORT
|
||||
#define VIEW_MATRIX ubo.eyes[surface.pass].view
|
||||
#else
|
||||
#define VIEW_MATRIX camera.viewport[surface.pass].view
|
||||
@ -80,7 +82,7 @@
|
||||
#endif
|
||||
#if BARYCENTRIC
|
||||
#ifndef BARYCENTRIC_CALCULATE
|
||||
#define BARYCENTRIC_CALCULATE 1
|
||||
#define BARYCENTRIC_CALCULATE 0
|
||||
#endif
|
||||
#ifndef BUFFER_REFERENCE
|
||||
#define BUFFER_REFERENCE 1
|
||||
|
||||
@ -199,10 +199,15 @@ void populateSurface() {
|
||||
{
|
||||
vec2 inUv = (vec2(gl_GlobalInvocationID.xy) / vec2(renderSize)) * 2.0f - 1.0f;
|
||||
|
||||
#if USE_CAMERA_VIEWPORT
|
||||
const mat4 iProjection = inverse( camera.viewport[surface.pass].projection );
|
||||
const mat4 iView = inverse( camera.viewport[surface.pass].view );
|
||||
const mat4 iProjectionView = inverse( camera.viewport[surface.pass].projection * mat4(mat3(camera.viewport[surface.pass].view)) );
|
||||
|
||||
const mat4 iProjectionView = /*iProjection * iView;*/ inverse( camera.viewport[surface.pass].projection * mat4(mat3(camera.viewport[surface.pass].view)) );
|
||||
#else
|
||||
const mat4 iView = ubo.eyes[surface.pass].iView;
|
||||
const mat4 iProjection = ubo.eyes[surface.pass].iProjection;
|
||||
const mat4 iProjectionView = /*iProjection * iView;*/ inverse( ubo.eyes[surface.pass].projection * mat4(mat3(ubo.eyes[surface.pass].view)) );
|
||||
#endif
|
||||
const vec4 near4 = iProjectionView * (vec4(inUv, -1.0, 1.0));
|
||||
const vec4 far4 = iProjectionView * (vec4(inUv, 1.0, 1.0));
|
||||
const vec3 near3 = near4.xyz / near4.w;
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
#if BARYCENTRIC
|
||||
// 0 keeps a buffer for barycentric coordinates, 1 will reconstruct in the deferred pass
|
||||
#ifndef BARYCENTRIC_CALCULATE
|
||||
#define BARYCENTRIC_CALCULATE 1
|
||||
#define BARYCENTRIC_CALCULATE 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@ -1,64 +0,0 @@
|
||||
#if UF_USE_UNUSED
|
||||
#include <uf/utils/math/collision.h>
|
||||
#include <uf/utils/math/collision/gjk.h>
|
||||
#include <uf/utils/math/collision/boundingbox.h>
|
||||
#include <uf/utils/math/collision/sphere.h>
|
||||
#include <uf/utils/math/collision/mesh.h>
|
||||
#include <uf/utils/math/collision/modular.h>
|
||||
#include <iostream>
|
||||
|
||||
uf::Collider::~Collider() {
|
||||
this->clear();
|
||||
}
|
||||
void uf::Collider::clear() {
|
||||
for ( pod::Collider* pointer : this->m_container ) delete pointer;
|
||||
this->m_container.clear();
|
||||
}
|
||||
|
||||
void uf::Collider::add( pod::Collider* pointer ) {
|
||||
this->m_container.push_back(pointer);
|
||||
}
|
||||
uf::Collider::container_t& uf::Collider::getContainer() {
|
||||
return this->m_container;
|
||||
}
|
||||
const uf::Collider::container_t& uf::Collider::getContainer() const {
|
||||
return this->m_container;
|
||||
}
|
||||
|
||||
std::size_t uf::Collider::getSize() const {
|
||||
return this->m_container.size();
|
||||
}
|
||||
|
||||
uf::stl::vector<pod::Collider::Manifold> uf::Collider::intersects( const uf::Collider& body, bool smart ) const {
|
||||
uf::stl::vector<pod::Collider::Manifold> manifolds;
|
||||
manifolds.reserve( this->m_container.size() * body.m_container.size() );
|
||||
for ( const pod::Collider* pointer : body.m_container ) {
|
||||
uf::stl::vector<pod::Collider::Manifold> result = this->intersects( *pointer, smart );
|
||||
manifolds.insert( manifolds.end(), result.begin(), result.end() );
|
||||
}
|
||||
return manifolds;
|
||||
}
|
||||
|
||||
uf::stl::vector<pod::Collider::Manifold> uf::Collider::intersects( const pod::Collider& body, bool smart ) const {
|
||||
// smart = false;
|
||||
uf::stl::vector<pod::Collider::Manifold> manifolds;
|
||||
for ( const pod::Collider* pointer : this->m_container ) {
|
||||
pod::Collider::Manifold& manifold = manifolds.emplace_back();
|
||||
if ( !pointer ) continue;
|
||||
if ( smart && pointer->type() == body.type() ) {
|
||||
if ( pointer->type() == "BoundingBox" ) {
|
||||
const uf::BoundingBox& a = *((const uf::BoundingBox*) pointer);
|
||||
const uf::BoundingBox& b = *((const uf::BoundingBox*) &body);
|
||||
manifold = a.intersects(b);
|
||||
} else if ( pointer->type() == "Sphere" ) {
|
||||
const uf::SphereCollider& a = *((const uf::SphereCollider*) pointer);
|
||||
const uf::SphereCollider& b = *((const uf::SphereCollider*) &body);
|
||||
manifold = a.intersects(b);
|
||||
}
|
||||
else
|
||||
manifold = pointer->intersects( body );
|
||||
} else manifold = pointer->intersects( body );
|
||||
}
|
||||
return manifolds;
|
||||
}
|
||||
#endif
|
||||
@ -1,5 +1,14 @@
|
||||
#include <uf/utils/math/physics/common.h>
|
||||
|
||||
namespace impl {
|
||||
void updateStaticBody( pod::PhysicsBody& body ) {
|
||||
if ( !body.isStatic ) return;
|
||||
|
||||
body.bounds = impl::computeAABB( body );
|
||||
if ( body.world ) body.world->staticBvh.dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
// create ID from pointers
|
||||
uint64_t impl::makePairKey( const pod::PhysicsBody& a, const pod::PhysicsBody& b ) {
|
||||
uint64_t lhs = reinterpret_cast<uint64_t>(&a);
|
||||
@ -19,6 +28,7 @@ void impl::wakeBody( pod::PhysicsBody& body ) {
|
||||
}
|
||||
|
||||
body.activity.awake = true;
|
||||
if ( body.isStatic ) impl::updateStaticBody( body );
|
||||
}
|
||||
void impl::sleepBody( pod::PhysicsBody& body ) {
|
||||
bool wasAsleep = !body.activity.awake;
|
||||
@ -718,11 +728,13 @@ pod::AABB impl::computeAABB( const pod::PhysicsBody& body ) {
|
||||
const auto transform = impl::getTransform( body );
|
||||
switch ( body.collider.type ) {
|
||||
case pod::ShapeType::AABB: {
|
||||
// return impl::transformAabbToWorld( body.collider.aabb, *body.transform );
|
||||
return impl::transformAabbToWorld( body.collider.aabb, *body.transform );
|
||||
/*
|
||||
return {
|
||||
transform.position + body.collider.aabb.min,
|
||||
transform.position + body.collider.aabb.max,
|
||||
};
|
||||
*/
|
||||
} break;
|
||||
case pod::ShapeType::SPHERE: {
|
||||
return {
|
||||
@ -737,10 +749,7 @@ pod::AABB impl::computeAABB( const pod::PhysicsBody& body ) {
|
||||
case pod::ShapeType::MESH:
|
||||
case pod::ShapeType::CONVEX_HULL: {
|
||||
if ( body.collider.mesh.bvh && !body.collider.mesh.bvh->bounds.empty() )
|
||||
return {
|
||||
transform.position + body.collider.mesh.bvh->bounds[0].min,
|
||||
transform.position + body.collider.mesh.bvh->bounds[0].max,
|
||||
};
|
||||
return impl::transformAabbToWorld( body.collider.mesh.bvh->bounds[0], *body.transform );
|
||||
const auto& meshData = *body.collider.mesh.mesh;
|
||||
pod::AABB bounds = { { FLT_MAX, FLT_MAX, FLT_MAX }, { -FLT_MAX, -FLT_MAX, -FLT_MAX } };
|
||||
for ( const auto& view : meshData.buffer_views ) impl::computeConvexHullAABB( view, view["position"], bounds );
|
||||
|
||||
Loading…
Reference in New Issue
Block a user