2005-01-14 16:25:29 +01:00
|
|
|
#ifndef NXS_MT_H
|
|
|
|
#define NXS_MT_H
|
2004-09-17 17:25:59 +02:00
|
|
|
|
2004-09-28 12:26:35 +02:00
|
|
|
#include <vector>
|
|
|
|
#include <queue>
|
|
|
|
#include <wrap/gui/frustum.h>
|
2004-09-17 17:25:59 +02:00
|
|
|
|
2005-01-14 16:25:29 +01:00
|
|
|
#include "nexus.h"
|
|
|
|
#include "history.h"
|
|
|
|
#include "extraction.h"
|
|
|
|
#include "metric.h"
|
|
|
|
#include "preload.h"
|
|
|
|
#include "watch.h"
|
2004-09-17 17:25:59 +02:00
|
|
|
|
2004-09-28 12:26:35 +02:00
|
|
|
namespace nxs {
|
2004-09-17 17:25:59 +02:00
|
|
|
|
2005-01-14 16:25:29 +01:00
|
|
|
struct DrawContest {
|
2004-09-30 02:27:42 +02:00
|
|
|
|
2005-01-14 16:25:29 +01:00
|
|
|
enum Mode { POINTS, SMOOTH, XRAY, HIDDEN_LINE, FLAT_WIRE, FLAT, PATCHES };
|
|
|
|
enum Attr { COLOR = 0x1, NORMAL = 0x2, TEXTURE = 0x4, DATA = 0x8 };
|
2004-09-30 02:27:42 +02:00
|
|
|
|
2005-01-14 16:25:29 +01:00
|
|
|
Mode mode;
|
|
|
|
unsigned int attrs;
|
2004-12-15 09:46:16 +01:00
|
|
|
|
2005-01-14 16:25:29 +01:00
|
|
|
DrawContest(Mode m = SMOOTH, unsigned int a = 0xf): mode(m), attrs(a) {}
|
|
|
|
void SetAttr(Attr attr, bool value);
|
|
|
|
bool HasComponent(Attr attr);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Stats {
|
|
|
|
float ktri; //k triangles rendered.
|
|
|
|
float kdisk; //k readed per frame (mean)
|
|
|
|
float kdisk_peak; //k readed peak.
|
|
|
|
float fps;
|
|
|
|
float fps_peak; //low fps peaks
|
|
|
|
|
|
|
|
//double last_time;
|
|
|
|
unsigned int count;
|
|
|
|
|
|
|
|
Watch watch;
|
|
|
|
|
|
|
|
Stats(): count(0) {}
|
|
|
|
void Init();
|
|
|
|
};
|
|
|
|
|
|
|
|
class NexusMt: public Nexus {
|
|
|
|
public:
|
|
|
|
bool use_vbo;
|
|
|
|
bool prefetch;
|
2004-12-13 01:44:48 +01:00
|
|
|
|
2005-01-14 16:25:29 +01:00
|
|
|
unsigned int vbo_used; //TODO remember to zero it!
|
2004-12-14 15:10:22 +01:00
|
|
|
|
2005-01-14 16:25:29 +01:00
|
|
|
Preload preload;
|
2004-12-13 01:44:48 +01:00
|
|
|
|
2005-01-14 16:25:29 +01:00
|
|
|
NexusMt();
|
|
|
|
~NexusMt();
|
|
|
|
|
|
|
|
bool Load(const std::string &filename);
|
|
|
|
// void Close();
|
|
|
|
|
|
|
|
bool InitGL(bool use_vbo = true);
|
|
|
|
|
|
|
|
void Render(DrawContest contest = DrawContest());
|
|
|
|
void Render(Extraction &extraction,
|
|
|
|
DrawContest &contest,
|
|
|
|
Stats *stats = NULL);
|
2005-02-01 17:42:30 +01:00
|
|
|
|
|
|
|
void SetPreload(bool on);
|
2005-01-14 16:25:29 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void FlushPatch(unsigned int id);
|
|
|
|
void LoadVbo(Entry &entry);
|
|
|
|
void FlushVbo(Entry &entry);
|
|
|
|
void Draw(unsigned int cell, DrawContest &contest);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
/* class NexusViewer {
|
|
|
|
public:
|
|
|
|
NexusMt &mt;
|
|
|
|
|
|
|
|
DrawContest contest;
|
|
|
|
Extraction extraction;
|
|
|
|
Statistics stats;
|
|
|
|
|
|
|
|
NexusViewer(NexyusMt &_mt): mt(&mt) {}
|
|
|
|
void Render();
|
2004-12-14 15:10:22 +01:00
|
|
|
|
2004-12-13 01:44:48 +01:00
|
|
|
|
2005-01-14 16:25:29 +01:00
|
|
|
bool SetMode(DrawContest::Mode mode);
|
|
|
|
bool SetComponent(DrawContest::Component c, bool on);
|
|
|
|
bool SetComponents(unsigned int mask);
|
2004-10-14 15:42:33 +02:00
|
|
|
|
2005-01-14 16:25:29 +01:00
|
|
|
void SetMetric(MetricKind kind);
|
|
|
|
void SetError(float error);
|
2004-11-28 02:23:26 +01:00
|
|
|
|
2005-01-14 16:25:29 +01:00
|
|
|
//Uinits expressed in Kb
|
|
|
|
void SetExtractionSize(unsigned int ksize);
|
|
|
|
void SetDrawSize(unsigned int ksize);
|
|
|
|
void SetDiskDelta(unsigned int kdelta);
|
|
|
|
//void SetPrefetchSize(unsigned int size);
|
|
|
|
};*/
|
2004-09-30 02:27:42 +02:00
|
|
|
|
2004-09-17 17:25:59 +02:00
|
|
|
|
2004-12-13 01:44:48 +01:00
|
|
|
|
2004-09-17 17:25:59 +02:00
|
|
|
|
|
|
|
}
|
2005-01-14 16:25:29 +01:00
|
|
|
|
2004-09-17 17:25:59 +02:00
|
|
|
#endif
|