Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
Merge branch 'prepare0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ybalrid committed Apr 20, 2016
2 parents aa391ba + 24f2322 commit 550146c
Show file tree
Hide file tree
Showing 53 changed files with 1,282 additions and 539 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ System requirement
- A fairly recent GPU. Support for OpenGL 4.3 is mandatory
- Graphics driver with "direct driver" for VR implemented. The lattest Nvidia/AMD driver available will do
- Oculus VR Headset (Rift) CV1 or Dev Kit 2
- 64bit Operating system, Windows 7 SP1 or latter
- Oculus Runtime installed from http://oculus.com/setup
- 64bit Operating system
- Oculus Runtime 1.3.2 (4/20/16) installed from http://oculus.com/setup

Building on Windows
-------------------
Expand Down
2 changes: 0 additions & 2 deletions example/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ AnnMain()
GameEngine->getEventManager()->addListener(new DebugListener);
demoTimer = GameEngine->getEventManager()->fireTimer(10);

GameEngine->setDebugPhysicState(false);

AnnLightObject* light = GameEngine->createLightObject();
GameEngine->destroyLightObject(light);

Expand Down
Binary file modified example/media/CORE.zip
Binary file not shown.
35 changes: 21 additions & 14 deletions include/AnnAbstractLevel.hpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/**
* \file AnnAbstractLevel.hpp
* \brief Pure virtual class that represent a level
* AnnLevelManager class only handle object that derive from this class
You need to overload at least the load() and runLogic() methods to create a level.
To simplify level declaration, you can use the keyword "LEVEL" to mark inheritance and
constructLevel() to call the constructor of the abstract class.
This class also provide a 'simple, stupid' random string generator to set IDs to object automaticaly
* \author A. Brainville (Ybalrid)
*/
* \file AnnAbstractLevel.hpp
* \brief Pure virtual class that represent a level
* AnnLevelManager class only handle object that derive from this class
You need to overload at least the load() and runLogic() methods to create a level.
To simplify level declaration, you can use the keyword "LEVEL" to mark inheritance and
constructLevel() to call the constructor of the abstract class.
This class also provide a 'simple, stupid' random string generator to set IDs to object automaticaly
* \author A. Brainville (Ybalrid)
*/

#ifndef ANN_ABSTRACTLEVEL
#define ANN_ABSTRACTLEVEL
Expand All @@ -21,22 +21,22 @@

namespace Annwvyn
{
//AnnEngine should really be a singleton class with a static method to get the instance...
///Base class for all Levels
class DLL AnnAbstractLevel
{
public:
///Construct the level
AnnAbstractLevel();

///Pure virtual methods that loads the level
virtual void load() = 0;

///Destroy the level
virtual ~AnnAbstractLevel();

///Unload the level by destroying every objects in "levelContent" and every lights in "levelLighting"
virtual void unload();

///Run logic code from the level
virtual void runLogic() =0;

Expand All @@ -45,12 +45,19 @@ namespace Annwvyn
AnnLightList levelLighting;
AnnTriggerObjectList levelTrigger;

AnnLightObject* addLight(std::string id = noID);
///Add a light object to the level
AnnLightObject* addLightObject(std::string id = noID);

///Add a trigger object to the level
AnnTriggerObject* addTrggerObject(AnnTriggerObject* obj = new AnnSphericalTriggerObject, std::string id = noID);

///Add a Game object to the level
AnnGameObject* addGameObject(std::string entityName, std::string id = noID);

///Name of the level
std::string name;

///Create a random ID for level objects.
std::string generateRandomID(size_t len = defaultIdLen);
};
}
Expand Down
43 changes: 20 additions & 23 deletions include/AnnAudioEngine.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* \file AnnAudioEngine.hpp
* \brief OpenAL audio handeling for Annwvvyn
* handle the OpenAL context creation and the loading of sound files
* handle the position/orientation of the listener
* \author A. Brainville (Ybalrid)
*/
* \file AnnAudioEngine.hpp
* \brief OpenAL audio handeling for Annwvvyn
* handle the OpenAL context creation and the loading of sound files
* handle the position/orientation of the listener
* \author A. Brainville (Ybalrid)
*/

#ifndef ANN_AUDIO
#define ANN_AUDIO
Expand All @@ -27,7 +27,7 @@

