mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-15 20:08:54 +03:00
Fixed rendering error when disabling volumetric
This commit is contained in:
@@ -155,5 +155,5 @@ void main()
|
||||
float L = escape(O, D, AtmosphereRadius);
|
||||
col = scatter(O, D, L, col);
|
||||
|
||||
FragColor = vec4(sqrt(col), 1.);
|
||||
FragColor = vec4(sqrt(col * 4.0), 1.);
|
||||
}
|
||||
@@ -63,8 +63,8 @@ vec3 ComputeVolumetric(vec3 FragPos, Light light)
|
||||
vec3 rayVector = FragPos - startPosition; // Ray Direction
|
||||
|
||||
float rayLength = length(rayVector); // Length of the raymarched
|
||||
if(rayLength > 1000.0)
|
||||
return vec3(1.0, 1.0, 1.0);
|
||||
//if(rayLength > 1000.0)
|
||||
// return vec3(0.0, 0.0, 0.0);
|
||||
float stepLength = rayLength / u_StepCount; // Step length
|
||||
vec3 rayDirection = rayVector / rayLength;
|
||||
vec3 step = rayDirection * stepLength; // Normalized to step length direction
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Nuake
|
||||
_soloud = CreateRef<SoLoud::Soloud>();
|
||||
_soloud->init();
|
||||
|
||||
_audioThreadRunning = true;
|
||||
_audioThreadRunning = false;
|
||||
_audioThread = std::thread(&AudioManager::AudioThreadLoop, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace Nuake
|
||||
// See: ContactListener
|
||||
virtual JPH::ValidateResult OnContactValidate(const JPH::Body& inBody1, const JPH::Body& inBody2, const JPH::CollideShapeResult& inCollisionResult) override
|
||||
{
|
||||
std::cout << "Contact validate callback" << std::endl;
|
||||
//std::cout << "Contact validate callback" << std::endl;
|
||||
|
||||
// Allows you to ignore a contact before it is created (using layers to not make objects collide is cheaper!)
|
||||
return JPH::ValidateResult::AcceptAllContactsForThisBodyPair;
|
||||
@@ -166,17 +166,17 @@ namespace Nuake
|
||||
|
||||
virtual void OnContactAdded(const JPH::Body& inBody1, const JPH::Body& inBody2, const JPH::ContactManifold& inManifold, JPH::ContactSettings& ioSettings) override
|
||||
{
|
||||
std::cout << "A contact was added" << std::endl;
|
||||
//std::cout << "A contact was added" << std::endl;
|
||||
}
|
||||
|
||||
virtual void OnContactPersisted(const JPH::Body& inBody1, const JPH::Body& inBody2, const JPH::ContactManifold& inManifold, JPH::ContactSettings& ioSettings) override
|
||||
{
|
||||
std::cout << "A contact was persisted" << std::endl;
|
||||
//std::cout << "A contact was persisted" << std::endl;
|
||||
}
|
||||
|
||||
virtual void OnContactRemoved(const JPH::SubShapeIDPair& inSubShapePair) override
|
||||
{
|
||||
std::cout << "A contact was removed" << std::endl;
|
||||
//std::cout << "A contact was removed" << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -282,10 +282,11 @@ namespace Nuake
|
||||
void DynamicWorld::AddCharacterController(Ref<CharacterController> cc)
|
||||
{
|
||||
JPH::Ref<JPH::CharacterSettings> settings = new JPH::CharacterSettings();
|
||||
settings->mMaxSlopeAngle = JPH::DegreesToRadians(45.0f);
|
||||
settings->mMaxSlopeAngle = JPH::DegreesToRadians(cc->MaxSlopeAngle);
|
||||
settings->mLayer = Layers::MOVING;
|
||||
settings->mFriction = 0.5f;
|
||||
settings->mFriction = cc->Friction;
|
||||
settings->mShape = GetJoltShape(cc->Shape);
|
||||
settings->mGravityFactor = 0.0f;
|
||||
|
||||
auto& joltPos = JPH::Vec3(cc->Position.x, cc->Position.y, cc->Position.z);
|
||||
JPH::Character* character = new JPH::Character(settings, joltPos, JPH::Quat::sIdentity(), cc->GetEntity().GetID() , _JoltPhysicsSystem.get());
|
||||
@@ -419,6 +420,17 @@ namespace Nuake
|
||||
|
||||
_JoltBodyInterface->RemoveBodies(reinterpret_cast<JPH::BodyID*>(_registeredBodies.data()), _registeredBodies.size());
|
||||
_registeredBodies.clear();
|
||||
|
||||
if (_registeredCharacters.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto& character : _registeredCharacters)
|
||||
{
|
||||
character.second->RemoveFromPhysicsSystem();
|
||||
}
|
||||
_registeredCharacters.clear();
|
||||
}
|
||||
|
||||
void DynamicWorld::MoveAndSlideCharacterController(const Entity& entity, const Vector3 velocity)
|
||||
|
||||
@@ -23,13 +23,13 @@ namespace Nuake
|
||||
class Box : public PhysicShape
|
||||
{
|
||||
private:
|
||||
glm::vec3 Size;
|
||||
Vector3 Size;
|
||||
public:
|
||||
Box();
|
||||
Box(glm::vec3 size);
|
||||
Box(float x, float y, float z);
|
||||
|
||||
glm::vec3 GetSize() const { return Size; }
|
||||
Vector3 GetSize() const { return Size; }
|
||||
};
|
||||
|
||||
class Sphere : public PhysicShape
|
||||
|
||||
@@ -93,6 +93,18 @@ namespace Nuake {
|
||||
}
|
||||
framebuffer.Unbind();
|
||||
}
|
||||
else
|
||||
{
|
||||
framebuffer.Bind();
|
||||
{
|
||||
RenderCommand::Clear();
|
||||
Shader* shader = ShaderManager::GetShader("resources/Shaders/copy.shader");
|
||||
shader->Bind();
|
||||
|
||||
shader->SetUniformTex("u_Source", finalOutput.get(), 0);
|
||||
Renderer::DrawQuad();
|
||||
}
|
||||
}
|
||||
|
||||
finalOutput = framebuffer.GetTexture();
|
||||
|
||||
|
||||
@@ -91,8 +91,10 @@ namespace Nuake {
|
||||
{
|
||||
for (auto& system : m_Systems)
|
||||
{
|
||||
Logger::Log("Init system");
|
||||
if (!system->Init())
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,6 +211,7 @@ namespace Nuake
|
||||
auto [transform, rigidBodyComponent] = view.get<TransformComponent, RigidBodyComponent>(e);
|
||||
Entity ent = Entity({ e, m_Scene });
|
||||
Ref<Physics::RigidBody> rigidBody;
|
||||
|
||||
if (ent.HasComponent<BoxColliderComponent>())
|
||||
{
|
||||
float mass = rigidBodyComponent.Mass;
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace Nuake {
|
||||
|
||||
void WrenScript::CallExit()
|
||||
{
|
||||
if (!CompiledSuccesfully)
|
||||
if (!CompiledSuccesfully || !m_Instance)
|
||||
return;
|
||||
|
||||
WrenVM* vm = ScriptingEngine::GetWrenVM();
|
||||
|
||||
Reference in New Issue
Block a user