2005-02-08 13:43:03 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* VCGLib o o *
|
|
|
|
* Visual and Computer Graphics Library o o *
|
|
|
|
* _ O _ *
|
|
|
|
* Copyright(C) 2004 \/)\/ *
|
|
|
|
* Visual Computing Lab /\/| *
|
|
|
|
* ISTI - Italian National Research Council | *
|
|
|
|
* \ *
|
|
|
|
* All rights reserved. *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* 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 (http://www.gnu.org/licenses/gpl.txt) *
|
|
|
|
* for more details. *
|
|
|
|
* *
|
|
|
|
****************************************************************************/
|
|
|
|
/****************************************************************************
|
|
|
|
History
|
|
|
|
|
|
|
|
$Log: not supported by cvs2svn $
|
2005-04-13 16:01:17 +02:00
|
|
|
Revision 1.24 2005/02/17 15:39:44 ponchio
|
|
|
|
Reorderes statistics a bit.
|
|
|
|
|
2005-02-17 16:39:44 +01:00
|
|
|
Revision 1.23 2005/02/14 17:11:07 ponchio
|
|
|
|
aggiunta delle sphere
|
|
|
|
|
2005-02-14 18:11:08 +01:00
|
|
|
Revision 1.22 2005/02/10 09:18:20 ponchio
|
|
|
|
Statistics.
|
|
|
|
|
2005-02-10 10:18:20 +01:00
|
|
|
Revision 1.21 2005/02/08 12:43:03 ponchio
|
|
|
|
Added copyright
|
|
|
|
|
2005-02-08 13:43:03 +01:00
|
|
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
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 };
|
2005-02-14 18:11:08 +01:00
|
|
|
enum Attr { COLOR = 0x1, NORMAL = 0x2, TEXTURE = 0x4, DATA = 0x8, SPHERES = 0x10 };
|
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 {
|
2005-02-17 16:39:44 +01:00
|
|
|
//per frame data...
|
|
|
|
float tri; //k triangles rendered.
|
|
|
|
float extr; //k triangles extracted
|
2005-04-13 16:01:17 +02:00
|
|
|
float disk_tri; //k triangles readed from disk
|
2005-02-17 16:39:44 +01:00
|
|
|
|
|
|
|
int log_size;
|
|
|
|
|
|
|
|
deque<float> error; //max error in extraction (push_front pop_back)
|
|
|
|
deque<float> time;
|
|
|
|
deque<float> disk; //kdisk readed per frame
|
2005-01-14 16:25:29 +01:00
|
|
|
|
2005-02-17 16:39:44 +01:00
|
|
|
float fps; //averaged over 8 frames
|
2005-01-14 16:25:29 +01:00
|
|
|
|
|
|
|
Watch watch;
|
|
|
|
|
2005-02-17 16:39:44 +01:00
|
|
|
Stats(): log_size(48), fps(0.0f) {}
|
|
|
|
void Start();
|
|
|
|
void Disk(float disk);
|
|
|
|
void Error(float error);
|
|
|
|
void Stop();
|
2005-01-14 16:25:29 +01:00
|
|
|
};
|
2005-02-03 13:35:01 +01:00
|
|
|
|
2005-01-14 16:25:29 +01:00
|
|
|
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
|
|
|
|
2005-02-03 13:35:01 +01:00
|
|
|
void Flush(bool all = true);
|
|
|
|
Patch &GetPatch(unsigned int patch, float error, bool flush = true);
|
|
|
|
bool CanAdd(Item &item);
|
2005-01-14 16:25:29 +01:00
|
|
|
protected:
|
2005-02-03 13:35:01 +01:00
|
|
|
std::vector<Item> heap;
|
|
|
|
|
2005-01-14 16:25:29 +01:00
|
|
|
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
|