namespace Annwvyn
{
class AnnEngine;
class AnnEngine;
class AnnAudioEngine;

///Represent an audio source in the engine
Expand All @@ -38,6 +38,7 @@ namespace Annwvyn
AnnAudioSource();
friend class AnnAudioEngine;
public:
///Destroy audio source
~AnnAudioSource();

///Put the audio source at this position in space
Expand Down Expand Up @@ -80,23 +81,19 @@ namespace Annwvyn
///class destructor
~AnnAudioEngine();

///init openal
///init OpenAL
bool initOpenAL();

///shutdown and cleanup openal
///shutdown and cleanup OpenAL
void shutdownOpenAL();

///Load a sound file. return a sond buffer. Add the buffer to the buffer list.
///This permit to preload sound files to the engine. If want to avoid loading a
///Bunch of soundfile (that causes disk I/O access) you can just load the soundfile
///before the start of your gameplay sequence.
/// \param filePath Path of the file you want to load
ALuint loadBuffer(const std::string& filePath);


///DEPRECATED: use loadBuffer
DEPRECATED ALuint loadSndFile(const std::string& path);

///This method is intended to be used in moments like loading levels
///If a buffer is allready loaded, getting it with loadBuffer is equivalent at
///getting something from an unordered map.
Expand All @@ -107,7 +104,7 @@ namespace Annwvyn

///Return "false" if buffer not loaded. Return buffer index if buffer is loaded.
ALuint isBufferLoader(const std::string& filePath);

///Unload a buffer from the engine. The buffer is identified by the soud file it represent
/// \param path Path of the file you want to load
void unloadBuffer(const std::string& path);
Expand All @@ -133,24 +130,24 @@ namespace Annwvyn
///For the engine: update the listener position to match the player's head
/// \param pos The position of the player
void updateListenerPos(AnnVect3 pos);

///For the engine : update the listener orientation to mach the player's head
/// \param orient The orientatio of the player
/// \param orient The orientatio of the player
void updateListenerOrient(AnnQuaternion orient);

///For engine : update listener Oirentation
friend class Annwvyn::AnnEngine;

private:
///For engine : update listener Oirentation
friend class Annwvyn::AnnEngine;

private:
///The last error this class has generated
std::string lastError;
///AL Device
ALCdevice* Device;
///AL Context
ALCcontext* Context;

///Audio buffer for background music
ALuint bgmBuffer;
ALuint bgmBuffer;
///Audio source for background music
ALuint bgm;

Expand Down
14 changes: 10 additions & 4 deletions include/AnnColor.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/**
* \file AnnColor.hpp
* \brief Represent an RGBA color. Each chanel is stored as a float between 0 and 1
* \author A. Brainville (Ybalrid)
*/

#ifndef ANNCOLOR
#define ANNCOLOR
#include "systemMacro.h"
Expand All @@ -19,13 +25,13 @@ namespace Annwvyn
///Return a Ogre::ColourValue from the internal color value
Ogre::ColourValue getOgreColor();

///Return the red channel as an integer betwenn 0 and 255
///Return the red channel as an integer between 0 and 255
unsigned char getRedI();
///Return the blue channel as an integer betwenn 0 and 255
///Return the blue channel as an integer between 0 and 255
unsigned char getBlueI();
///Return the green channel as an integer betwenn 0 and 255
///Return the green channel as an integer between 0 and 255
unsigned char getGreenI();
///Return the alpha channel as an integer betwenn 0 and 255
///Return the alpha channel as an integer between 0 and 255
unsigned char getAlphaI();

///Get the red value as float
Expand Down
1 change: 1 addition & 0 deletions include/AnnConsole.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace Annwvyn
void update();

private:
///This peice of code if from the Ogre Wiki. Write text to a texture using Ogre::FontManager to create glyphs
void WriteToTexture(const Ogre::String& str, Ogre::TexturePtr destTexture, Ogre::Image::Box destRectangle, Ogre::Font* font, const Ogre::ColourValue &color, char justify = 'l', bool wordwrap = true);
bool modified;
//////////////////////////////
Expand Down
62 changes: 12 additions & 50 deletions include/AnnEngine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

//Keep track of engine version here
#define ANN_MAJOR 0
#define ANN_MINOR 1
#define ANN_PATCH 2
#define ANN_MINOR 2
#define ANN_PATCH 0
#define ANN_EXPERIMENTAL true

#include "systemMacro.h"
Expand Down Expand Up @@ -44,23 +44,17 @@

namespace Annwvyn
{
//For some reason, GCC don't want to compile that class without predeclaring AnnPhysicsEngine here.
//even if the header of that class is included...
class AnnPhysicsEngine;

///Main engine class. Creating an instance of that class make the engine start.
///It's more or less a singleton, and will be the only one in the engine architecture.
///You can intantiate it like a normal class and bypass the idea of a singleton complettely.
///This is the base class of the whole engine, the idea is more or less the one described in the
///"solutions to use a singleton for everything" in this article http://gameprogrammingpatterns.com/singleton.html

///Main engine class
class DLL AnnEngine
{
private:
///the singleton address itself is stored here
static AnnEngine* singleton;

//It's more or less a singleton, and will be the only one in the engine architecture.
//You can intantiate it like a normal class and bypass the idea of a singleton complettely.
//This is the base class of the whole engine, the idea is more or less the one described in the
//"solutions to use a singleton for everything" in this article http://gameprogrammingpatterns.com/singleton.html
public:
///This method is called by the OgreOculusRender object. Here is refresh code that needs to know current pose
void toogleOculusPerfHUD();
Expand Down Expand Up @@ -133,21 +127,14 @@ namespace Annwvyn
/// \param object the object to be destroyed
bool destroyGameObject(AnnGameObject* object); //object factory

//TODO remove destroy light
DEPRECATED void destroyLight(AnnLightObject* light){destroyLightObject(light);}

///Destroy the given light
/// \param light pointer to the light to destroy
void destroyLightObject(AnnLightObject* light);

///Set the ambiant light
/// \param v the color of the light
DEPRECATED void setAmbiantLight(Ogre::ColourValue v); //scene parameter
void setAmbiantLight(AnnColor color);

//TODO remove "addlight"
DEPRECATED AnnLightObject* addLight(){return createLightObject();}

///Add a light source to the scene. return a pointer to the new light
AnnLightObject* createLightObject();

Expand Down Expand Up @@ -217,7 +204,6 @@ namespace Annwvyn

///Set the viewports background color
/// \param v background color
DEPRECATED void setWorldBackgroundColor(Ogre::ColourValue v);
void setWorldBackgroundColor(AnnColor color = AnnColor(0,0.56,1));
///Remove the sky dome
void removeSkyDome();
Expand All @@ -234,24 +220,6 @@ namespace Annwvyn
///Get ogre camera scene node
Ogre::SceneNode* getCamera();

///Reference orientation. Usefull if you are inside a vehicule for example
/// \param q the reference orientation for the point of view. Usefull for applying vehicle movement to the player
DEPRECATED void setReferenceQuaternion(AnnQuaternion q); //engine...

///Retrive the said reference quaternion
AnnQuaternion getReferenceQuaternion(); //engine

///Attach a 3D mesh to the camera to act as player's body.
/// \param entityName name of the entity that will serve as player body
/// \param z_offset offset betwenn camera and player center eye pont
/// \param flip if you need to flip the object to be correctly oriented (looking to negative Z)
/// \param scale The scale to be aplied to the body object
DEPRECATED void attachVisualBody(const std::string entityName,
float z_offset = -0.0644f,
bool flip = false,
bool animated = false,
Ogre::Vector3 scale = Ogre::Vector3::UNIT_SCALE); //I seriously have something to do about that...

///Reset the Rift Orientation
void resetOculusOrientation();///Gameplay... but engine related function.

Expand Down Expand Up @@ -294,6 +262,9 @@ namespace Annwvyn
///Remove the object from the engine
void destroyTriggerObject(AnnTriggerObject* obj);

///Return true if the app is visible inside the head mounted display
bool appVisibleInHMD();

private:
///The onScreenConsole object
static AnnConsole* onScreenConsole;
Expand All @@ -317,24 +288,15 @@ namespace Annwvyn
Ogre::SceneManager* SceneManager;
///Point Of View : Node used as "root" for putting the VR "camera rig"
Ogre::SceneNode* povNode;
///Where the visualBody is attached
Ogre::SceneNode* VisualBodyAnchor;
///Orientation offcet between the model and the cameras
AnnQuaternion refVisualBody;
///The entity representing the player
Ogre::Entity* VisualBody;
///The animation state of the player
Ogre::AnimationState* VisualBodyAnimation;
///offset in Z axis of the visual body
float visualBody_Zoffset;

///Oculus oculus;
OgreOculusRender* renderer;

///Dynamic container for games objects present in engine.
std::list<AnnGameObject*> objects;
///Dynamic container for games objects present in engine.
///Dynamic container for triggers objects present in engine.
std::list<AnnTriggerObject*> triggers;
///Dynamic container for games objects present in engine.
///Dynamic container for lights objects present in engine.
std::list<AnnLightObject*> lights;

///Elapsed time between 2 frames
Expand Down
Loading

0 comments on commit 550146c

Please sign in to comment.