Fixed last commit
Yep, forgot to test it :D It should be okay now Former-commit-id: 3392523240affb4151f5121decb0e458500878a3
This commit is contained in:
parent
34dbd19385
commit
2c7744af41
|
|
@ -1,14 +1,14 @@
|
|||
// Cette démo suppose que vous avez déjà lu les commentaires de "FirstScene"
|
||||
|
||||
#include <Nazara/3D.hpp>
|
||||
#include <Nazara/Core/Clock.hpp>
|
||||
#include <Nazara/Graphics.hpp>
|
||||
#include <Nazara/Renderer.hpp>
|
||||
#include <Nazara/Utility.hpp>
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
NzInitializer<Nz3D> nazara;
|
||||
NzInitializer<NzGraphics> nazara;
|
||||
if (!nazara)
|
||||
{
|
||||
std::cout << "Failed to initialize Nazara, see NazaraLog.log for further informations" << std::endl;
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
#include <Nazara/3D.hpp> // Module 3D
|
||||
#include <Nazara/Core/Clock.hpp> // Horloges
|
||||
#include <Nazara/Graphics.hpp> // Module Graphique
|
||||
#include <Nazara/Renderer.hpp> // Module de rendu
|
||||
#include <Nazara/Utility.hpp> // Module utilitaire
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
// Pour commencer, nous initialisons le module 3D, celui-ci va provoquer l'initialisation (dans l'ordre),
|
||||
// du noyau (Core), Utility, Renderer, 2D.
|
||||
// Pour commencer, nous initialisons le module Graphique, celui-ci va provoquer l'initialisation (dans l'ordre),
|
||||
// du noyau (Core), Utility, Renderer.
|
||||
// NzInitializer est une classe RAII appelant Initialize dans son constructeur et Uninitialize dans son destructeur.
|
||||
// Autrement dit, une fois ceci fait nous n'avons plus à nous soucier de la libération du moteur.
|
||||
NzInitializer<Nz3D> nazara;
|
||||
NzInitializer<NzGraphics> nazara;
|
||||
if (!nazara)
|
||||
{
|
||||
// Une erreur s'est produite dans l'initialisation d'un des modules
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
// This file was automatically generated on 13 Mar 2013 at 23:20:31
|
||||
|
||||
/*
|
||||
Nazara Engine - 3D module
|
||||
|
||||
Copyright (C) 2013 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_GLOBAL_3D_HPP
|
||||
#define NAZARA_GLOBAL_3D_HPP
|
||||
|
||||
#include <Nazara/3D/3D.hpp>
|
||||
#include <Nazara/3D/Camera.hpp>
|
||||
#include <Nazara/3D/Config.hpp>
|
||||
#include <Nazara/3D/Enums.hpp>
|
||||
#include <Nazara/3D/Light.hpp>
|
||||
#include <Nazara/3D/Model.hpp>
|
||||
#include <Nazara/3D/RenderQueue.hpp>
|
||||
#include <Nazara/3D/Scene.hpp>
|
||||
#include <Nazara/3D/SceneNode.hpp>
|
||||
#include <Nazara/3D/SceneRoot.hpp>
|
||||
|
||||
#endif // NAZARA_GLOBAL_3D_HPP
|
||||
|
|
@ -29,13 +29,13 @@
|
|||
#ifndef NAZARA_GLOBAL_GRAPHICS_HPP
|
||||
#define NAZARA_GLOBAL_GRAPHICS_HPP
|
||||
|
||||
#include <Nazara/Graphics/3D.hpp>
|
||||
#include <Nazara/Graphics/Background.hpp>
|
||||
#include <Nazara/Graphics/Camera.hpp>
|
||||
#include <Nazara/Graphics/ColorBackground.hpp>
|
||||
#include <Nazara/Graphics/Config.hpp>
|
||||
#include <Nazara/Graphics/Drawable.hpp>
|
||||
#include <Nazara/Graphics/Enums.hpp>
|
||||
#include <Nazara/Graphics/Graphics.hpp>
|
||||
#include <Nazara/Graphics/Light.hpp>
|
||||
#include <Nazara/Graphics/Model.hpp>
|
||||
#include <Nazara/Graphics/RenderQueue.hpp>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#define NAZARA_CAMERA_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/3D/SceneNode.hpp>
|
||||
#include <Nazara/Graphics/SceneNode.hpp>
|
||||
#include <Nazara/Math/Frustum.hpp>
|
||||
#include <Nazara/Math/Matrix4.hpp>
|
||||
#include <Nazara/Math/Rect.hpp>
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ enum nzImageType
|
|||
enum nzNodeType
|
||||
{
|
||||
nzNodeType_Default, // NzNode
|
||||
nzNodeType_Scene, // NzSceneNode (3D)
|
||||
nzNodeType_Scene, // NzSceneNode (Graphics)
|
||||
nzNodeType_Skeletal, ///TODO
|
||||
|
||||
nzNodeType_Max = nzNodeType_Skeletal
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ NzCamera::~NzCamera() = default;
|
|||
|
||||
void NzCamera::Activate() const
|
||||
{
|
||||
#ifdef NAZARA_3D_SAFE
|
||||
#ifdef NAZARA_GRAPHICS_SAFE
|
||||
if (!m_target)
|
||||
{
|
||||
NazaraError("No render target !");
|
||||
|
|
|
|||
|
|
@ -3,15 +3,15 @@
|
|||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Graphics/Graphics.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/Log.hpp>
|
||||
#include <Nazara/Graphics/Config.hpp>
|
||||
#include <Nazara/Graphics/Loaders/Mesh.hpp>
|
||||
#include <Nazara/Graphics/Loaders/OBJ.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/Log.hpp>
|
||||
#include <Nazara/Renderer/Renderer.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
bool Nz3D::Initialize()
|
||||
bool NzGraphics::Initialize()
|
||||
{
|
||||
if (s_moduleReferenceCounter++ != 0)
|
||||
return true; // Déjà initialisé
|
||||
|
|
@ -38,12 +38,12 @@ bool Nz3D::Initialize()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Nz3D::IsInitialized()
|
||||
bool NzGraphics::IsInitialized()
|
||||
{
|
||||
return s_moduleReferenceCounter != 0;
|
||||
}
|
||||
|
||||
void Nz3D::Uninitialize()
|
||||
void NzGraphics::Uninitialize()
|
||||
{
|
||||
if (s_moduleReferenceCounter != 1)
|
||||
{
|
||||
|
|
@ -64,7 +64,7 @@ void Nz3D::Uninitialize()
|
|||
NazaraNotice("Uninitialized: Graphics module");
|
||||
|
||||
// Libération des dépendances
|
||||
Nz2D::Uninitialize();
|
||||
NzRenderer::Uninitialize();
|
||||
}
|
||||
|
||||
unsigned int Nz3D::s_moduleReferenceCounter = 0;
|
||||
unsigned int NzGraphics::s_moduleReferenceCounter = 0;
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ void NzModel::AddToRenderQueue(NzRenderQueue& renderQueue) const
|
|||
|
||||
void NzModel::AdvanceAnimation(float elapsedTime)
|
||||
{
|
||||
#if NAZARA_3D_SAFE
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (!m_animation)
|
||||
{
|
||||
NazaraError("Model has no animation");
|
||||
|
|
@ -163,7 +163,7 @@ NzAnimation* NzModel::GetAnimation() const
|
|||
|
||||
const NzBoundingBoxf& NzModel::GetBoundingBox() const
|
||||
{
|
||||
#if NAZARA_3D_SAFE
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (!m_mesh)
|
||||
{
|
||||
NazaraError("Model has no mesh");
|
||||
|
|
@ -181,7 +181,7 @@ const NzBoundingBoxf& NzModel::GetBoundingBox() const
|
|||
|
||||
NzMaterial* NzModel::GetMaterial(unsigned int matIndex) const
|
||||
{
|
||||
#if NAZARA_3D_SAFE
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (matIndex >= m_matCount)
|
||||
{
|
||||
NazaraError("Material index out of range (" + NzString::Number(matIndex) + " >= " + NzString::Number(m_matCount));
|
||||
|
|
@ -194,7 +194,7 @@ NzMaterial* NzModel::GetMaterial(unsigned int matIndex) const
|
|||
|
||||
NzMaterial* NzModel::GetMaterial(unsigned int skinIndex, unsigned int matIndex) const
|
||||
{
|
||||
#if NAZARA_3D_SAFE
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (skinIndex >= m_skinCount)
|
||||
{
|
||||
NazaraError("Skin index out of range (" + NzString::Number(skinIndex) + " >= " + NzString::Number(m_skinCount));
|
||||
|
|
@ -296,7 +296,7 @@ void NzModel::Reset()
|
|||
|
||||
bool NzModel::SetAnimation(NzAnimation* animation)
|
||||
{
|
||||
#if NAZARA_3D_SAFE
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (!m_mesh)
|
||||
{
|
||||
NazaraError("Model has no animation");
|
||||
|
|
@ -344,7 +344,7 @@ bool NzModel::SetAnimation(NzAnimation* animation)
|
|||
|
||||
void NzModel::SetMaterial(unsigned int matIndex, NzMaterial* material)
|
||||
{
|
||||
#if NAZARA_3D_SAFE
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (matIndex >= m_matCount)
|
||||
{
|
||||
NazaraError("Material index out of range (" + NzString::Number(matIndex) + " >= " + NzString::Number(m_matCount));
|
||||
|
|
@ -362,7 +362,7 @@ void NzModel::SetMaterial(unsigned int matIndex, NzMaterial* material)
|
|||
|
||||
void NzModel::SetMaterial(unsigned int skinIndex, unsigned int matIndex, NzMaterial* material)
|
||||
{
|
||||
#if NAZARA_3D_SAFE
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (skinIndex >= m_skinCount)
|
||||
{
|
||||
NazaraError("Skin index out of range (" + NzString::Number(skinIndex) + " >= " + NzString::Number(m_skinCount));
|
||||
|
|
@ -423,7 +423,7 @@ void NzModel::SetMesh(NzMesh* mesh)
|
|||
bool NzModel::SetSequence(const NzString& sequenceName)
|
||||
{
|
||||
///TODO: Rendre cette erreur "safe" avec le nouveau système de gestions d'erreur (No-log)
|
||||
#if NAZARA_3D_SAFE
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (!m_animation)
|
||||
{
|
||||
NazaraError("Model has no animation");
|
||||
|
|
@ -446,7 +446,7 @@ bool NzModel::SetSequence(const NzString& sequenceName)
|
|||
|
||||
void NzModel::SetSequence(unsigned int sequenceIndex)
|
||||
{
|
||||
#if NAZARA_3D_SAFE
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (!m_animation)
|
||||
{
|
||||
NazaraError("Model has no animation");
|
||||
|
|
@ -455,7 +455,7 @@ void NzModel::SetSequence(unsigned int sequenceIndex)
|
|||
#endif
|
||||
|
||||
const NzSequence* currentSequence = m_animation->GetSequence(sequenceIndex);
|
||||
#if NAZARA_3D_SAFE
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (!currentSequence)
|
||||
{
|
||||
NazaraError("Sequence not found");
|
||||
|
|
@ -469,7 +469,7 @@ void NzModel::SetSequence(unsigned int sequenceIndex)
|
|||
|
||||
void NzModel::SetSkin(unsigned int skin)
|
||||
{
|
||||
#if NAZARA_3D_SAFE
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (skin >= m_skinCount)
|
||||
{
|
||||
NazaraError("Skin index out of range (" + NzString::Number(skin) + " >= " + NzString::Number(m_skinCount));
|
||||
|
|
@ -482,7 +482,7 @@ void NzModel::SetSkin(unsigned int skin)
|
|||
|
||||
void NzModel::SetSkinCount(unsigned int skinCount)
|
||||
{
|
||||
#if NAZARA_3D_SAFE
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (skinCount == 0)
|
||||
{
|
||||
NazaraError("Skin count must be over 0");
|
||||
|
|
@ -587,7 +587,7 @@ void NzModel::UpdateBoundingBox() const
|
|||
|
||||
bool NzModel::VisibilityTest(const NzFrustumf& frustum)
|
||||
{
|
||||
#if NAZARA_3D_SAFE
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (!m_mesh)
|
||||
{
|
||||
NazaraError("Model has no mesh");
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#include <memory>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <Nazara/3D/Debug.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
|
@ -350,7 +350,7 @@ unsigned int NzScene::GetUpdatePerSecond() const
|
|||
|
||||
void NzScene::RegisterForUpdate(NzUpdatable* object)
|
||||
{
|
||||
#if NAZARA_3D_SAFE
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (!object)
|
||||
{
|
||||
NazaraError("Invalid object");
|
||||
|
|
@ -378,7 +378,7 @@ void NzScene::SetUpdatePerSecond(unsigned int updatePerSecond)
|
|||
|
||||
void NzScene::UnregisterForUpdate(NzUpdatable* object)
|
||||
{
|
||||
#if NAZARA_3D_SAFE
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (!object)
|
||||
{
|
||||
NazaraError("Invalid object");
|
||||
|
|
|
|||
Loading…
Reference in New Issue