diff --git a/include/lug/Graphics/Render/Light.hpp b/include/lug/Graphics/Render/Light.hpp index 0f9998d3..4ddbd5b5 100644 --- a/include/lug/Graphics/Render/Light.hpp +++ b/include/lug/Graphics/Render/Light.hpp @@ -59,13 +59,6 @@ class LUG_GRAPHICS_API Light : public Resource, public DirtyObject { ~Light() = default; - /** - * @brief Gets the light type. - * - * @return The light type. - */ - Type getType() const; - void setType(Type type); void setColor(const Math::Vec4f& color); void setDirection(const Math::Vec3f& direction); @@ -76,7 +69,21 @@ class LUG_GRAPHICS_API Light : public Resource, public DirtyObject { void setFalloffAngle(float falloffAngle); void setFalloffExponent(float falloffExponent); + /** + * @brief Gets the light type. + * + * @return The light type. + */ + Type getType() const; + + const Math::Vec4f& getColor() const; + const Math::Vec3f& getDirection() const; + float getConstantAttenuation() const; float getDistance() const; + float getLinearAttenuation() const; + float getQuadraticAttenuation() const; + float getFalloffAngle() const; + float getFalloffExponent() const; void getData(Light::Data& lightData, Scene::Node& node); diff --git a/include/lug/Graphics/Render/Light.inl b/include/lug/Graphics/Render/Light.inl index 4cb5e29a..3abab6e1 100644 --- a/include/lug/Graphics/Render/Light.inl +++ b/include/lug/Graphics/Render/Light.inl @@ -1,7 +1,3 @@ -inline Light::Type Light::getType() const { - return _type; -} - inline void Light::setType(Type type) { ::lug::Graphics::Render::DirtyObject::setDirty(); _type = type; @@ -47,6 +43,38 @@ inline void Light::setFalloffExponent(float falloffExponent) { _falloffExponent = falloffExponent; } +inline Light::Type Light::getType() const { + return _type; +} + +inline const Math::Vec4f& Light::getColor() const { + return _color; +} + +inline const Math::Vec3f& Light::getDirection() const { + return _direction; +} + +inline float Light::getConstantAttenuation() const { + return _constantAttenuation; +} + inline float Light::getDistance() const { return _distance; } + +inline float Light::getLinearAttenuation() const { + return _linearAttenuation; +} + +inline float Light::getQuadraticAttenuation() const { + return _quadraticAttenuation; +} + +inline float Light::getFalloffAngle() const { + return _falloffAngle; +} + +inline float Light::getFalloffExponent() const { + return _falloffExponent; +} diff --git a/resources/shaders/forward/shader.frag b/resources/shaders/forward/shader.frag index 83d2916c..28756c01 100644 --- a/resources/shaders/forward/shader.frag +++ b/resources/shaders/forward/shader.frag @@ -277,7 +277,7 @@ void main() { // cook-torrance brdf const float NDF = DistributionGGX(NdotH, roughness); // Normal distribution (Distribution of the microfacets) const float G = GeometrySchlickGGX(NdotV, NdotL, roughness); // Geometric shadowing term (Microfacets shadowing) - const vec3 F = fresnelSchlick(NdotV, F0); // Fresnel factor (Reflectance depending on angle of incidence) + const vec3 F = fresnelSchlick(NdotH, F0); // Fresnel factor (Reflectance depending on angle of incidence) const vec3 kD = (vec3(1.0) - F) * (1.0 - metallic); diff --git a/src/lug/Core/FreeMovement.cpp b/src/lug/Core/FreeMovement.cpp index d4a1b1be..8039cdb9 100644 --- a/src/lug/Core/FreeMovement.cpp +++ b/src/lug/Core/FreeMovement.cpp @@ -39,7 +39,7 @@ void FreeMovement::onFrame(const System::Time& elapsedTime) { // Capture / Release the mouse cursor - if (_eventSource->isMousePressed(lug::Window::Mouse::Button::Left) && !_hasFocus) { + if (_eventSource->isKeyPressed(lug::Window::Keyboard::Key::C) && !_hasFocus) { _lastMousePos = _eventSource->getMousePos(); _hasFocus = true; _eventSource->setMouseCursorVisible(false); diff --git a/src/lug/Graphics/GltfLoader.cpp b/src/lug/Graphics/GltfLoader.cpp index 3bd83b58..c96270ff 100644 --- a/src/lug/Graphics/GltfLoader.cpp +++ b/src/lug/Graphics/GltfLoader.cpp @@ -379,6 +379,25 @@ static bool createNode(Renderer& renderer, const gltf2::Asset& asset, const gltf node->attachMeshInstance(mesh); } + node->setPosition({ + gltfNode.translation[0], + gltfNode.translation[1], + gltfNode.translation[2] + }, Node::TransformSpace::Parent); + + node->setRotation(Math::Quatf{ + gltfNode.rotation[3], + gltfNode.rotation[0], + gltfNode.rotation[1], + gltfNode.rotation[2] + }, Node::TransformSpace::Parent); + + node->scale({ + gltfNode.scale[0], + gltfNode.scale[1], + gltfNode.scale[2] + }); + for (uint32_t nodeIdx : gltfNode.children) { const gltf2::Node& childrenGltfNode = asset.nodes[nodeIdx]; if (!createNode(renderer, asset, childrenGltfNode, *node)) { diff --git a/thirdparty.yml b/thirdparty.yml index bd561b5d..c8e4fc2c 100644 --- a/thirdparty.yml +++ b/thirdparty.yml @@ -16,7 +16,7 @@ googlemock: gltf2-loader: repository: - tag: c007c437cb435d44506669b8959c7f1682ef2c16 + tag: 5c736d11b9c324d85ae44b03479274c33cff37ed imgui: repository: