Update Ghoul

Change TriangleSoup and StatsCollector to use new Boolean class
This commit is contained in:
Alexander Bock
2016-09-08 15:32:27 +02:00
parent 965f3eded0
commit 0376300732
6 changed files with 31 additions and 45 deletions

View File

@@ -71,8 +71,8 @@ public:
virtual bool isReady() const = 0;
bool isEnabled() const;
void setBoundingSphere(const PowerScaledScalar& boundingSphere);
const PowerScaledScalar& getBoundingSphere();
void setBoundingSphere(PowerScaledScalar boundingSphere);
PowerScaledScalar getBoundingSphere();
virtual void render(const RenderData& data);
virtual void render(const RenderData& data, RendererTasks& rendererTask);

View File

@@ -36,9 +36,9 @@ TriangleSoup::TriangleSoup(std::vector<unsigned int> elements,
: _vaoID(0)
,_vertexBufferID(0)
,_elementBufferID(0)
,_useVertexPositions(usePositions == Positions::Yes)
,_useTextureCoordinates(useTextures == TextureCoordinates::Yes)
,_useVertexNormals(useNormals == Normals::Yes)
,_useVertexPositions(usePositions)
,_useTextureCoordinates(useTextures)
,_useVertexNormals(useNormals)
{
setElements(elements);
}

View File

@@ -25,6 +25,7 @@
#ifndef __TRIANGLESOUP_H__
#define __TRIANGLESOUP_H__
#include <ghoul/misc/boolean.h>
#include <ghoul/opengl/ghoul_gl.h>
#include <ghoul/logging/logmanager.h>
@@ -44,12 +45,11 @@ namespace openspace {
// TODO : Possibly render triangle strips in this class instead of triangles since
// that is faster
class TriangleSoup
{
class TriangleSoup {
public:
enum class Positions { Yes, No };
enum class TextureCoordinates { Yes, No };
enum class Normals { Yes, No };
using Positions = ghoul::Boolean;
using TextureCoordinates = ghoul::Boolean;
using Normals = ghoul::Boolean;
TriangleSoup(
std::vector<unsigned int> elements, // At least elements are required

View File

@@ -24,6 +24,7 @@
#ifndef __STATS_TRACKER_H__
#define __STATS_TRACKER_H__
#include <ghoul/misc/boolean.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/filesystem/filesystem>
@@ -143,13 +144,13 @@ namespace openspace {
StatsCollector() = delete;
enum class Enabled { Yes, No };
using Enabled = ghoul::Boolean;
StatsCollector(const std::string& filename, int dumpEveryXRecord, Enabled enabled = Enabled::Yes, const std::string& delimiter = ",")
: _filename(filename)
, _dumpEveryXRecord(dumpEveryXRecord)
, _recordsSinceLastDump(0)
, _enabled(enabled == Enabled::Yes)
, _enabled(enabled)
, _delimiter(delimiter)
, _hasWrittenHeader(false)
, i(TemplatedStatsCollector<long long>(_enabled, delimiter))

View File

@@ -22,14 +22,12 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
// open space includes
#include <openspace/rendering/renderable.h>
#include <openspace/util/factorymanager.h>
#include <openspace/util/updatestructures.h>
#include <openspace/util/spicemanager.h>
#include <openspace/scene/scenegraphnode.h>
// ghoul
#include <ghoul/misc/dictionary.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/opengl/programobject.h>
@@ -75,9 +73,7 @@ Renderable::Renderable()
, _startTime("")
, _endTime("")
, _hasTimeInterval(false)
{
}
{}
Renderable::Renderable(const ghoul::Dictionary& dictionary)
: _enabled("enabled", "Is Enabled", true)
@@ -87,52 +83,41 @@ Renderable::Renderable(const ghoul::Dictionary& dictionary)
, _hasTimeInterval(false)
{
setName("renderable");
#ifndef NDEBUG
std::string name;
ghoul_assert(dictionary.getValue(SceneGraphNode::KeyName, name),
"Scenegraphnode need to specify '" << SceneGraphNode::KeyName
<< "' because renderables is going to use this for debugging!");
#endif
ghoul_assert(
dictionary.hasKeyAndValue<std::string>(SceneGraphNode::KeyName),
"SceneGraphNode must specify '" << SceneGraphNode::KeyName << "'"
);
dictionary.getValue(keyStart, _startTime);
dictionary.getValue(keyEnd, _endTime);
if (_startTime != "" && _endTime != "")
if (_startTime != "" && _endTime != "") {
_hasTimeInterval = true;
}
addProperty(_enabled);
}
Renderable::~Renderable() {
Renderable::~Renderable() {}
void Renderable::setBoundingSphere(PowerScaledScalar boundingSphere) {
boundingSphere_ = std::move(boundingSphere);
}
void Renderable::setBoundingSphere(const PowerScaledScalar& boundingSphere)
{
boundingSphere_ = boundingSphere;
}
const PowerScaledScalar& Renderable::getBoundingSphere()
{
PowerScaledScalar Renderable::getBoundingSphere() {
return boundingSphere_;
}
void Renderable::update(const UpdateData&)
{
}
void Renderable::update(const UpdateData&) {}
void Renderable::render(const RenderData& data, RendererTasks& tasks)
{
(void) tasks;
void Renderable::render(const RenderData& data, RendererTasks&) {
render(data);
}
void Renderable::render(const RenderData& data)
{
}
void Renderable::render(const RenderData& data) {}
void Renderable::postRender(const RenderData& data)
{
}
void Renderable::postRender(const RenderData& data) {}
void Renderable::setPscUniforms(
ghoul::opengl::ProgramObject& program,