mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-06 04:18:36 -06:00
Further work on removing assertions from constructors
This commit is contained in:
@@ -57,15 +57,12 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
|
||||
, _geometry(nullptr)
|
||||
{
|
||||
std::string name;
|
||||
bool success = dictionary.getValue(constants::scenegraphnode::keyName, name);
|
||||
assert(success);
|
||||
|
||||
std::string path;
|
||||
success = dictionary.getValue(constants::scenegraph::keyPathModule, path);
|
||||
assert(success);
|
||||
dictionary.getValue(constants::scenegraphnode::keyName, name);
|
||||
dictionary.getValue(constants::scenegraph::keyPathModule, path);
|
||||
|
||||
ghoul::Dictionary geometryDictionary;
|
||||
success = dictionary.getValue(
|
||||
bool success = dictionary.getValue(
|
||||
constants::renderablemodel::keyGeometry, geometryDictionary);
|
||||
if (success) {
|
||||
geometryDictionary.setValue(constants::scenegraphnode::keyName, name);
|
||||
@@ -83,10 +80,8 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
|
||||
addProperty(_colorTexturePath);
|
||||
_colorTexturePath.onChange(std::bind(&RenderableModel::loadTexture, this));
|
||||
|
||||
bool b1 = dictionary.getValue(keySource, _source);
|
||||
bool b2 = dictionary.getValue(keyDestination, _destination);
|
||||
assert(b1 == true);
|
||||
assert(b2 == true);
|
||||
dictionary.getValue(keySource, _source);
|
||||
dictionary.getValue(keyDestination, _destination);
|
||||
}
|
||||
|
||||
|
||||
@@ -108,8 +103,11 @@ bool RenderableModel::initialize(){
|
||||
&= OsEng.ref().configurationManager().getValue("pscShader", _programObject);
|
||||
|
||||
loadTexture();
|
||||
|
||||
completeSuccess &= (_texture != nullptr);
|
||||
completeSuccess &= _geometry->initialize(this);
|
||||
completeSuccess &= !_source.empty();
|
||||
completeSuccess &= !_destination.empty();
|
||||
|
||||
return completeSuccess;
|
||||
}
|
||||
@@ -166,6 +164,10 @@ void RenderableModel::render(const RenderData& data)
|
||||
}
|
||||
|
||||
void RenderableModel::update(const UpdateData& data){
|
||||
#ifndef NDEBUG
|
||||
if (_source.empty() || _destination.empty())
|
||||
return;
|
||||
#endif
|
||||
// set spice-orientation in accordance to timestamp
|
||||
openspace::SpiceManager::ref().getPositionTransformMatrix(_source, _destination, data.time, _stateMatrix);
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ WavefrontGeometry::WavefrontGeometry(const ghoul::Dictionary& dictionary)
|
||||
// The name is passed down from the SceneGraphNode
|
||||
std::string name;
|
||||
bool success = dictionary.getValue(keyName, name);
|
||||
assert(success);
|
||||
|
||||
std::string file;
|
||||
success = dictionary.getValue(constants::modelgeometry::keyObjFile, file);
|
||||
@@ -114,9 +113,9 @@ void WavefrontGeometry::loadObj(const char *filename){
|
||||
_vsize = indicesSize;
|
||||
|
||||
// float arrays
|
||||
float *tempVertexArray = new float[vertexSize];
|
||||
float *tempVertexNormalArray = new float[vertexNormalSize];
|
||||
float *tempVertexTextureArray = new float[vertexTextureSize];
|
||||
float* tempVertexArray = new float[vertexSize];
|
||||
float* tempVertexNormalArray = new float[vertexNormalSize];
|
||||
float* tempVertexTextureArray = new float[vertexTextureSize];
|
||||
_varray = new Vertex[_vsize];
|
||||
|
||||
// int arrays
|
||||
|
||||
@@ -78,6 +78,11 @@ Renderable::Renderable(const ghoul::Dictionary& dictionary)
|
||||
#endif
|
||||
// get path if available
|
||||
bool success = dictionary.getValue(constants::scenegraph::keyPathModule, _relativePath);
|
||||
#ifndef NDEBUG
|
||||
ghoul_assert(success,
|
||||
"Scenegraphnode need to specify '" << constants::scenegraph::keyPathModule
|
||||
<< "' because renderables is going to use this for debugging!");
|
||||
#endif
|
||||
if (success)
|
||||
_relativePath += ghoul::filesystem::FileSystem::PathSeparator;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user