Merge branch 'master' of git://github.com/korslund/openmw
Conflicts: game/main.cppactorid
commit
3bb9d06e58
@ -0,0 +1,146 @@
|
||||
#include "engine.hpp"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "esm_store/cell_store.hpp"
|
||||
#include "bsa/bsa_archive.hpp"
|
||||
#include "ogre/renderer.hpp"
|
||||
#include "tools/fileops.hpp"
|
||||
|
||||
#include "mwrender/interior.hpp"
|
||||
#include "mwinput/inputmanager.hpp"
|
||||
#include "mwrender/playerpos.hpp"
|
||||
|
||||
OMW::Engine::Engine() {}
|
||||
|
||||
// adjust name and load bsa
|
||||
|
||||
void OMW::Engine::prepareMaster()
|
||||
{
|
||||
std::string::size_type sep = mMaster.find_last_of (".");
|
||||
|
||||
if (sep==std::string::npos)
|
||||
{
|
||||
mMaster += ".esm";
|
||||
}
|
||||
}
|
||||
|
||||
// Load all BSA files in data directory.
|
||||
|
||||
void OMW::Engine::loadBSA()
|
||||
{
|
||||
boost::filesystem::directory_iterator end;
|
||||
|
||||
for (boost::filesystem::directory_iterator iter (mDataDir); iter!=end; ++iter)
|
||||
{
|
||||
if (boost::filesystem::extension (iter->path())==".bsa")
|
||||
{
|
||||
std::cout << "Adding " << iter->path().string() << std::endl;
|
||||
addBSA(iter->path().file_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add resources directory
|
||||
// \note This function works recursively.
|
||||
|
||||
void OMW::Engine::addResourcesDirectory (const boost::filesystem::path& path)
|
||||
{
|
||||
mOgre.getRoot()->addResourceLocation (path.file_string(), "FileSystem",
|
||||
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, true);
|
||||
}
|
||||
|
||||
// Set data dir
|
||||
|
||||
void OMW::Engine::setDataDir (const boost::filesystem::path& dataDir)
|
||||
{
|
||||
mDataDir = boost::filesystem::system_complete (dataDir);
|
||||
}
|
||||
|
||||
// Set start cell name (only interiors for now)
|
||||
|
||||
void OMW::Engine::setCell (const std::string& cellName)
|
||||
{
|
||||
mCellName = cellName;
|
||||
}
|
||||
|
||||
// Set master file (esm)
|
||||
// - If the given name does not have an extension, ".esm" is added automatically
|
||||
// - Currently OpenMW only supports one master at the same time.
|
||||
|
||||
void OMW::Engine::addMaster (const std::string& master)
|
||||
{
|
||||
assert (mMaster.empty());
|
||||
mMaster = master;
|
||||
}
|
||||
|
||||
// Initialise and enter main loop.
|
||||
|
||||
void OMW::Engine::go()
|
||||
{
|
||||
assert (!mDataDir.empty());
|
||||
assert (!mCellName.empty());
|
||||
assert (!mMaster.empty());
|
||||
|
||||
std::cout << "Hello, fellow traveler!\n";
|
||||
|
||||
std::cout << "Your data directory for today is: " << mDataDir << "\n";
|
||||
|
||||
std::cout << "Initializing OGRE\n";
|
||||
|
||||
const char* plugCfg = "plugins.cfg";
|
||||
|
||||
mOgre.configure(!isFile("ogre.cfg"), plugCfg, false);
|
||||
|
||||
addResourcesDirectory (mDataDir / "Meshes");
|
||||
addResourcesDirectory (mDataDir / "Textures");
|
||||
|
||||
prepareMaster();
|
||||
loadBSA();
|
||||
|
||||
boost::filesystem::path masterPath (mDataDir);
|
||||
masterPath /= mMaster;
|
||||
|
||||
std::cout << "Loading ESM " << masterPath.string() << "\n";
|
||||
ESM::ESMReader esm;
|
||||
ESMS::ESMStore store;
|
||||
ESMS::CellStore cell;
|
||||
|
||||
// This parses the ESM file and loads a sample cell
|
||||
esm.open(masterPath.file_string());
|
||||
store.load(esm);
|
||||
|
||||
cell.loadInt(mCellName, store, esm);
|
||||
|
||||
// Create the window
|
||||
mOgre.createWindow("OpenMW");
|
||||
|
||||
std::cout << "\nSetting up cell rendering\n";
|
||||
|
||||
// Sets up camera, scene manager, and viewport.
|
||||
MWRender::MWScene scene(mOgre);
|
||||
|
||||
// Used to control the player camera and position
|
||||
MWRender::PlayerPos player(scene.getCamera());
|
||||
|
||||
// This connects the cell data with the rendering scene.
|
||||
MWRender::InteriorCellRender rend(cell, scene);
|
||||
|
||||
// Load the cell and insert it into the renderer
|
||||
rend.show();
|
||||
|
||||
std::cout << "Setting up input system\n";
|
||||
|
||||
// Sets up the input system
|
||||
MWInput::MWInputManager input(mOgre, player);
|
||||
|
||||
std::cout << "\nStart! Press Q/ESC or close window to exit.\n";
|
||||
|
||||
// Start the main rendering loop
|
||||
mOgre.start();
|
||||
|
||||
std::cout << "\nThat's all for now!\n";
|
||||
}
|
||||
|
@ -0,0 +1,55 @@
|
||||
#ifndef ENGINE_H
|
||||
#define ENGINE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include "mwrender/mwscene.hpp"
|
||||
|
||||
namespace OMW
|
||||
{
|
||||
/// \brief Main engine class, that brings together all the components of OpenMW
|
||||
|
||||
class Engine
|
||||
{
|
||||
boost::filesystem::path mDataDir;
|
||||
Render::OgreRenderer mOgre;
|
||||
std::string mCellName;
|
||||
std::string mMaster;
|
||||
|
||||
// not implemented
|
||||
Engine (const Engine&);
|
||||
Engine& operator= (const Engine&);
|
||||
|
||||
/// adjust name and load bsa
|
||||
void prepareMaster();
|
||||
|
||||
/// add resources directory
|
||||
/// \note This function works recursively.
|
||||
void addResourcesDirectory (const boost::filesystem::path& path);
|
||||
|
||||
/// Load all BSA files in data directory.
|
||||
void loadBSA();
|
||||
|
||||
public:
|
||||
|
||||
Engine();
|
||||
|
||||
/// Set data dir
|
||||
void setDataDir (const boost::filesystem::path& dataDir);
|
||||
|
||||
/// Set start cell name (only interiors for now)
|
||||
void setCell (const std::string& cellName);
|
||||
|
||||
/// Set master file (esm)
|
||||
/// - If the given name does not have an extension, ".esm" is added automatically
|
||||
/// - Currently OpenMW only supports one master at the same time.
|
||||
void addMaster (const std::string& master);
|
||||
|
||||
/// Initialise and enter main loop.
|
||||
void go();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,58 @@
|
||||
#ifndef _MWRENDER_PLAYERPOS_H
|
||||
#define _MWRENDER_PLAYERPOS_H
|
||||
|
||||
#include "OgreCamera.h"
|
||||
|
||||
namespace MWRender
|
||||
{
|
||||
// This class keeps track of the player position. It takes care of
|
||||
// camera movement, sound listener updates, and collision handling
|
||||
// (to be done).
|
||||
class PlayerPos
|
||||
{
|
||||
float x, y, z;
|
||||
Ogre::Camera *camera;
|
||||
|
||||
public:
|
||||
PlayerPos(Ogre::Camera *cam) :
|
||||
camera(cam), x(0), y(0), z(0) {}
|
||||
|
||||
// Set the player position. Uses Morrowind coordinates.
|
||||
void setPos(float _x, float _y, float _z)
|
||||
{
|
||||
x = _x;
|
||||
y = _y;
|
||||
z = _z;
|
||||
|
||||
// TODO: Update sound listener
|
||||
}
|
||||
|
||||
Ogre::Camera *getCamera() { return camera; }
|
||||
|
||||
// Move the player relative to her own position and
|
||||
// orientation. After the call, the new position is returned.
|
||||
void moveRel(float &relX, float &relY, float &relZ)
|
||||
{
|
||||
using namespace Ogre;
|
||||
|
||||
// Move camera relative to its own direction
|
||||
camera->moveRelative(Vector3(relX,0,relZ));
|
||||
|
||||
// Up/down movement is always done relative the world axis.
|
||||
camera->move(Vector3(0,relY,0));
|
||||
|
||||
// Get new camera position, converting back to MW coords.
|
||||
Vector3 pos = camera->getPosition();
|
||||
relX = pos[0];
|
||||
relY = -pos[2];
|
||||
relZ = pos[1];
|
||||
|
||||
// TODO: Collision detection must be used to find the REAL new
|
||||
// position.
|
||||
|
||||
// Set the position
|
||||
setPos(relX, relY, relZ);
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif
|
@ -0,0 +1,51 @@
|
||||
#ifndef _INPUT_POLLER_H
|
||||
#define _INPUT_POLLER_H
|
||||
|
||||
#include "dispatch_map.hpp"
|
||||
#include "oismanager.hpp"
|
||||
|
||||
namespace Input {
|
||||
|
||||
/** The poller is used to check (poll) for keys rather than waiting
|
||||
for events. TODO: Might make this OIS-independent later. */
|
||||
struct Poller
|
||||
{
|
||||
DispatchMap map;
|
||||
OIS::Keyboard *keyboard;
|
||||
|
||||
Poller(Input::OISManager &ois)
|
||||
{
|
||||
keyboard = ois.keyboard;
|
||||
assert(keyboard);
|
||||
}
|
||||
|
||||
/** Bind or unbind a given action with a key. The action is the first
|
||||
parameter, the key is the second.
|
||||
*/
|
||||
void bind(int in, int out) { map.bind(in, out); }
|
||||
void unbind(int in, int out) { map.unbind(in, out); }
|
||||
bool isBound(int in) const { return map.isBound(in); }
|
||||
|
||||
/// Check whether a given action button is currently pressed.
|
||||
typedef DispatchMap::OutList _O;
|
||||
bool isDown(int index) const
|
||||
{
|
||||
assert(keyboard);
|
||||
|
||||
// No bindings, no action
|
||||
if(!isBound(index))
|
||||
return false;
|
||||
|
||||
// Get all the keys bound to this action, and check them.
|
||||
const _O &list = map.getList(index);
|
||||
_O::const_iterator it;
|
||||
for(it = list.begin(); it != list.end(); it++)
|
||||
// If there's any match, we're good to go.
|
||||
if(keyboard->isKeyDown((OIS::KeyCode)*it)) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
@ -1,272 +0,0 @@
|
||||
/*
|
||||
OpenMW - The completely unofficial reimplementation of Morrowind
|
||||
Copyright (C) 2008 Nicolay Korslund
|
||||
Email: < korslund@gmail.com >
|
||||
WWW: http://openmw.snaptoad.com/
|
||||
|
||||
This file (keys.d) is part of the OpenMW package.
|
||||
|
||||
OpenMW is distributed as free software: you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 3, as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
version 3 along with this program. If not, see
|
||||
http://www.gnu.org/licenses/ .
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* This module handles keyboard and mouse button configuration
|
||||
*/
|
||||
|
||||
module input.keys;
|
||||
|
||||
import std.string;
|
||||
import std.stdio;
|
||||
|
||||
import input.ois;
|
||||
|
||||
// List of all functions we need to map to keys. If you add new keys,
|
||||
// REMEMBER to add strings for them below as well. TODO: We should
|
||||
// redo this entire section so that we insert actual functions into
|
||||
// the system instead. That way, if we do not insert a function, the
|
||||
// key gets treated as a "non-event" key. Then we will also force the
|
||||
// definition of strings and function call to be in the same
|
||||
// place. The Keys enum can be eliminated, really. Default keysyms can
|
||||
// be added when the functions are inserted. But don't do anything
|
||||
// until you know how this will interact with script code.
|
||||
enum Keys
|
||||
{
|
||||
None = 0,
|
||||
|
||||
// Movement
|
||||
MoveLeft, MoveRight,
|
||||
TurnLeft, TurnRight,
|
||||
MoveForward, MoveBackward,
|
||||
|
||||
// Used eg. when flying or swimming
|
||||
MoveUp, MoveDown,
|
||||
|
||||
// These are handled as events, while the above are not.
|
||||
FirstEvent,
|
||||
|
||||
// Sound control
|
||||
MainVolUp, MainVolDown,
|
||||
MusVolUp, MusVolDown,
|
||||
SfxVolUp, SfxVolDown,
|
||||
Mute,
|
||||
|
||||
// These will not be part of the finished product
|
||||
Fullscreen,
|
||||
ToggleBattleMusic,
|
||||
PhysMode, // Toggle physics mode between walking, flying and ghost
|
||||
Nighteye, // Full ambient lighting
|
||||
ToggleGui,// Turn the GUI on/off
|
||||
Console, // Turn console on/off
|
||||
Debug,
|
||||
|
||||
// Misc
|
||||
Pause,
|
||||
ScreenShot,
|
||||
Exit,
|
||||
|
||||
Length
|
||||
}
|
||||
|
||||
// List of keyboard-bound functions
|
||||
char[][] keyToString;
|
||||
|
||||
// Lookup for keyboard key names. TODO: This is currently case
|
||||
// sensitive, we should use my own AA to fix that.
|
||||
int[char[]] stringToKeysym;
|
||||
|
||||
// Represents a key binding for a single function. Each function can
|
||||
// have any number keys bound to it, including mouse buttons. This
|
||||
// might be extended later to allow joystick buttons and other input
|
||||
// devices.
|
||||
struct KeyBind
|
||||
{
|
||||
int syms[];
|
||||
|
||||
// Does the given keysym match this binding?
|
||||
bool isMatch(int sym, char ch = 0)
|
||||
{
|
||||
assert(sym != 0, "don't send empty syms to isMatch");
|
||||
|
||||
// We don't match characters yet
|
||||
if(sym == KC.CharOnly)
|
||||
return false;
|
||||
|
||||
foreach(s; syms)
|
||||
if(sym == s) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Does any of the given syms match this binding?
|
||||
bool isMatchArray(int arr[] ...)
|
||||
{
|
||||
foreach(i; arr)
|
||||
if(i!=0 && isMatch(i)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Assign key bindings to this structure. Can be called multiple
|
||||
// times or with multiple paramters (or an array) to bind multiple
|
||||
// keys.
|
||||
void bind(int symlist[] ...)
|
||||
{
|
||||
syms ~= symlist;
|
||||
}
|
||||
|
||||
// Remove all bindings to this function
|
||||
void clear()
|
||||
{
|
||||
syms = null;
|
||||
}
|
||||
|
||||
// Remove the given syms from this binding, if found.
|
||||
void remove(int symlist[] ...)
|
||||
{
|
||||
foreach(rs; symlist)
|
||||
// Just loop though all the syms and set matching values to
|
||||
// zero. isMatch() will ignore zeros.
|
||||
foreach(ref s; syms)
|
||||
if(s == rs) s = 0;
|
||||
}
|
||||
|
||||
// Turn the keysym list into a comma separated list of key names
|
||||
char[] getString()
|
||||
{
|
||||
char[] res = null;
|
||||
bool notFirst = false;
|
||||
|
||||
foreach(int k; syms)
|
||||
if(k != 0) // Ignore empty keysyms
|
||||
{
|
||||
if(notFirst) res ~= ",";
|
||||
else notFirst = true;
|
||||
|
||||
res ~= keysymToString[k];
|
||||
}
|
||||
|
||||
//writefln("getString returned %s", res);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
KeyBindings keyBindings;
|
||||
|
||||
// This structure holds the bindings of all the functions
|
||||
struct KeyBindings
|
||||
{
|
||||
KeyBind[] bindings;
|
||||
|
||||
// Bind the given function to the given key(s)
|
||||
void bind(Keys func, char[] key1, char[] key2 = "")
|
||||
{
|
||||
bind(func, getSym(key1), getSym(key2));
|
||||
}
|
||||
|
||||
void bind(Keys func, int syms[] ...)
|
||||
{
|
||||
// Find other bindings that match this key
|
||||
foreach(int i, ref KeyBind kb; bindings)
|
||||
if(kb.isMatchArray(syms))
|
||||
kb.remove(syms);
|
||||
bindings[func].bind(syms);
|
||||
}
|
||||
|
||||
// Find the function that matches the given keysym. We could
|
||||
// optimize this, but I'm not sure it's worth it.
|
||||
Keys findMatch(KC keysym, dchar ch)
|
||||
{
|
||||
int start=cast(int)Keys.FirstEvent + 1;
|
||||
foreach(int i, ref KeyBind kb; bindings[start..$])
|
||||
if( kb.isMatch(keysym, ch) )
|
||||
return cast(Keys)(i+start);
|
||||
return cast(Keys)0; // No match
|
||||
}
|
||||
|
||||
static int getSym(char[] key)
|
||||
{
|
||||
key = strip(key);
|
||||
if(key.length)
|
||||
{
|
||||
int *p = key in stringToKeysym;
|
||||
if(p) return *p;
|
||||
else writefln("Warning: unknown key '%s'", key);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Bind a function to a comma-separated key list (intended to be
|
||||
// used directly with the ini file reader.)
|
||||
void bindComma(Keys func, char[] keys)
|
||||
{
|
||||
int index = keys.find(',');
|
||||
if(index != -1)
|
||||
{
|
||||
// Bind the first in the list
|
||||
bind(func, keys[0..index]);
|
||||
// Recurse on the rest
|
||||
bindComma(func, keys[index+1..$]);
|
||||
}
|
||||
// Last or only element in the list
|
||||
else bind(func, keys);
|
||||
}
|
||||
|
||||
// Remove all key bindings
|
||||
void clear()
|
||||
{
|
||||
foreach(ref kb; bindings)
|
||||
kb.clear();
|
||||
}
|
||||
|
||||
void initKeys()
|
||||
{
|
||||
// Keyboard functions
|
||||
keyToString.length = Keys.Length;
|
||||
|
||||
keyToString[Keys.MoveLeft] = "Move Left";
|
||||
keyToString[Keys.MoveRight] = "Move Right";
|
||||
keyToString[Keys.TurnLeft] = "Turn Left";
|
||||
keyToString[Keys.TurnRight] = "Turn Right";
|
||||
keyToString[Keys.MoveForward] = "Move Forward";
|
||||
keyToString[Keys.MoveBackward] = "Move Backward";
|
||||
keyToString[Keys.MoveUp] = "Move Up";
|
||||
keyToString[Keys.MoveDown] = "Move Down";
|
||||
|
||||
keyToString[Keys.MainVolUp] = "Increase Main Volume";
|
||||
keyToString[Keys.MainVolDown] = "Decrease Main Volume";
|
||||
keyToString[Keys.MusVolUp] = "Increase Music Volume";
|
||||
keyToString[Keys.MusVolDown] = "Decrease Music Volume";
|
||||
keyToString[Keys.SfxVolUp] = "Increase SFX Volume";
|
||||
keyToString[Keys.SfxVolDown] = "Decrease SFX Volume";
|
||||
keyToString[Keys.Mute] = "Mute Sound";
|
||||
|
||||
keyToString[Keys.Fullscreen] = "Toggle Fullscreen Mode";
|
||||
keyToString[Keys.ToggleBattleMusic] = "Toggle Battle Music";
|
||||
keyToString[Keys.PhysMode] = "Toggle Physics Mode";
|
||||
keyToString[Keys.Nighteye] = "Toggle Nighteye";
|
||||
keyToString[Keys.ToggleGui] = "Toggle GUI";
|
||||
keyToString[Keys.Console] = "Console";
|
||||
keyToString[Keys.Debug] = "OGRE Test Action";
|
||||
|
||||
keyToString[Keys.Pause] = "Pause";
|
||||
keyToString[Keys.ScreenShot] = "Screen Shot";
|
||||
keyToString[Keys.Exit] = "Quick Exit";
|
||||
//keyToString[Keys.] = "";
|
||||
|
||||
bindings.length = Keys.Length;
|
||||
|
||||
// Store all the key strings in a lookup-table
|
||||
foreach(int k, ref char[] s; keysymToString)
|
||||
if(s.length) stringToKeysym[s] = k;
|
||||
}
|
||||
}
|
@ -1,166 +0,0 @@
|
||||
/*
|
||||
OpenMW - The completely unofficial reimplementation of Morrowind
|
||||
Copyright (C) 2008 Nicolay Korslund
|
||||
Email: < korslund@gmail.com >
|
||||
WWW: http://openmw.snaptoad.com/
|
||||
|
||||
This file (bindings.d) is part of the OpenMW package.
|
||||
|
||||
OpenMW is distributed as free software: you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
version 3, as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
version 3 along with this program. If not, see
|
||||
http://www.gnu.org/licenses/ .
|
||||
|
||||
*/
|
||||
|
||||
module ogre.bindings;
|
||||
|
||||
import nif.misc; // for Transformation
|
||||
import ogre.ogre; // for Placement
|
||||
|
||||
import core.resource;
|
||||
|
||||
/*
|
||||
* This module is the interface to OGRE from D. Since OGRE is written
|
||||
* in C++, all the code that deals directly with the graphics engine
|
||||
* is packaged in a bunch of C++ functions. These functions are
|
||||
* exported from C++ through the C calling convention, and imported
|
||||
* here.
|
||||
*
|
||||
* Note that the C calling convension is not in any way type
|
||||
* safe. This is convenient, as it allows us to send pointers as one
|
||||
* type and recieve them as another, without casting, but also
|
||||
* dangerous since it opens for some nasty bugs.
|
||||
*/
|
||||
|
||||
// Represents a pointer to a Node in the OGRE engine. We never use
|
||||
// these directly in D code, only pass them back to the C++ code.
|
||||
typedef void* NodePtr;
|
||||
|
||||
extern(C):
|
||||
|
||||
// Do engine configuration. Returns 0 if we should continue, 1 if
|
||||
// not.
|
||||
int ogre_configure(int showConfig, // Do we show the config dialogue?
|
||||
char *plugincfg,// Name of 'plugin.cfg' file
|
||||
int debutOut); // Enable or disable debug output
|
||||
|
||||
// Sets up the window
|
||||
void ogre_initWindow();
|
||||
|
||||
// Set up an empty scene.
|
||||
void ogre_makeScene();
|
||||
|
||||
// Set the ambient light and "sunlight"
|
||||
void ogre_setAmbient(float r, float g, float b,
|
||||
float rs, float gs, float bs);
|
||||
|
||||
// Set fog color and view distance
|
||||
void ogre_setFog(float rf, float gf, float bf,
|
||||
float flow, float fhigh);
|
||||
|
||||
// Create a simple sky dome
|
||||
int ogre_makeSky();
|
||||
|
||||
// Toggle full ambient lighting on and off
|
||||
void ogre_toggleLight();
|
||||
|
||||
// Enter main rendering loop
|
||||
void ogre_startRendering();
|
||||
|
||||
// Cleans up after ogre
|
||||
void ogre_cleanup();
|
||||
|
||||
// Gets a child SceneNode from the root node, then detatches it to
|
||||
// hide it from view. Used for creating the "template" node associated
|
||||
// with a NIF mesh.
|
||||
NodePtr ogre_getDetachedNode();
|
||||
|
||||
// Convert a Morrowind rotation (3 floats) to a quaternion (4 floats)
|
||||
void ogre_mwToQuaternion(float *mw, float *quat);
|
||||
|
||||
// Create a copy of the given scene node, with the given coordinates
|
||||
// and rotation (as a quaternion.)
|
||||
NodePtr ogre_insertNode(NodePtr base, char* name,
|
||||
float *pos, float *quat, float scale);
|
||||
|
||||
// Get the world transformation of a node, returned as a translation
|
||||
// and a matrix. The matrix includes both rotation and scaling. The
|
||||
// buffers given must be large enough to store the result (3 and 9
|
||||
// floats respectively.)
|
||||
void ogre_getWorldTransform(NodePtr node, float *trans, float *matrix);
|
||||
|
||||
// Create a (very crappy looking) plane to simulate the water level
|
||||
void ogre_createWater(float level);
|
||||
|
||||
// Creates a scene node as a child of 'parent', then translates and
|
||||
// rotates it according to the data in 'trafo'.
|
||||
NodePtr ogre_createNode(
|
||||
char *name, // Name to give the node
|
||||
Transformation *trafo, // Transformation
|
||||
NodePtr parent, // Parent node
|
||||
int noRot); // If 1, don't rotate node
|
||||
|
||||
// Create a light with the given diffuse color. Attach it to SceneNode
|
||||
// 'parent'.
|
||||
NodePtr ogre_attachLight(char* name, NodePtr parent,
|
||||
float r, float g, float b,
|
||||
float radius);
|
||||
|
||||
// Create the specified material
|
||||
void ogre_createMaterial(char *name, // Name to give resource
|
||||
float *ambient, // Ambient RBG value
|
||||
float *diffuse,
|
||||
float *specular,
|
||||
float *emissive, // Self illumination
|
||||
float glossiness,// Same as shininess?
|
||||
float alpha, // Reflection alpha?
|
||||
char *texture, // Texture name
|
||||
int alphaFlags, // Alpha settings (see
|
||||
ubyte alphaTest);// NiAlphaProperty in nif/)
|
||||
|
||||
// Creates a mesh and gives it a bounding box. Also creates an entity
|
||||
// and attached it to the given SceneNode 'owner'.
|
||||
void ogre_createMesh(
|
||||
char* name, // Name of the mesh
|
||||
int numVerts, // Number of vertices
|
||||
float* vertices, // Vertex list
|
||||
float* normals, // Normal list
|
||||
float* colors, // Vertex colors
|
||||
float* uvs, // Texture coordinates
|
||||
int numFaces, // Number of faces*3
|
||||
short* faces, // Faces
|
||||
float radius, // Bounding sphere
|
||||
char* material, // Material name, if any
|
||||
|
||||
// Bounding box
|
||||
float minX,float minY,float minZ,
|
||||
float maxX,float maxY,float maxZ,
|
||||
|
||||
NodePtr owner // Scene node to attach to.
|
||||
);
|
||||
|
||||
// Toggle fullscreen mode
|
||||
void ogre_toggleFullscreen();
|
||||
|
||||
// Save a screen shot to the given file name
|
||||
void ogre_screenshot(char *filename);
|
||||
|
||||
// Camera control and information
|
||||
void ogre_rotateCamera(float x, float y);
|
||||
void ogre_moveCamera(float x, float y, float z);
|
||||
void ogre_setCameraRotation(float r1, float r2, float r3);
|
||||
void ogre_getCameraPos(float *x, float *y, float *z);
|
||||
void ogre_getCameraOrientation(float *fx, float *fy, float *fz, float *ux, float *uy, float *uz);
|
||||
void ogre_moveCameraRel(float x, float y, float z);
|
||||
|
||||
// Insert a raw RGBA image into the texture system.
|
||||
//void ogre_insertTexture(char *name, int width, int height, void *data);
|
Loading…
Reference in New Issue