Merge remote-tracking branch 'refs/remotes/origin/master' into culling
This commit is contained in:
@@ -34,7 +34,7 @@ namespace Ndk
|
||||
*
|
||||
* \remark Only one Application instance can exist at a time
|
||||
*/
|
||||
inline Application::Application(int argc, char* argv[]) :
|
||||
Application::Application(int argc, char* argv[]) :
|
||||
Application()
|
||||
{
|
||||
std::regex optionRegex(R"(-(\w+))");
|
||||
|
||||
@@ -35,6 +35,17 @@ namespace Ndk
|
||||
Nz::Renderer::SetViewport(m_viewport);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the aspect ratio of the camera
|
||||
* \return Aspect ratio of the camera
|
||||
*/
|
||||
float CameraComponent::GetAspectRatio() const
|
||||
{
|
||||
EnsureViewportUpdate();
|
||||
|
||||
return m_aspectRatio;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the eye position of the camera
|
||||
*
|
||||
@@ -53,7 +64,6 @@ namespace Ndk
|
||||
*
|
||||
* \remark Produces a NazaraAssert if entity is invalid or has no NodeComponent
|
||||
*/
|
||||
|
||||
Nz::Vector3f CameraComponent::GetForward() const
|
||||
{
|
||||
NazaraAssert(m_entity && m_entity->HasComponent<NodeComponent>(), "CameraComponent requires NodeComponent");
|
||||
@@ -61,6 +71,77 @@ namespace Ndk
|
||||
return m_entity->GetComponent<NodeComponent>().GetForward();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the frutum of the camera
|
||||
* \return A constant reference to the frustum of the camera
|
||||
*/
|
||||
const Nz::Frustumf& CameraComponent::GetFrustum() const
|
||||
{
|
||||
EnsureFrustumUpdate();
|
||||
|
||||
return m_frustum;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the projection matrix of the camera
|
||||
* \return A constant reference to the projection matrix of the camera
|
||||
*/
|
||||
const Nz::Matrix4f& CameraComponent::GetProjectionMatrix() const
|
||||
{
|
||||
EnsureProjectionMatrixUpdate();
|
||||
|
||||
return m_projectionMatrix;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the target of the camera
|
||||
* \return A constant reference to the render target of the camera
|
||||
*/
|
||||
const Nz::RenderTarget* CameraComponent::GetTarget() const
|
||||
{
|
||||
return m_target;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the view matrix of the camera
|
||||
* \return A constant reference to the view matrix of the camera
|
||||
*/
|
||||
const Nz::Matrix4f& CameraComponent::GetViewMatrix() const
|
||||
{
|
||||
EnsureViewMatrixUpdate();
|
||||
|
||||
return m_viewMatrix;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the view port of the camera
|
||||
* \return A constant reference to the view port of the camera
|
||||
*/
|
||||
const Nz::Recti& CameraComponent::GetViewport() const
|
||||
{
|
||||
EnsureViewportUpdate();
|
||||
|
||||
return m_viewport;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the Z far distance of the camera
|
||||
* \return Z far distance of the camera
|
||||
*/
|
||||
float CameraComponent::GetZFar() const
|
||||
{
|
||||
return m_zFar;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the Z near distance of the camera
|
||||
* \return Z near distance of the camera
|
||||
*/
|
||||
float CameraComponent::GetZNear() const
|
||||
{
|
||||
return m_zNear;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the layer of the camera in case of multiples fields
|
||||
*
|
||||
|
||||
@@ -167,8 +167,7 @@ namespace Ndk
|
||||
*
|
||||
* \param event Event to be takin into consideration by the console
|
||||
*/
|
||||
|
||||
void Console::SendEvent(Nz::WindowEvent event)
|
||||
void Console::SendEvent(const Nz::WindowEvent& event)
|
||||
{
|
||||
switch (event.type)
|
||||
{
|
||||
@@ -204,6 +203,9 @@ namespace Ndk
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,9 +78,10 @@ namespace Ndk
|
||||
});
|
||||
|
||||
/*********************************** Nz::SoundBuffer **********************************/
|
||||
soundBuffer.SetConstructor([] (Nz::LuaInstance& lua, Nz::SoundBufferRef* instance)
|
||||
soundBuffer.SetConstructor([] (Nz::LuaInstance& lua, Nz::SoundBufferRef* instance, std::size_t argumentCount)
|
||||
{
|
||||
NazaraUnused(lua);
|
||||
NazaraUnused(argumentCount);
|
||||
|
||||
Nz::PlacementNew(instance, Nz::SoundBuffer::New());
|
||||
return true;
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Ndk
|
||||
void LuaBinding::BindCore()
|
||||
{
|
||||
/*********************************** Nz::Clock **********************************/
|
||||
clockClass.SetConstructor([](Nz::LuaInstance& lua, Nz::Clock* clock)
|
||||
clockClass.SetConstructor([](Nz::LuaInstance& lua, Nz::Clock* clock, std::size_t argumentCount)
|
||||
{
|
||||
int argIndex = 1;
|
||||
Nz::Int64 startingValue = lua.Check<Nz::Int64>(&argIndex, 0);
|
||||
@@ -44,9 +44,9 @@ namespace Ndk
|
||||
});
|
||||
|
||||
/********************************* Nz::Directory ********************************/
|
||||
directoryClass.SetConstructor([](Nz::LuaInstance& lua, Nz::Directory* directory)
|
||||
directoryClass.SetConstructor([](Nz::LuaInstance& lua, Nz::Directory* directory, std::size_t argumentCount)
|
||||
{
|
||||
unsigned int argCount = std::min(lua.GetStackTop(), 1U);
|
||||
std::size_t argCount = std::min<std::size_t>(argumentCount, 1U);
|
||||
|
||||
int argIndex = 1;
|
||||
switch (argCount)
|
||||
@@ -138,9 +138,9 @@ namespace Ndk
|
||||
/*********************************** Nz::File ***********************************/
|
||||
fileClass.Inherit(streamClass);
|
||||
|
||||
fileClass.SetConstructor([](Nz::LuaInstance& lua, Nz::File* file)
|
||||
fileClass.SetConstructor([] (Nz::LuaInstance& lua, Nz::File* file, std::size_t argumentCount)
|
||||
{
|
||||
unsigned int argCount = std::min(lua.GetStackTop(), 2U);
|
||||
std::size_t argCount = std::min<std::size_t>(argumentCount, 1U);
|
||||
|
||||
int argIndex = 1;
|
||||
switch (argCount)
|
||||
|
||||
@@ -20,8 +20,10 @@ namespace Ndk
|
||||
return reinterpret_cast<Nz::InstancedRenderableRef*>(model); //TODO: Make a ObjectRefCast
|
||||
});
|
||||
|
||||
modelClass.SetConstructor([] (Nz::LuaInstance& lua, Nz::ModelRef* model)
|
||||
modelClass.SetConstructor([] (Nz::LuaInstance& lua, Nz::ModelRef* model, std::size_t argumentCount)
|
||||
{
|
||||
NazaraUnused(argumentCount);
|
||||
|
||||
Nz::PlacementNew(model, Nz::Model::New());
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -14,9 +14,10 @@ namespace Ndk
|
||||
void LuaBinding::BindMath()
|
||||
{
|
||||
/*********************************** Nz::EulerAngles **********************************/
|
||||
eulerAnglesClass.SetConstructor([] (Nz::LuaInstance& lua, Nz::EulerAnglesd* angles)
|
||||
eulerAnglesClass.SetConstructor([] (Nz::LuaInstance& lua, Nz::EulerAnglesd* angles, std::size_t argumentCount)
|
||||
{
|
||||
unsigned int argCount = std::min(lua.GetStackTop(), 3U);
|
||||
std::size_t argCount = std::min<std::size_t>(argumentCount, 1U);
|
||||
|
||||
switch (argCount)
|
||||
{
|
||||
case 0:
|
||||
@@ -154,9 +155,10 @@ namespace Ndk
|
||||
});
|
||||
|
||||
/*********************************** Nz::Rect **********************************/
|
||||
rectClass.SetConstructor([] (Nz::LuaInstance& lua, Nz::Rectd* rect)
|
||||
rectClass.SetConstructor([] (Nz::LuaInstance& lua, Nz::Rectd* rect, std::size_t argumentCount)
|
||||
{
|
||||
unsigned int argCount = std::min(lua.GetStackTop(), 4U);
|
||||
std::size_t argCount = std::min<std::size_t>(argumentCount, 4U);
|
||||
|
||||
switch (argCount)
|
||||
{
|
||||
case 0:
|
||||
@@ -309,9 +311,10 @@ namespace Ndk
|
||||
});
|
||||
|
||||
/*********************************** Nz::Quaternion **********************************/
|
||||
quaternionClass.SetConstructor([] (Nz::LuaInstance& lua, Nz::Quaterniond* quaternion)
|
||||
quaternionClass.SetConstructor([] (Nz::LuaInstance& lua, Nz::Quaterniond* quaternion, std::size_t argumentCount)
|
||||
{
|
||||
unsigned int argCount = std::min(lua.GetStackTop(), 4U);
|
||||
std::size_t argCount = std::min<std::size_t>(argumentCount, 4U);
|
||||
|
||||
switch (argCount)
|
||||
{
|
||||
case 0:
|
||||
@@ -337,6 +340,9 @@ namespace Ndk
|
||||
case 4:
|
||||
Nz::PlacementNew(quaternion, lua.CheckNumber(1), lua.CheckNumber(2), lua.CheckNumber(3), lua.CheckNumber(4));
|
||||
return true;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
lua.Error("No matching overload for Quaternion constructor");
|
||||
@@ -411,9 +417,10 @@ namespace Ndk
|
||||
});
|
||||
|
||||
/*********************************** Nz::Vector2 **********************************/
|
||||
vector2dClass.SetConstructor([](Nz::LuaInstance& lua, Nz::Vector2d* vector)
|
||||
vector2dClass.SetConstructor([] (Nz::LuaInstance& lua, Nz::Vector2d* vector, std::size_t argumentCount)
|
||||
{
|
||||
unsigned int argCount = std::min(lua.GetStackTop(), 2U);
|
||||
std::size_t argCount = std::min<std::size_t>(argumentCount, 2U);
|
||||
|
||||
switch (argCount)
|
||||
{
|
||||
case 0:
|
||||
@@ -533,9 +540,10 @@ namespace Ndk
|
||||
});
|
||||
|
||||
/*********************************** Nz::Vector3 **********************************/
|
||||
vector3dClass.SetConstructor([] (Nz::LuaInstance& lua, Nz::Vector3d* vector)
|
||||
vector3dClass.SetConstructor([] (Nz::LuaInstance& lua, Nz::Vector3d* vector, std::size_t argumentCount)
|
||||
{
|
||||
unsigned int argCount = std::min(lua.GetStackTop(), 3U);
|
||||
std::size_t argCount = std::min<std::size_t>(argumentCount, 3U);
|
||||
|
||||
switch (argCount)
|
||||
{
|
||||
case 0:
|
||||
@@ -546,7 +554,7 @@ namespace Ndk
|
||||
case 1:
|
||||
{
|
||||
if (lua.IsOfType(1, Nz::LuaType_Number))
|
||||
Nz::PlacementNew(vector, lua.CheckNumber(1), *static_cast<Nz::Vector2d*>(lua.CheckUserdata(1, "Vector2")));
|
||||
Nz::PlacementNew(vector, lua.CheckNumber(1));
|
||||
else if (lua.IsOfType(1, "Vector2"))
|
||||
Nz::PlacementNew(vector, *static_cast<Nz::Vector2d*>(lua.ToUserdata(1)));
|
||||
else if (lua.IsOfType(1, "Vector3"))
|
||||
@@ -560,7 +568,7 @@ namespace Ndk
|
||||
case 2:
|
||||
{
|
||||
if (lua.IsOfType(1, Nz::LuaType_Number))
|
||||
Nz::PlacementNew(vector, lua.CheckNumber(1), *static_cast<Nz::Vector2d*>(lua.CheckUserdata(1, "Vector2")));
|
||||
Nz::PlacementNew(vector, lua.CheckNumber(1), *static_cast<Nz::Vector2d*>(lua.CheckUserdata(2, "Vector2")));
|
||||
else if (lua.IsOfType(1, "Vector2"))
|
||||
Nz::PlacementNew(vector, *static_cast<Nz::Vector2d*>(lua.ToUserdata(1)), lua.CheckNumber(2));
|
||||
else
|
||||
|
||||
@@ -21,9 +21,9 @@ namespace Ndk
|
||||
abstractSocketClass.BindMethod("QueryAvailableBytes", &Nz::AbstractSocket::QueryAvailableBytes);
|
||||
|
||||
/*********************************** Nz::IpAddress **********************************/
|
||||
ipAddressClass.SetConstructor([] (Nz::LuaInstance& lua, Nz::IpAddress* address)
|
||||
ipAddressClass.SetConstructor([] (Nz::LuaInstance& lua, Nz::IpAddress* address, std::size_t argumentCount)
|
||||
{
|
||||
unsigned int argCount = std::min(lua.GetStackTop(), 9U);
|
||||
std::size_t argCount = std::min<std::size_t>(argumentCount, 9U);
|
||||
|
||||
int argIndex = 1;
|
||||
switch (argCount)
|
||||
|
||||
@@ -233,6 +233,9 @@ namespace Ndk
|
||||
|
||||
return &m_componentBinding[it->second];
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
instance.Error("Invalid component index at #" + Nz::String::Number(argIndex));
|
||||
|
||||
@@ -93,8 +93,10 @@ namespace Ndk
|
||||
});
|
||||
|
||||
/*********************************** Nz::Font **********************************/
|
||||
fontClass.SetConstructor([] (Nz::LuaInstance& lua, Nz::FontRef* font)
|
||||
fontClass.SetConstructor([] (Nz::LuaInstance& lua, Nz::FontRef* font, std::size_t argumentCount)
|
||||
{
|
||||
NazaraUnused(argumentCount);
|
||||
|
||||
Nz::PlacementNew(font, Nz::Font::New());
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -59,6 +59,13 @@ namespace Ndk
|
||||
// Initialize the engine first
|
||||
|
||||
// Shared modules
|
||||
#ifdef NDK_SERVER
|
||||
Nz::ParameterList parameters;
|
||||
parameters.SetParameter("NoWindowSystem", true);
|
||||
|
||||
Nz::Utility::SetParameters(parameters);
|
||||
#endif
|
||||
|
||||
Nz::Lua::Initialize();
|
||||
Nz::Noise::Initialize();
|
||||
Nz::Physics::Initialize();
|
||||
|
||||
@@ -216,6 +216,13 @@ namespace Ndk
|
||||
m_forceRenderQueueInvalidation = false;
|
||||
}
|
||||
|
||||
for (const Ndk::EntityHandle& particleGroup : m_particleGroups)
|
||||
{
|
||||
ParticleGroupComponent& groupComponent = particleGroup->GetComponent<ParticleGroupComponent>();
|
||||
|
||||
groupComponent.AddToRenderQueue(renderQueue, Nz::Matrix4f::Identity()); //< ParticleGroup doesn't use Matrix4f
|
||||
}
|
||||
|
||||
camComponent.ApplyView();
|
||||
|
||||
Nz::SceneData sceneData;
|
||||
|
||||
Reference in New Issue
Block a user