Added mandatory logger information
This commit is contained in:
parent
d6444028f9
commit
e0ba87e4e5
23 changed files with 85 additions and 79 deletions
|
@ -110,8 +110,8 @@ bool DefinitionNode::applyDiff(const DefinitionDiff *diff, bool) {
|
||||||
if (diff->getTypeName() == type_name) {
|
if (diff->getTypeName() == type_name) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
Logs::error() << "[Definition] Can't apply " << diff->getTypeName() << " diff to " << getName() << " "
|
Logs::error("Definition") << "Can't apply " << diff->getTypeName() << " diff to " << getName() << " "
|
||||||
<< type_name << " node" << endl;
|
<< type_name << " node" << endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,8 +155,8 @@ void DefinitionNode::save(PackStream *stream) const {
|
||||||
child->save(stream);
|
child->save(stream);
|
||||||
} else {
|
} else {
|
||||||
// Child size not known, write it to a temporary stream to know it
|
// Child size not known, write it to a temporary stream to know it
|
||||||
Logs::debug() << "[Definition] Unknown size for child " << child->name
|
Logs::debug("Definition") << "Unknown size for child " << child->name
|
||||||
<< ", unefficient writing to temporary stream" << endl;
|
<< ", unefficient writing to temporary stream" << endl;
|
||||||
PackStream substream;
|
PackStream substream;
|
||||||
child->save(&substream);
|
child->save(&substream);
|
||||||
stream->writeFromBuffer(substream, true);
|
stream->writeFromBuffer(substream, true);
|
||||||
|
@ -183,7 +183,7 @@ void DefinitionNode::load(PackStream *stream) {
|
||||||
// TODO Ask subclass if it can instanciate a child
|
// TODO Ask subclass if it can instanciate a child
|
||||||
// Else skip length of unknown child
|
// Else skip length of unknown child
|
||||||
stream->skipBytes(child_size);
|
stream->skipBytes(child_size);
|
||||||
Logs::warning() << "[Definition] Skipped unknown child '" << child_name << "'" << endl;
|
Logs::warning("Definition") << "Skipped unknown child '" << child_name << "'" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -196,13 +196,13 @@ void DefinitionNode::copy(DefinitionNode *destination) const {
|
||||||
if (dest_child) {
|
if (dest_child) {
|
||||||
child->copy(dest_child);
|
child->copy(dest_child);
|
||||||
} else {
|
} else {
|
||||||
Logs::warning() << "[Definition] Can't copy to child " << child->name << " of "
|
Logs::warning("Definition") << "Can't copy to child " << child->name << " of "
|
||||||
<< destination->getTypeName() << endl;
|
<< destination->getTypeName() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Logs::error() << "[Definition] Can't copy from " << getTypeName() << " to " << destination->getTypeName()
|
Logs::error("Definition") << "Can't copy from " << getTypeName() << " to " << destination->getTypeName()
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,8 +226,8 @@ void DefinitionNode::removeChild(DefinitionNode *child) {
|
||||||
child->parent = NULL;
|
child->parent = NULL;
|
||||||
children.erase(it);
|
children.erase(it);
|
||||||
} else {
|
} else {
|
||||||
Logs::warning() << "[Definition] Trying to remove not found child '" << child->name << "' from '" << name << "'"
|
Logs::warning("Definition") << "Trying to remove not found child '" << child->name << "' from '" << name << "'"
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,6 @@ void DefinitionWatcher::startWatching(const DefinitionNode *root, const string &
|
||||||
if (node) {
|
if (node) {
|
||||||
node->addWatcher(this, init_diff);
|
node->addWatcher(this, init_diff);
|
||||||
} else {
|
} else {
|
||||||
Logs::warning() << "[Definition] Node not found for watching : " << path << endl;
|
Logs::warning("Definition") << "Node not found for watching : " << path << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ void DiffManager::undo() {
|
||||||
watcher->nodeChanged(node, diff);
|
watcher->nodeChanged(node, diff);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Logs::error() << "Can't find node to undo diff : " << diff->getPath() << endl;
|
Logs::error("Definition") << "Can't find node to undo diff : " << diff->getPath() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ void DiffManager::redo() {
|
||||||
watcher->nodeChanged(node, diff);
|
watcher->nodeChanged(node, diff);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Logs::error() << "Can't find node to redo diff : " << diff->getPath() << endl;
|
Logs::error("Definition") << "Can't find node to redo diff : " << diff->getPath() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,8 @@ void FloatNode::copy(DefinitionNode *destination) const {
|
||||||
if (destination->getTypeName() == getTypeName()) {
|
if (destination->getTypeName() == getTypeName()) {
|
||||||
((FloatNode *)destination)->value = value;
|
((FloatNode *)destination)->value = value;
|
||||||
} else {
|
} else {
|
||||||
Logs::error() << "[Definition] Can't copy from " << getTypeName() << " to " << destination->getTypeName() << endl;
|
Logs::error("Definition") << "Can't copy from " << getTypeName() << " to " << destination->getTypeName()
|
||||||
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +62,8 @@ bool FloatNode::applyDiff(const DefinitionDiff *diff, bool backward) {
|
||||||
value = next;
|
value = next;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
Logs::error() << "[Definition] Can't apply float diff " << previous << " => " << next << " to " << getName() << endl;
|
Logs::error("Definition") << "Can't apply float diff " << previous << " => " << next << " to " << getName()
|
||||||
|
<< endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,8 @@ void IntNode::copy(DefinitionNode *destination) const {
|
||||||
if (destination->getTypeName() == getTypeName()) {
|
if (destination->getTypeName() == getTypeName()) {
|
||||||
((IntNode *)destination)->value = value;
|
((IntNode *)destination)->value = value;
|
||||||
} else {
|
} else {
|
||||||
Logs::error() << "[Definition] Can't copy from " << getTypeName() << " to " << destination->getTypeName() << endl;
|
Logs::error("Definition") << "Can't copy from " << getTypeName() << " to " << destination->getTypeName()
|
||||||
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +62,8 @@ bool IntNode::applyDiff(const DefinitionDiff *diff, bool backward) {
|
||||||
value = next;
|
value = next;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
Logs::error() << "[Definition] Can't apply int diff " << previous << " => " << next << " to " << getName() << endl;
|
Logs::error("Definition") << "Can't apply int diff " << previous << " => " << next << " to " << getName()
|
||||||
|
<< endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,8 +68,8 @@ DefinitionNode *Layers::getLayer(int position) const {
|
||||||
if (position >= 0 and position < (int)layers.size()) {
|
if (position >= 0 and position < (int)layers.size()) {
|
||||||
return layers[position];
|
return layers[position];
|
||||||
} else {
|
} else {
|
||||||
Logs::warning() << "Asked for a undefined layer " << position << " on a total of " << (int)layers.size()
|
Logs::warning("Definition") << "Asked for a undefined layer " << position << " on a total of "
|
||||||
<< endl;
|
<< (int)layers.size() << endl;
|
||||||
return null_layer;
|
return null_layer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,12 +81,13 @@ bool Layers::applyDiff(const DefinitionDiff *diff, bool backward) {
|
||||||
|
|
||||||
if ((not backward and op == LayersDiff::LAYER_ADDED) or (backward and op == LayersDiff::LAYER_REMOVED)) {
|
if ((not backward and op == LayersDiff::LAYER_ADDED) or (backward and op == LayersDiff::LAYER_REMOVED)) {
|
||||||
if (layer_count >= max_layer_count) {
|
if (layer_count >= max_layer_count) {
|
||||||
Logs::warning() << "Add layer ignored because limit of " << max_layer_count << " reached" << endl;
|
Logs::warning("Definition") << "Add layer ignored because limit of " << max_layer_count << " reached"
|
||||||
|
<< endl;
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
int position = layer_diff->getLayer1();
|
int position = layer_diff->getLayer1();
|
||||||
if (position < 0 or position > layer_count) {
|
if (position < 0 or position > layer_count) {
|
||||||
Logs::error() << "Add layer ignored because requested position was incorrect" << endl;
|
Logs::error("Definition") << "Add layer ignored because requested position was incorrect" << endl;
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
DefinitionNode *layer = layer_constructor(this, "temp");
|
DefinitionNode *layer = layer_constructor(this, "temp");
|
||||||
|
@ -103,8 +104,8 @@ bool Layers::applyDiff(const DefinitionDiff *diff, bool backward) {
|
||||||
} else if ((not backward and op == LayersDiff::LAYER_REMOVED) or (backward and op == LayersDiff::LAYER_ADDED)) {
|
} else if ((not backward and op == LayersDiff::LAYER_REMOVED) or (backward and op == LayersDiff::LAYER_ADDED)) {
|
||||||
int position = layer_diff->getLayer1();
|
int position = layer_diff->getLayer1();
|
||||||
if (position < 0 or position >= layer_count) {
|
if (position < 0 or position >= layer_count) {
|
||||||
Logs::warning() << "Removing unknown layer " << position << " on " << layer_count << " from '" << getName()
|
Logs::warning("Definition") << "Removing unknown layer " << position << " on " << layer_count << " from '"
|
||||||
<< "'" << endl;
|
<< getName() << "'" << endl;
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
DefinitionNode *removed = layers[position];
|
DefinitionNode *removed = layers[position];
|
||||||
|
|
|
@ -31,7 +31,8 @@ void NoiseNode::copy(DefinitionNode *destination) const {
|
||||||
if (destination->getTypeName() == getTypeName()) {
|
if (destination->getTypeName() == getTypeName()) {
|
||||||
noise->copy(((NoiseNode *)destination)->noise);
|
noise->copy(((NoiseNode *)destination)->noise);
|
||||||
} else {
|
} else {
|
||||||
Logs::error() << "[Definition] Can't copy from " << getTypeName() << " to " << destination->getTypeName() << endl;
|
Logs::error("Definition") << "Can't copy from " << getTypeName() << " to " << destination->getTypeName()
|
||||||
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ Scenery::FileOperationResult Scenery::saveGlobal(const string &filepath) const {
|
||||||
stream.write(&version_header);
|
stream.write(&version_header);
|
||||||
stream.write(&app_header);
|
stream.write(&app_header);
|
||||||
|
|
||||||
Logs::debug() << "[Definition] Scenery saved to file: " << filepath << endl;
|
Logs::debug("Definition") << "Scenery saved to file: " << filepath << endl;
|
||||||
return FILE_OPERATION_OK;
|
return FILE_OPERATION_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ Scenery::FileOperationResult Scenery::loadGlobal(const string &filepath) {
|
||||||
return FILE_OPERATION_APP_MISMATCH;
|
return FILE_OPERATION_APP_MISMATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logs::debug() << "[Definition] Scenery loaded from file: " << filepath << endl;
|
Logs::debug("Definition") << "Scenery loaded from file: " << filepath << endl;
|
||||||
return FILE_OPERATION_OK;
|
return FILE_OPERATION_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,10 +115,10 @@ void Scenery::redo() {
|
||||||
_nodeclass_ *tnode = (_nodeclass_ *)node; \
|
_nodeclass_ *tnode = (_nodeclass_ *)node; \
|
||||||
tnode->setValue(_value_); \
|
tnode->setValue(_value_); \
|
||||||
} else { \
|
} else { \
|
||||||
Logs::warning() << "[Definition] Node " << path << " of wrong type for value " << value << endl; \
|
Logs::warning("Definition") << "Node " << path << " of wrong type for value " << value << endl; \
|
||||||
} \
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
Logs::warning() << "[Definition] Can't find node " << path << " to set to " << value << endl; \
|
Logs::warning("Definition") << "Can't find node " << path << " to set to " << value << endl; \
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scenery::set(const string &path, const int &value) {
|
void Scenery::set(const string &path, const int &value) {
|
||||||
|
@ -146,7 +146,7 @@ void Scenery::autoPreset(RandomGenerator &random) {
|
||||||
|
|
||||||
validate();
|
validate();
|
||||||
|
|
||||||
Logs::debug() << "[Definition] New scenery generated from seed " << random.getSeed() << endl;
|
Logs::debug("Definition") << "New scenery generated from seed " << random.getSeed() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scenery::autoPreset(unsigned int seed) {
|
void Scenery::autoPreset(unsigned int seed) {
|
||||||
|
|
|
@ -15,7 +15,7 @@ FloatPropertyBind::FloatPropertyBind(MainModelerWindow *window, const QString &o
|
||||||
connect(item, SIGNAL(changed(double)), this, SLOT(propertyChanged(double)));
|
connect(item, SIGNAL(changed(double)), this, SLOT(propertyChanged(double)));
|
||||||
} else {
|
} else {
|
||||||
item = NULL;
|
item = NULL;
|
||||||
Logs::error() << "Can't find object :" << object_name.toStdString() << endl;
|
Logs::error("UI") << "Can't find object :" << object_name.toStdString() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ IntPropertyBind::IntPropertyBind(MainModelerWindow *window, const QString &objec
|
||||||
connect(item, SIGNAL(changed(int)), this, SLOT(propertyChanged(int)));
|
connect(item, SIGNAL(changed(int)), this, SLOT(propertyChanged(int)));
|
||||||
} else {
|
} else {
|
||||||
item = NULL;
|
item = NULL;
|
||||||
Logs::error() << "Can't find object :" << object_name.toStdString() << endl;
|
Logs::error("UI") << "Can't find object :" << object_name.toStdString() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ void MainModelerWindow::setQmlProperty(const QString &objectName, const QString
|
||||||
if (item) {
|
if (item) {
|
||||||
item->setProperty(propertyName.toLocal8Bit(), value);
|
item->setProperty(propertyName.toLocal8Bit(), value);
|
||||||
} else {
|
} else {
|
||||||
Logs::error() << "QML object not found :" << objectName.toStdString() << endl;
|
Logs::error("UI") << "QML object not found :" << objectName.toStdString() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ void MainModelerWindow::connectQmlSignal(const QString &objectName, const char *
|
||||||
if (item) {
|
if (item) {
|
||||||
connect(item, signal, receiver, method);
|
connect(item, signal, receiver, method);
|
||||||
} else {
|
} else {
|
||||||
Logs::error() << "QML object not found :" << objectName.toStdString() << endl;
|
Logs::error("UI") << "QML object not found :" << objectName.toStdString() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,8 +137,8 @@ void MainModelerWindow::keyReleaseEvent(QKeyEvent *event) {
|
||||||
} else if (event->key() == Qt::Key_F6) {
|
} else if (event->key() == Qt::Key_F6) {
|
||||||
render_process->showPreviousRender();
|
render_process->showPreviousRender();
|
||||||
} else if (event->key() == Qt::Key_F12) {
|
} else if (event->key() == Qt::Key_F12) {
|
||||||
Logs::warning() << "Current scenery dump:" << endl
|
Logs::warning("UI") << "Current scenery dump:" << endl
|
||||||
<< scenery->toString() << endl;
|
<< scenery->toString() << endl;
|
||||||
} else if (event->key() == Qt::Key_N) {
|
} else if (event->key() == Qt::Key_N) {
|
||||||
if (event->modifiers() & Qt::ControlModifier) {
|
if (event->modifiers() & Qt::ControlModifier) {
|
||||||
newFile();
|
newFile();
|
||||||
|
|
|
@ -74,7 +74,7 @@ void OpenGLRenderer::prepare() {
|
||||||
void OpenGLRenderer::checkForErrors(const string &domain) {
|
void OpenGLRenderer::checkForErrors(const string &domain) {
|
||||||
int error_code;
|
int error_code;
|
||||||
while ((error_code = functions->glGetError()) != GL_NO_ERROR) {
|
while ((error_code = functions->glGetError()) != GL_NO_ERROR) {
|
||||||
Logs::warning() << "[OpenGL] Error in " << domain << " : " << error_code << endl;
|
Logs::warning("OpenGL") << "Error in " << domain << " : " << error_code << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,8 +92,8 @@ void OpenGLRenderer::initialize() {
|
||||||
bool init = functions->initializeOpenGLFunctions();
|
bool init = functions->initializeOpenGLFunctions();
|
||||||
|
|
||||||
if (init) {
|
if (init) {
|
||||||
Logs::debug() << "[OpenGL] renderer started (version " << functions->glGetString(GL_VERSION)
|
Logs::debug("OpenGL") << "Renderer started (version " << functions->glGetString(GL_VERSION) << ", glsl version "
|
||||||
<< ", glsl version " << functions->glGetString(GL_SHADING_LANGUAGE_VERSION) << ")" << endl;
|
<< functions->glGetString(GL_SHADING_LANGUAGE_VERSION) << ")" << endl;
|
||||||
|
|
||||||
prepareOpenGLState();
|
prepareOpenGLState();
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ void OpenGLRenderer::initialize() {
|
||||||
checkForErrors("initialize");
|
checkForErrors("initialize");
|
||||||
ready = true;
|
ready = true;
|
||||||
} else {
|
} else {
|
||||||
Logs::error() << "[OpenGL] Failed to initialize api bindings" << endl;
|
Logs::error("OpenGL") << "Failed to initialize api bindings" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ void OpenGLShaderProgram::addVertexSource(const string &path) {
|
||||||
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
source_vertex += QString(file.readAll()).toStdString();
|
source_vertex += QString(file.readAll()).toStdString();
|
||||||
} else {
|
} else {
|
||||||
Logs::error() << "[OpenGL] Can't open vertex file " << file.fileName().toStdString() << endl;
|
Logs::error("OpenGL") << "Can't open vertex file " << file.fileName().toStdString() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ void OpenGLShaderProgram::addFragmentSource(const string &path) {
|
||||||
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
source_fragment += QString(file.readAll()).toStdString();
|
source_fragment += QString(file.readAll()).toStdString();
|
||||||
} else {
|
} else {
|
||||||
Logs::error() << "[OpenGL] Can't open fragment file " << file.fileName().toStdString() << endl;
|
Logs::error("OpenGL") << "Can't open fragment file " << file.fileName().toStdString() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,13 +57,13 @@ void OpenGLShaderProgram::compile() {
|
||||||
program->bindAttributeLocation("uv", 1);
|
program->bindAttributeLocation("uv", 1);
|
||||||
|
|
||||||
if (not program->link()) {
|
if (not program->link()) {
|
||||||
Logs::warning() << "[OpenGL] Error while compiling shader " << name << endl
|
Logs::warning("OpenGL") << "Error while compiling shader " << name << endl
|
||||||
<< program->log().toStdString() << endl;
|
<< program->log().toStdString() << endl;
|
||||||
} else if (program->log().length() > 0) {
|
} else if (program->log().length() > 0) {
|
||||||
Logs::debug() << "[OpenGL] Shader " << name << " compilation output:" << endl
|
Logs::debug("OpenGL") << "Shader " << name << " compilation output:" << endl
|
||||||
<< program->log().toStdString() << endl;
|
<< program->log().toStdString() << endl;
|
||||||
} else {
|
} else {
|
||||||
Logs::debug() << "[OpenGL] Shader " << name << " compiled" << endl;
|
Logs::debug("OpenGL") << "Shader " << name << " compiled" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ void OpenGLSkybox::initialize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLSkybox::update() {
|
void OpenGLSkybox::update() {
|
||||||
Logs::debug() << "[OpenGL] Updating atmosphere textures" << endl;
|
Logs::debug("OpenGL") << "Updating atmosphere textures" << endl;
|
||||||
|
|
||||||
SoftwareBrunetonAtmosphereRenderer *bruneton =
|
SoftwareBrunetonAtmosphereRenderer *bruneton =
|
||||||
(SoftwareBrunetonAtmosphereRenderer *)renderer->getAtmosphereRenderer();
|
(SoftwareBrunetonAtmosphereRenderer *)renderer->getAtmosphereRenderer();
|
||||||
|
@ -91,8 +91,7 @@ void OpenGLSkybox::nodeChanged(const DefinitionNode *node, const DefinitionDiff
|
||||||
DefinitionWatcher::nodeChanged(node, diff);
|
DefinitionWatcher::nodeChanged(node, diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLSkybox::floatNodeChanged(const string &path, double new_value, double)
|
void OpenGLSkybox::floatNodeChanged(const string &path, double new_value, double) {
|
||||||
{
|
|
||||||
OpenGLSharedState *state = renderer->getSharedState();
|
OpenGLSharedState *state = renderer->getSharedState();
|
||||||
|
|
||||||
if (path == path_humidity) {
|
if (path == path_humidity) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ OpenGLVariable::~OpenGLVariable() {
|
||||||
delete[] value_texture_data;
|
delete[] value_texture_data;
|
||||||
|
|
||||||
if (texture_id) {
|
if (texture_id) {
|
||||||
Logs::warning() << "[OpenGL] Texture ID not freed " << texture_id << endl;
|
Logs::warning("OpenGL") << "Texture ID not freed " << texture_id << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ OpenGLVertexArray::OpenGLVertexArray(bool has_uv, bool strip) : has_uv(has_uv) {
|
||||||
|
|
||||||
OpenGLVertexArray::~OpenGLVertexArray() {
|
OpenGLVertexArray::~OpenGLVertexArray() {
|
||||||
if (vao || vbo_vertex || vbo_uv) {
|
if (vao || vbo_vertex || vbo_uv) {
|
||||||
Logs::warning() << "[OpenGL] VertexArray not freed in OpenGL state before destructor called" << endl;
|
Logs::warning("OpenGL") << "VertexArray not freed in OpenGL state before destructor called" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(array_vertex);
|
free(array_vertex);
|
||||||
|
@ -79,7 +79,7 @@ void OpenGLVertexArray::set(int index, const Vector3 &location, double u, double
|
||||||
array_uv[index * 2 + 1] = v;
|
array_uv[index * 2 + 1] = v;
|
||||||
changed = true;
|
changed = true;
|
||||||
} else {
|
} else {
|
||||||
Logs::error() << "[OpenGL] Setting vertex data outside of array bounds" << endl;
|
Logs::error("OpenGL") << "Setting vertex data outside of array bounds" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ void OpenGLVertexArray::get(int index, Vector3 *location, double *u, double *v)
|
||||||
*u = array_uv[index * 2];
|
*u = array_uv[index * 2];
|
||||||
*v = array_uv[index * 2 + 1];
|
*v = array_uv[index * 2 + 1];
|
||||||
} else {
|
} else {
|
||||||
Logs::error() << "[OpenGL] Getting vertex data outside of array bounds" << endl;
|
Logs::error("OpenGL") << "Getting vertex data outside of array bounds" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ void OpenGLWater::update() {
|
||||||
state->set("waterMaterialShininess", water->material->shininess);
|
state->set("waterMaterialShininess", water->material->shininess);
|
||||||
state->set("waterMaterialHardness", water->material->hardness);
|
state->set("waterMaterialHardness", water->material->hardness);
|
||||||
|
|
||||||
Logs::debug() << "[OpenGL] Updating simplex texture" << endl;
|
Logs::debug("OpenGL") << "Updating simplex texture" << endl;
|
||||||
state->set("simplexSampler", NoiseFunctionSimplex::getNormalTexture(), true, true);
|
state->set("simplexSampler", NoiseFunctionSimplex::getNormalTexture(), true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ BaseCloudLayerRenderer *CloudsRenderer::getLayerRenderer(unsigned int layer) {
|
||||||
if (layer < layer_renderers.size()) {
|
if (layer < layer_renderers.size()) {
|
||||||
return layer_renderers[layer];
|
return layer_renderers[layer];
|
||||||
} else {
|
} else {
|
||||||
Logs::warning() << "Asked for unknown layer renderer " << layer << endl;
|
Logs::warning("Software.Clouds") << "Asked for unknown layer renderer " << layer << endl;
|
||||||
return fake_renderer;
|
return fake_renderer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ BaseCloudsModel *CloudsRenderer::getLayerModel(unsigned int layer) {
|
||||||
if (layer < layer_models.size()) {
|
if (layer < layer_models.size()) {
|
||||||
return layer_models[layer];
|
return layer_models[layer];
|
||||||
} else {
|
} else {
|
||||||
Logs::warning() << "Asked for unknown layer model" << layer << endl;
|
Logs::warning("Software.Clouds") << "Asked for unknown layer model" << layer << endl;
|
||||||
return fake_model;
|
return fake_model;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ void CloudsRenderer::setLayerModel(unsigned int layer, BaseCloudsModel *model, b
|
||||||
}
|
}
|
||||||
layer_models[layer] = model;
|
layer_models[layer] = model;
|
||||||
} else {
|
} else {
|
||||||
Logs::warning() << "Asked to set an unknown layer model" << layer << endl;
|
Logs::warning("Software.Clouds") << "Asked to set an unknown layer model" << layer << endl;
|
||||||
delete model;
|
delete model;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ void RenderProgress::exitSub() {
|
||||||
|
|
||||||
void RenderProgress::end() {
|
void RenderProgress::end() {
|
||||||
if (subs.size() > 0) {
|
if (subs.size() > 0) {
|
||||||
Logs::error() << subs.size() << " progress subs remaining at the end of render" << endl;
|
Logs::error("Software") << subs.size() << " progress subs remaining at the end of render" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
end_time = Time::getRelativeTimeMs();
|
end_time = Time::getRelativeTimeMs();
|
||||||
|
|
|
@ -21,7 +21,7 @@ string DataFile::findDir(const string &relpath) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DataFile::tryDataDir(const QDir &dir) {
|
bool DataFile::tryDataDir(const QDir &dir) {
|
||||||
Logs::debug() << "[System] Try data dir " << dir.absolutePath().toStdString() << endl;
|
Logs::debug("System") << "Try data dir " << dir.absolutePath().toStdString() << endl;
|
||||||
return dir.exists("data/.paysages_data");
|
return dir.exists("data/.paysages_data");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,11 +50,11 @@ string DataFile::locateDataDir() {
|
||||||
string DataFile::initDataDir() {
|
string DataFile::initDataDir() {
|
||||||
string parent = locateDataDir();
|
string parent = locateDataDir();
|
||||||
if (parent.empty()) {
|
if (parent.empty()) {
|
||||||
Logs::warning() << "[System] Data files not found" << endl;
|
Logs::warning("System") << "Data files not found" << endl;
|
||||||
return parent;
|
return parent;
|
||||||
} else {
|
} else {
|
||||||
string result = QDir(QString::fromStdString(parent)).absoluteFilePath("data").toStdString();
|
string result = QDir(QString::fromStdString(parent)).absoluteFilePath("data").toStdString();
|
||||||
Logs::debug() << "[System] Data files found : " << result << endl;
|
Logs::debug("System") << "Data files found : " << result << endl;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,12 +25,12 @@ typedef basic_onullstream<char> onullstream;
|
||||||
static onullstream NULL_STREAM;
|
static onullstream NULL_STREAM;
|
||||||
static bool enabled = true;
|
static bool enabled = true;
|
||||||
|
|
||||||
ostream &Logs::debug() {
|
ostream &Logs::debug(const string &logger) {
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
return NULL_STREAM;
|
return NULL_STREAM;
|
||||||
#else
|
#else
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
cout << "DEBUG - ";
|
cout << "DEBUG [" << logger << "] ";
|
||||||
return cout;
|
return cout;
|
||||||
} else {
|
} else {
|
||||||
return NULL_STREAM;
|
return NULL_STREAM;
|
||||||
|
@ -38,26 +38,26 @@ ostream &Logs::debug() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ostream &Logs::warning() {
|
ostream &Logs::warning(const string &logger) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
cerr << "WARN - ";
|
cerr << "WARN [" << logger << "] ";
|
||||||
return cerr;
|
return cerr;
|
||||||
} else {
|
} else {
|
||||||
return NULL_STREAM;
|
return NULL_STREAM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ostream &Logs::error() {
|
ostream &Logs::error(const string &logger) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
cerr << "ERROR - ";
|
cerr << "ERROR [" << logger << "] ";
|
||||||
return cerr;
|
return cerr;
|
||||||
} else {
|
} else {
|
||||||
return NULL_STREAM;
|
return NULL_STREAM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logs::debugTimestamp(const string &message) {
|
void Logs::debugTimestamp(const string &logger, const string &message) {
|
||||||
debug() << Time::getRelativeTimeMs() << " - " << message << endl;
|
debug(logger) << Time::getRelativeTimeMs() << " - " << message << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logs::disable() {
|
void Logs::disable() {
|
||||||
|
|
|
@ -13,12 +13,12 @@ namespace system {
|
||||||
*/
|
*/
|
||||||
class SYSTEMSHARED_EXPORT Logs {
|
class SYSTEMSHARED_EXPORT Logs {
|
||||||
public:
|
public:
|
||||||
static ostream &debug();
|
static ostream &debug(const string &logger);
|
||||||
static ostream &warning();
|
static ostream &warning(const string &logger);
|
||||||
static ostream &error();
|
static ostream &error(const string &logger);
|
||||||
|
|
||||||
// Log a timestamp on the debug output
|
// Log a timestamp on the debug output
|
||||||
static void debugTimestamp(const string &message);
|
static void debugTimestamp(const string &logger, const string &message);
|
||||||
|
|
||||||
// Disable all logs from now on
|
// Disable all logs from now on
|
||||||
static void disable();
|
static void disable();
|
||||||
|
|
|
@ -24,8 +24,8 @@ PackStream::PackStream(const PackStream *other) {
|
||||||
file = NULL;
|
file = NULL;
|
||||||
buffer = new QByteArray();
|
buffer = new QByteArray();
|
||||||
if (other->file) {
|
if (other->file) {
|
||||||
Logs::error() << "Try to read from a substream bound to a file: " << other->file->fileName().toStdString()
|
Logs::error("System") << "Try to read from a substream bound to a file: "
|
||||||
<< endl;
|
<< other->file->fileName().toStdString() << endl;
|
||||||
stream = new QDataStream(buffer, QIODevice::ReadOnly);
|
stream = new QDataStream(buffer, QIODevice::ReadOnly);
|
||||||
} else {
|
} else {
|
||||||
stream = new QDataStream(other->buffer, QIODevice::ReadOnly);
|
stream = new QDataStream(other->buffer, QIODevice::ReadOnly);
|
||||||
|
@ -86,8 +86,8 @@ void PackStream::write(const string &value) {
|
||||||
|
|
||||||
void PackStream::writeFromBuffer(const PackStream &other, bool prepend_size) {
|
void PackStream::writeFromBuffer(const PackStream &other, bool prepend_size) {
|
||||||
if (other.file) {
|
if (other.file) {
|
||||||
Logs::error() << "Try to write from a substream bound to a file: " << other.file->fileName().toStdString()
|
Logs::error("System") << "Try to write from a substream bound to a file: "
|
||||||
<< endl;
|
<< other.file->fileName().toStdString() << endl;
|
||||||
} else {
|
} else {
|
||||||
if (prepend_size) {
|
if (prepend_size) {
|
||||||
int buffer_size = (int)other.buffer->size();
|
int buffer_size = (int)other.buffer->size();
|
||||||
|
@ -99,7 +99,8 @@ void PackStream::writeFromBuffer(const PackStream &other, bool prepend_size) {
|
||||||
|
|
||||||
string PackStream::getBuffer() {
|
string PackStream::getBuffer() {
|
||||||
if (file) {
|
if (file) {
|
||||||
Logs::error() << "Try to get buffer on a stream bound to a file: " << file->fileName().toStdString() << endl;
|
Logs::error("System") << "Try to get buffer on a stream bound to a file: " << file->fileName().toStdString()
|
||||||
|
<< endl;
|
||||||
return "";
|
return "";
|
||||||
} else {
|
} else {
|
||||||
return buffer->toStdString();
|
return buffer->toStdString();
|
||||||
|
|
Loading…
Reference in a new issue