Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2009-07-07 09:32:38 +0000
committerStijn Buys <ingar@osirion.org>2009-07-07 09:32:38 +0000
commitfb1d166768e516a8493c16064640c98b1efa6707 (patch)
treee5d1827028fc6a5fa527c9293f6ae2fde42b3991 /src/core
parente66f56ea71f466cc2b261e04d7348e36baff71e1 (diff)
Moved vertexarray from render to core
Diffstat (limited to 'src/core')
-rw-r--r--src/core/cvar.cc1
-rw-r--r--src/core/cvar.h1
-rw-r--r--src/core/gameinterface.cc20
-rw-r--r--src/core/gameinterface.h5
4 files changed, 27 insertions, 0 deletions
diff --git a/src/core/cvar.cc b/src/core/cvar.cc
index 2e5de5a..2a9fd67 100644
--- a/src/core/cvar.cc
+++ b/src/core/cvar.cc
@@ -24,6 +24,7 @@ Cvar *Cvar::sv_framerate = 0;
Cvar *Cvar::sv_name = 0;
Cvar *Cvar::sv_description = 0;
Cvar *Cvar::sv_password = 0;
+Cvar *Cvar::sv_arraysize = 0;
Cvar *Cvar::cl_prediction = 0;
diff --git a/src/core/cvar.h b/src/core/cvar.h
index 5683d94..8861f2a 100644
--- a/src/core/cvar.h
+++ b/src/core/cvar.h
@@ -115,6 +115,7 @@ public:
static Cvar *sv_name; // server name
static Cvar *sv_description; // server description
static Cvar *sv_password; // server rcon password
+ static Cvar *sv_arraysize; // vertex array size in MegaBytes
static Cvar *con_ansi; // console ANSI colors
diff --git a/src/core/gameinterface.cc b/src/core/gameinterface.cc
index 5f3c91a..1ed0a67 100644
--- a/src/core/gameinterface.cc
+++ b/src/core/gameinterface.cc
@@ -70,6 +70,19 @@ GameInterface::GameInterface()
Func *func = Func::add("list_players", func_list_players);
func->set_info("get the local list of connected players");
+
+ // size of the vertex array in megabytes
+ Cvar::sv_arraysize = core::Cvar::get("sv_arraysize", 128.0f , core::Cvar::Archive);
+ Cvar::sv_arraysize->set_info("[int] size of the vertex array in MegabBytes");
+
+ size_t mb = (size_t) Cvar::sv_arraysize->value();
+ if (mb < 4 * sizeof(float))
+ mb = 4 * sizeof(float);
+ if (mb > 512)
+ mb = 512;
+ (*Cvar::sv_arraysize) = (float) mb;
+ game_vertexarray = new model::VertexArray(mb);
+
}
GameInterface::~GameInterface()
@@ -79,6 +92,12 @@ GameInterface::~GameInterface()
game_localplayer.clear();
clear();
+
+ // delete vertex array
+ if (game_vertexarray) {
+ delete game_vertexarray;
+ game_vertexarray = 0;
+ }
}
// clear all game related objects
@@ -122,6 +141,7 @@ void GameInterface::clear()
// remove all models
model::Model::clear();
+
// remove infos
Info::clear();
diff --git a/src/core/gameinterface.h b/src/core/gameinterface.h
index 8dc401b..7d3e086 100644
--- a/src/core/gameinterface.h
+++ b/src/core/gameinterface.h
@@ -9,6 +9,7 @@
#include "core/player.h"
#include "core/info.h"
+#include "model/vertexarray.h"
namespace core
{
@@ -32,6 +33,8 @@ public:
inline Player *localplayer() { return &game_localplayer; }
inline Players & players() { return game_players; }
+
+ inline model::VertexArray *vertexarray() { return game_vertexarray; }
/// find the first player who's id or name matches the search string
Player *find_player(const std::string &search);
@@ -74,6 +77,8 @@ protected:
/// all the players
Players game_players;
+
+ model::VertexArray *game_vertexarray;
};
/// global local player instance