[DEBUG] correct the texture display

This commit is contained in:
Edouard DUPIN 2016-04-24 16:22:01 +02:00
parent c8a5b1f125
commit f301a63acb
69 changed files with 256 additions and 427 deletions

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,10 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>
@ -25,11 +22,8 @@
// Documentetion of bullet library :
// http://bulletphysics.org/mediawiki-1.5.8/index.php/Collision_Shapes
#undef __class__
#define __class__ "CollisionShapeCreator"
btCollisionShape* ege::collision::createShape(const std::shared_ptr<ege::resource::Mesh>& _mesh) {
if (nullptr == _mesh) {
if (_mesh == nullptr) {
EGE_DEBUG("Create empty shape (no mesh)");
return new btEmptyShape();;
}
@ -40,7 +34,7 @@ btCollisionShape* ege::collision::createShape(const std::shared_ptr<ege::resourc
}
int32_t count = 0;
for (size_t iii=0; iii<physiqueProperty.size(); iii++) {
if (nullptr == physiqueProperty[iii]) {
if (physiqueProperty[iii] == nullptr) {
continue;
}
count++;
@ -53,19 +47,19 @@ btCollisionShape* ege::collision::createShape(const std::shared_ptr<ege::resourc
EGE_DEBUG("Create simple shape");
}
for (size_t iii=0; iii<physiqueProperty.size(); iii++) {
if (nullptr == physiqueProperty[iii]) {
if (physiqueProperty[iii] == nullptr) {
continue;
}
switch (physiqueProperty[iii]->getType()) {
case ege::PhysicsShape::box : {
EGE_DEBUG(" Box");
const ege::PhysicsBox* tmpElement = physiqueProperty[iii]->toBox();
if (nullptr == tmpElement) {
if (tmpElement == nullptr) {
// ERROR ...
continue;
}
btCollisionShape* tmpShape = new btBoxShape(tmpElement->getSize());
if (nullptr != tmpShape) {
if (tmpShape != nullptr) {
if (outputShape == nullptr) {
return tmpShape;
} else {
@ -79,12 +73,12 @@ btCollisionShape* ege::collision::createShape(const std::shared_ptr<ege::resourc
case ege::PhysicsShape::cylinder : {
EGE_DEBUG(" Cylinder");
const ege::PhysicsCylinder* tmpElement = physiqueProperty[iii]->toCylinder();
if (nullptr == tmpElement) {
if (tmpElement == nullptr) {
// ERROR ...
continue;
}
btCollisionShape* tmpShape = new btCylinderShape(tmpElement->getSize());
if (nullptr != tmpShape) {
if (tmpShape != nullptr) {
if (outputShape == nullptr) {
return tmpShape;
} else {
@ -98,12 +92,12 @@ btCollisionShape* ege::collision::createShape(const std::shared_ptr<ege::resourc
case ege::PhysicsShape::capsule : {
EGE_DEBUG(" Capsule");
const ege::PhysicsCapsule* tmpElement = physiqueProperty[iii]->toCapsule();
if (nullptr == tmpElement) {
if (tmpElement == nullptr) {
// ERROR ...
continue;
}
btCollisionShape* tmpShape = new btCapsuleShape(tmpElement->getRadius(), tmpElement->getHeight());
if (nullptr != tmpShape) {
if (tmpShape != nullptr) {
if (outputShape == nullptr) {
return tmpShape;
} else {
@ -117,12 +111,12 @@ btCollisionShape* ege::collision::createShape(const std::shared_ptr<ege::resourc
case ege::PhysicsShape::cone : {
EGE_DEBUG(" Cone");
const ege::PhysicsCone* tmpElement = physiqueProperty[iii]->toCone();
if (nullptr == tmpElement) {
if (tmpElement == nullptr) {
// ERROR ...
continue;
}
btCollisionShape* tmpShape = new btConeShape(tmpElement->getRadius(), tmpElement->getHeight());
if (nullptr != tmpShape) {
if (tmpShape != nullptr) {
if (outputShape == nullptr) {
return tmpShape;
} else {
@ -136,12 +130,12 @@ btCollisionShape* ege::collision::createShape(const std::shared_ptr<ege::resourc
case ege::PhysicsShape::sphere : {
EGE_DEBUG(" Sphere");
const ege::PhysicsSphere* tmpElement = physiqueProperty[iii]->toSphere();
if (nullptr == tmpElement) {
if (tmpElement == nullptr) {
// ERROR ...
continue;
}
btCollisionShape* tmpShape = new btSphereShape(tmpElement->getRadius());
if (nullptr != tmpShape) {
if (tmpShape != nullptr) {
if (outputShape == nullptr) {
return tmpShape;
} else {
@ -155,12 +149,12 @@ btCollisionShape* ege::collision::createShape(const std::shared_ptr<ege::resourc
case ege::PhysicsShape::convexHull : {
EGE_DEBUG(" convexHull");
const ege::PhysicsConvexHull* tmpElement = physiqueProperty[iii]->toConvexHull();
if (nullptr == tmpElement) {
if (tmpElement == nullptr) {
// ERROR ...
continue;
}
btConvexHullShape* tmpShape = new btConvexHullShape(&(tmpElement->getPointList()[0].x()), tmpElement->getPointList().size());
if (nullptr != tmpShape) {
if (tmpShape != nullptr) {
if (outputShape == nullptr) {
return tmpShape;
} else {
@ -177,7 +171,7 @@ btCollisionShape* ege::collision::createShape(const std::shared_ptr<ege::resourc
break;
}
}
if (nullptr == outputShape) {
if (outputShape == nullptr) {
EGE_DEBUG("create empty shape ...");
return new btEmptyShape();
}

View File

@ -1,10 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>
@ -26,10 +24,6 @@
#include <btBulletDynamicsCommon.h>
#include <BulletCollision/CollisionDispatch/btCollisionObject.h>
#undef __class__
#define __class__ "Environement"
std::shared_ptr<ege::Element> ege::Environement::getElementNearest(std::shared_ptr<ege::Element> _sourceRequest, float& _distance) {
if (_sourceRequest == nullptr) {
return nullptr;
@ -71,7 +65,7 @@ void ege::Environement::getElementNearest(const vec3& _sourcePosition,
for (size_t iii=0; iii<m_listElement.size() ; iii++) {
// chack nullptr pointer
result.element = m_listElement[iii];
if (nullptr == result.element) {
if (result.element == nullptr) {
continue;
}
// check distance ...
@ -156,7 +150,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
EGE_ERROR("allocation error '" << _type << "'");
return nullptr;
}
if (false == tmpElement->initString(_description)) {
if (tmpElement->initString(_description) == false) {
EGE_ERROR("Init error ... '" << _type << "'");
return nullptr;
}
@ -181,7 +175,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
EGE_ERROR("allocation error '" << _type << "'");
return nullptr;
}
if (false == tmpElement->initJSON(_value)) {
if (tmpElement->initJSON(_value) == false) {
EGE_ERROR("Init error ... '" << _type << "'");
return nullptr;
}
@ -206,7 +200,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
EGE_ERROR("allocation error '" << _type << "'");
return nullptr;
}
if (false == tmpElement->initXML(_node)) {
if (tmpElement->initXML(_node) == false) {
EGE_ERROR("Init error ... '" << _type << "'");
return nullptr;
}
@ -231,7 +225,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
EGE_ERROR("allocation error '" << _type << "'");
return nullptr;
}
if (false == tmpElement->initVoid(_data)) {
if (tmpElement->initVoid(_data) == false) {
EGE_ERROR("Init error ... '" << _type << "'");
return nullptr;
}
@ -256,7 +250,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
EGE_ERROR("allocation error '" << _type << "'");
return nullptr;
}
if (false == tmpElement->init()) {
if (tmpElement->init() == false) {
EGE_ERROR("Init error ... '" << _type << "'");
return nullptr;
}
@ -317,7 +311,7 @@ void ege::Environement::getOrderedElementForDisplay(std::vector<ege::Environemen
// for all element in the game we chek if it is needed to display it ...
for (size_t iii=0; iii<m_listElement.size() ; iii++) {
// chack nullptr pointer
if (nullptr == m_listElement[iii]) {
if (m_listElement[iii] == nullptr) {
// no pointer null are set in the output list ...
continue;
}
@ -360,7 +354,7 @@ void ege::Environement::getOrderedElementForDisplay(std::vector<ege::Environemen
void ege::Environement::generateInteraction(ege::ElementInteraction& _event) {
// inform the element that an element has been removed == > this permit to keep pointer on elements ...
for (size_t iii=0; iii<m_listElement.size() ; iii++) {
if (nullptr == m_listElement[iii]) {
if (m_listElement[iii] == nullptr) {
continue;
}
_event.applyEvent(*m_listElement[iii]);
@ -456,7 +450,7 @@ void ege::Environement::onCallbackPeriodicCall(const ewol::event::Time& _event)
++it;
}
}
if (0 != numberEnnemyKilled) {
if (numberEnnemyKilled != 0) {
//signalKillEnemy.emit(numberEnnemyKilled);
}
}

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/Light.h>
@ -28,7 +26,7 @@ ege::Light::~Light() {
}
void ege::Light::link(const std::shared_ptr<gale::resource::Program>& _prog, const std::string& _baseName) {
if (nullptr == _prog) {
if (_prog == nullptr) {
return;
}
m_GL_direction = _prog->getUniform(_baseName+".direction");

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <gale/resource/Manager.h>
@ -20,7 +18,7 @@ ege::MaterialGlId::MaterialGlId() :
}
void ege::MaterialGlId::link(const std::shared_ptr<gale::resource::Program>& _prog, const std::string& _baseName) {
if (nullptr == _prog) {
if (_prog == nullptr) {
return;
}
m_GL_ambientFactor = _prog->getUniform(_baseName+".ambientFactor");
@ -45,12 +43,14 @@ ege::Material::~Material() {
}
void ege::Material::draw(const std::shared_ptr<gale::resource::Program>& _prog, const MaterialGlId& _glID) {
EGE_INFO("draw Material : (start)");
_prog->uniform4(_glID.m_GL_ambientFactor, m_ambientFactor);
_prog->uniform4(_glID.m_GL_diffuseFactor, m_diffuseFactor);
_prog->uniform4(_glID.m_GL_specularFactor, m_specularFactor);
_prog->uniform1f(_glID.m_GL_shininess, m_shininess);
if (nullptr != m_texture0) {
_prog->setTexture0(_glID.m_GL_texture0, m_texture0->getId());
if (m_texture0 != nullptr) {
EGE_INFO(" set texture: " << _glID.m_GL_texture0 << " " << m_texture0->getId());
_prog->setTexture0(_glID.m_GL_texture0, m_texture0->getRendererId());
#if DEBUG
if (_prog->checkIdValidity(_glID.m_GL_texture0) == false) {
EGE_ERROR("try to set texture on a unexistant shader interface (wrong ID)");
@ -63,6 +63,7 @@ void ege::Material::draw(const std::shared_ptr<gale::resource::Program>& _prog,
}
#endif
}
EGE_INFO("draw Material: ( end )");
}
void ege::Material::setTexture0(const std::string& _filename) {

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,18 +1,13 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>
#include <ege/Particule.h>
#include <ege/ParticuleEngine.h>
#undef __class__
#define __class__ "Particule"
ege::Particule::Particule(ege::ParticuleEngine* _particuleEngine, const char* _particuleType) :
m_particuleEngine(_particuleEngine),
m_particuleType(_particuleType) {

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>
@ -11,9 +9,6 @@
#include <ege/Environement.h>
#include <ege/Particule.h>
#undef __class__
#define __class__ "ParticuleEngine"
ege::ParticuleEngine::ParticuleEngine(ege::Environement* _env) :
m_env(_env) {

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once
namespace ege {

View File

@ -1,23 +1,17 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>
#include <ege/ParticuleSimple.h>
#undef __class__
#define __class__ "ParticuleSimple"
ege::ParticuleSimple::ParticuleSimple(ege::ParticuleEngine* _particuleEngine, const char* _particuleType) :
Particule(_particuleEngine, _particuleType) {
init();
}
void ege::ParticuleSimple::init() {
m_lifeFull = 3;
m_life = m_lifeFull;

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <etk/types.h>
#include <ege/Ray.h>
@ -13,9 +11,6 @@
#include <BulletDynamics/Dynamics/btDynamicsWorld.h>
#include <BulletCollision/CollisionDispatch/btCollisionWorld.h>
#undef __class__
#define __class__ "Ray"
ege::Ray::Ray(const vec3& _origin, const vec3& _direction) :
m_origin(_origin),
m_direction(_direction) {

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2013, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
@ -12,9 +10,6 @@
#include <gale/renderer/openGL/openGL.h>
#undef __class__
#define __class__ "Camera"
ege::Camera::Camera() :
m_aspectRatio(0.5),
m_angleView(M_PI/3.0),

View File

@ -1,14 +1,11 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2013, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once
#include <etk/types.h>
#include <etk/math/Vector3D.h>
#include <etk/math/Vector2D.h>

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2013, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
@ -11,9 +9,6 @@
#include <ege/debug.h>
#include <etk/math/Vector3D.h>
#undef __class__
#define __class__ "camera::View"
void ege::camera::View::update() {
//m_matrix = etk::matLookAt(m_eye, m_target, m_up);
//m_matrix.translate(m_eye);

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2013, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <etk/types.h>
@ -80,7 +78,7 @@ bool ege::Element::unInit() {
bool ege::Element::loadMesh(const std::string& _meshFileName) {
std::shared_ptr<ege::resource::Mesh> tmpMesh = ege::resource::Mesh::create(_meshFileName);
if(nullptr == tmpMesh) {
if(tmpMesh == nullptr) {
EGE_ERROR("can not load the resources : " << _meshFileName);
return false;
}
@ -88,7 +86,7 @@ bool ege::Element::loadMesh(const std::string& _meshFileName) {
}
bool ege::Element::setMesh(const std::shared_ptr<ege::resource::Mesh>& _mesh) {
if (nullptr!=m_mesh) {
if (m_mesh != nullptr) {
m_mesh.reset();
}
m_mesh = _mesh;
@ -114,7 +112,7 @@ void ege::Element::setFireOn(int32_t _groupIdSource, int32_t _type, float _power
if (m_life <= 0) {
EGE_DEBUG("[" << getUID() << "] element is killed ..." << getType());
}
if (m_life!=previousLife) {
if (m_life != previousLife) {
onLifeChange();
}
}
@ -132,7 +130,7 @@ const float lifeWidth = 2.0f;
const float lifeYPos = 1.7f;
void ege::Element::drawLife(const std::shared_ptr<ewol::resource::Colored3DObject>& _draw, const std::shared_ptr<ege::Camera>& _camera) {
if (nullptr == _draw) {
if (_draw == nullptr) {
return;
}
float ratio = getLifeRatio();

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <etk/types.h>
@ -25,9 +23,6 @@
#include <ege/CollisionShapeCreator.h>
#undef __class__
#define __class__ "ElementPhysic"
const std::string& ege::ElementPhysic::getType() const {
static const std::string nameType("----");
return nameType;
@ -117,7 +112,7 @@ bool ege::ElementPhysic::setShape(btCollisionShape* _shape) {
void ege::ElementPhysic::removeShape() {
// no shape
if (nullptr == m_shape) {
if (m_shape == nullptr) {
return;
}
// need to chek if the shape is the same as the mesh shape ...

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/physics/Engine.h>

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,20 +1,17 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>
#include <ege/physicsShape/PhysicsBox.h>
bool ege::PhysicsBox::parse(const char* _line) {
if (true == ege::PhysicsShape::parse(_line)) {
if (ege::PhysicsShape::parse(_line) == true) {
return true;
}
if(0 == strncmp(_line, "half-extents : ", 15) ) {
if(strncmp(_line, "half-extents : ", 15) == 0) {
sscanf(&_line[15], "%f %f %f", &m_size.m_floats[0], &m_size.m_floats[1], &m_size.m_floats[2] );
EGE_VERBOSE(" halfSize=" << m_size);
return true;

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>
#include <ege/physicsShape/PhysicsCapsule.h>
@ -11,15 +9,15 @@
bool ege::PhysicsCapsule::parse(const char* _line) {
if (true == ege::PhysicsShape::parse(_line)) {
if (ege::PhysicsShape::parse(_line) == true) {
return true;
}
if(0 == strncmp(_line, "radius : ", 9) ) {
if(strncmp(_line, "radius : ", 9) == 0) {
sscanf(&_line[9], "%f", &m_radius );
EGE_VERBOSE(" radius=" << m_radius);
return true;
}
if(0 == strncmp(_line, "height : ", 9) ) {
if(strncmp(_line, "height : ", 9) == 0) {
sscanf(&_line[9], "%f", &m_height );
EGE_VERBOSE(" height=" << m_height);
return true;

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>
#include <ege/physicsShape/PhysicsCone.h>
@ -11,15 +9,15 @@
bool ege::PhysicsCone::parse(const char* _line) {
if (true == ege::PhysicsShape::parse(_line)) {
if (ege::PhysicsShape::parse(_line) == true) {
return true;
}
if(0 == strncmp(_line, "radius : ", 9) ) {
if(strncmp(_line, "radius : ", 9) == 0) {
sscanf(&_line[9], "%f", &m_radius );
EGE_VERBOSE(" radius=" << m_radius);
return true;
}
if(0 == strncmp(_line, "height : ", 9) ) {
if(strncmp(_line, "height : ", 9) == 0) {
sscanf(&_line[9], "%f", &m_height );
EGE_VERBOSE(" height=" << m_height);
return true;

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>
#include <ege/physicsShape/PhysicsConvexHull.h>
@ -11,10 +9,10 @@
bool ege::PhysicsConvexHull::parse(const char* _line) {
if (true == ege::PhysicsShape::parse(_line)) {
if (ege::PhysicsShape::parse(_line) == true) {
return true;
}
if(0 == strncmp(_line, "points : ", 8) ) {
if(strncmp(_line, "points : ", 8) == 0) {
//EGE_DEBUG("convex hull point parsing " << _line);
char* base = (char*)(&_line[8]);
char* tmp= strchr(base, '|');
@ -35,7 +33,7 @@ bool ege::PhysicsConvexHull::parse(const char* _line) {
*/
return true;
}
if(0 == strncmp(_line, "scale : ", 8) ) {
if(strncmp(_line, "scale : ", 8) == 0) {
sscanf(&_line[8], "%f %f %f", &m_scale.m_floats[0], &m_scale.m_floats[1], &m_scale.m_floats[2] );
EGE_VERBOSE(" scale=" << m_scale);
return true;

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,19 +1,17 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>
#include <ege/physicsShape/PhysicsCylinder.h>
bool ege::PhysicsCylinder::parse(const char* _line) {
if (true == ege::PhysicsShape::parse(_line)) {
if (ege::PhysicsShape::parse(_line) == true) {
return true;
}
if(0 == strncmp(_line, "half-extents : ", 15) ) {
if(strncmp(_line, "half-extents : ", 15) == 0) {
sscanf(&_line[15], "%f %f %f", &m_size.m_floats[0], &m_size.m_floats[1], &m_size.m_floats[2] );
EGE_VERBOSE(" halfSize=" << m_size);
return true;

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>
#include <ege/physicsShape/PhysicsShape.h>
@ -42,12 +40,12 @@ std::shared_ptr<ege::PhysicsShape> ege::PhysicsShape::create(const std::string&
bool ege::PhysicsShape::parse(const char* _line) {
if(0 == strncmp(_line, "origin : ", 9) ) {
if(strncmp(_line, "origin : ", 9) == 0) {
sscanf(&_line[9], "%f %f %f", &m_origin.m_floats[0], &m_origin.m_floats[1], &m_origin.m_floats[2] );
EGE_VERBOSE(" Origin=" << m_origin);
return true;
}
if(0 == strncmp(_line, "rotate : ", 9) ) {
if(strncmp(_line, "rotate : ", 9) == 0) {
sscanf(&_line[9], "%f %f %f %f", &m_quaternion.m_floats[0], &m_quaternion.m_floats[1], &m_quaternion.m_floats[2], &m_quaternion.m_floats[3] );
EGE_VERBOSE(" rotate=" << m_quaternion);
return true;

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>
#include <ege/physicsShape/PhysicsSphere.h>
@ -11,10 +9,10 @@
bool ege::PhysicsSphere::parse(const char* _line) {
if (true == ege::PhysicsShape::parse(_line)) {
if (ege::PhysicsShape::parse(_line) == true) {
return true;
}
if(0 == strncmp(_line, "radius : ", 9) ) {
if(strncmp(_line, "radius : ", 9) == 0) {
sscanf(&_line[9], "%f", &m_radius );
EGE_VERBOSE(" radius=" << m_radius);
return true;

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>
@ -15,9 +13,6 @@
#include <ege/resource/tools/isoSphere.h>
#include <ege/resource/tools/icoSphere.h>
#undef __class__
#define __class__ "resource::Mesh"
ege::resource::Mesh::Mesh() :
m_normalMode(normalModeNone),
m_checkNormal(false),
@ -46,7 +41,7 @@ void ege::resource::Mesh::init(const std::string& _fileName, const std::string&
m_light.setDiffuseColor(vec4(1.0f,1.0f,1.0f,1.0f));
m_light.setSpecularColor(vec4(0.0f,0.0f,0.0f,1.0f));
//EGE_DEBUG(m_name << " " << m_light);
EGE_ERROR(m_name << " " << m_light << " shader=" << _shaderName);
m_GLprogram = gale::resource::Program::create(_shaderName);
if (m_GLprogram != nullptr) {
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
@ -89,7 +84,7 @@ void ege::resource::Mesh::init(const std::string& _fileName, const std::string&
ege::resource::Mesh::~Mesh() {
// remove dynamics dependencies :
if (m_functionFreeShape!=nullptr) {
if (m_functionFreeShape != nullptr) {
m_functionFreeShape(m_pointerShape);
m_pointerShape = nullptr;
}
@ -110,8 +105,12 @@ void ege::resource::Mesh::clean() {
//#define DISPLAY_NB_VERTEX_DISPLAYED
void ege::resource::Mesh::draw(mat4& _positionMatrix,
bool _enableDepthTest,
bool _enableDepthUpdate) {
bool _enableDepthTest,
bool _enableDepthUpdate) {
// TODO : Remove this, it is just for test the 23-04-2016
//m_checkNormal = false;
EGE_INFO("draw Mesh : " << m_name << " (start)");
if (m_GLprogram == nullptr) {
EGE_ERROR("No shader ...");
return;
@ -159,7 +158,7 @@ void ege::resource::Mesh::draw(mat4& _positionMatrix,
int32_t nbElementDraw = 0;
#endif
for (int32_t kkk=0; kkk<m_listFaces.size(); kkk++) {
if (false == m_materials.exist(m_listFaces.getKey(kkk))) {
if (m_materials.exist(m_listFaces.getKey(kkk)) == false) {
EGE_WARNING("missing materials : '" << m_listFaces.getKey(kkk) << "'");
continue;
}
@ -239,6 +238,7 @@ void ege::resource::Mesh::draw(mat4& _positionMatrix,
}
// TODO : UNDERSTAND why ... it is needed
glBindBuffer(GL_ARRAY_BUFFER,0);
EGE_INFO("draw Mesh : " << m_name << " ( end )");
}
// normal calculation of the normal face is really easy :
@ -309,7 +309,7 @@ void ege::resource::Mesh::generateVBO() {
// when no normal detected == > auto generate Face normal ....
calculateNormaleFace(m_listFaces.getKeys()[0]);
}
EGE_WARNING("Generate VBO for nb faces : " << m_listFaces.size());
EGE_WARNING("Generate VBO for nb faces layers: " << m_listFaces.size() << " list layer=" << etk::to_string(m_listFaces.getKeys()));
// generate element in 2 pass :
// - create new index dependeng a vertex is a unique componenet of position, texture, normal
@ -392,7 +392,7 @@ void ege::resource::Mesh::generateVBO() {
}
}
#endif
if (false == elementFind) {
if (elementFind == false) {
m_verticesVBO->pushOnBuffer(MESH_VBO_VERTICES, position);
if (m_normalMode != normalModeNone) {
m_verticesVBO->pushOnBuffer(MESH_VBO_VERTICES_NORMAL, normal);
@ -431,7 +431,7 @@ void ege::resource::Mesh::createIcoSphere(const std::string& _materialName,float
void ege::resource::Mesh::addMaterial(const std::string& _name, std::shared_ptr<ege::Material> _data) {
if (nullptr == _data) {
if (_data == nullptr) {
EGE_ERROR(" can not add material with null pointer");
return;
}
@ -554,6 +554,7 @@ void ege::resource::Mesh::addTriangle(const std::string& _layerName,
const vec3& _pos1, const vec3& _pos2, const vec3& _pos3,
const vec2& _uv1, const vec2& _uv2, const vec2& _uv3,
const etk::Color<float>& _color1, const etk::Color<float>& _color2, const etk::Color<float>& _color3) {
EGE_INFO("add Triangle: " << _layerName << " ...");
if ( m_listFaces.exist(_layerName) == false
|| m_materials.exist(_layerName) == false) {
EGE_ERROR("Mesh layer : " << _layerName << " does not exist in list faces=" << m_listFaces.exist(_layerName) << " materials=" << m_listFaces.exist(_layerName) << " ...");
@ -583,6 +584,7 @@ void ege::resource::Mesh::addTriangle(const std::string& _layerName,
pos3, uv3);
tmpFace.setColor(color1, color2, color3);
m_listFaces[_layerName].m_faces.push_back(tmpFace);
EGE_INFO(" nbFace: " << m_listFaces[_layerName].m_faces.size());
}
void ege::resource::Mesh::addTriangle(const std::string& _layerName, const vec3& _pos1, const vec3& _pos2, const vec3& _pos3,

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>
@ -150,16 +148,16 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
EGE_ERROR("No data in the file named=\"" << fileName << "\"");
return false;
}
if(false == fileName.fileOpenRead() ) {
if (fileName.fileOpenRead() == false) {
EGE_ERROR("Can not find the file name=\"" << fileName << "\"");
return false;
}
char inputDataLine[2048];
// load the first line :
fileName.fileGets(inputDataLine, 2048);
if(0 == strncmp(inputDataLine, "EMF(STRING)", 11)) {
if(strncmp(inputDataLine, "EMF(STRING)", 11) == 0) {
// parse in string mode ...
} else if (0 == strncmp(inputDataLine, "EMF(BINARY)", 11)) {
} else if (strncmp(inputDataLine, "EMF(BINARY)", 11) == 0) {
EGE_ERROR(" file binary mode is not supported now : 'EMF(BINARY)'");
return false;
} else {
@ -176,18 +174,18 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
std::shared_ptr<ege::Material> material;
// physical shape:
std::shared_ptr<ege::PhysicsShape> physics;
while(1) {
while (1) {
int32_t level = countIndent(fileName);
if (level == 0) {
// new section ...
if (nullptr == loadNextData(inputDataLine, 2048, fileName)) {
if (loadNextData(inputDataLine, 2048, fileName) == nullptr) {
// reach end of file ...
break;
}
if(0 == strncmp(inputDataLine, "Mesh :", 6) ) {
if(strncmp(inputDataLine, "Mesh :", 6) == 0) {
currentMode = EMFModuleMesh;
EGE_VERBOSE("Parse Mesh :");
} else if(0 == strncmp(inputDataLine, "Materials : ", 11) ) {
} else if(strncmp(inputDataLine, "Materials : ", 11) == 0) {
currentMode = EMFModuleMaterial;
EGE_VERBOSE("Parse Material :");
} else {
@ -197,7 +195,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
if (currentMode >= EMFModuleMesh && currentMode <= EMFModuleMesh_END) {
if (level == 1) {
//Find mesh name ...
if (nullptr == loadNextData(inputDataLine, 2048, fileName, true)) {
if (loadNextData(inputDataLine, 2048, fileName, true) == nullptr) {
// reach end of file ...
break;
}
@ -209,27 +207,27 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
}
if (level == 2) {
// In the mesh level 2 the line size must not exced 2048
if (nullptr == loadNextData(inputDataLine, 2048, fileName, true)) {
if (loadNextData(inputDataLine, 2048, fileName, true) == nullptr) {
// reach end of file ...
break;
}
removeEndLine(inputDataLine);
if(0 == strncmp(inputDataLine, "Vertex", 6) ) {
if(strncmp(inputDataLine, "Vertex", 6) == 0) {
currentMode = EMFModuleMeshVertex;
EGE_VERBOSE(" Vertex ...");
} else if(0 == strncmp(inputDataLine, "UV-mapping", 10) ) {
} else if(strncmp(inputDataLine, "UV-mapping", 10) == 0) {
currentMode = EMFModuleMeshUVMapping;
EGE_VERBOSE(" UV-mapping ...");
} else if(0 == strncmp(inputDataLine, "Normal(vertex)", 14) ) {
} else if(strncmp(inputDataLine, "Normal(vertex)", 14) == 0) {
currentMode = EMFModuleMeshNormalVertex;
EGE_VERBOSE(" Normal(vertex) ...");
} else if(0 == strncmp(inputDataLine, "Normal(face)", 12) ) {
} else if(strncmp(inputDataLine, "Normal(face)", 12) == 0) {
currentMode = EMFModuleMeshNormalFace;
EGE_VERBOSE(" Normal(face) ...");
} else if(0 == strncmp(inputDataLine, "Face", 4) ) {
} else if(strncmp(inputDataLine, "Face", 4) == 0) {
currentMode = EMFModuleMeshFace;
EGE_VERBOSE(" Face ...");
} else if(0 == strncmp(inputDataLine, "Physics", 7) ) {
} else if(strncmp(inputDataLine, "Physics", 7) == 0) {
currentMode = EMFModuleMeshPhysics;
EGE_VERBOSE(" Physics ...");
} else {
@ -246,7 +244,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
break;
case EMFModuleMeshVertex: {
vec3 vertex(0,0,0);
while (nullptr != loadNextData(inputDataLine, 2048, fileName, true, true) ) {
while (loadNextData(inputDataLine, 2048, fileName, true, true) != nullptr) {
if (inputDataLine[0] == '\0') {
break;
}
@ -263,7 +261,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
}
case EMFModuleMeshUVMapping: {
vec2 uvMap(0,0);
while (nullptr != loadNextData(inputDataLine, 2048, fileName, true, true) ) {
while (loadNextData(inputDataLine, 2048, fileName, true, true) != nullptr) {
if (inputDataLine[0] == '\0') {
break;
}
@ -282,7 +280,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
m_normalMode = normalModeVertex;
vec3 normal(0,0,0);
// find the vertex Normal list.
while (nullptr != loadNextData(inputDataLine, 2048, fileName, true, true) ) {
while (loadNextData(inputDataLine, 2048, fileName, true, true) != nullptr) {
if (inputDataLine[0] == '\0') {
break;
}
@ -301,7 +299,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
m_normalMode = normalModeFace;
vec3 normal(0,0,0);
// find the face Normal list.
while (nullptr != loadNextData(inputDataLine, 2048, fileName, true, true) ) {
while (loadNextData(inputDataLine, 2048, fileName, true, true) != nullptr) {
if (inputDataLine[0] == '\0') {
break;
}
@ -320,7 +318,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
case EMFModuleMeshFaceMaterial:
if (level == 3) {
//Find mesh name ...
if (nullptr == loadNextData(inputDataLine, 2048, fileName, true)) {
if (loadNextData(inputDataLine, 2048, fileName, true) == nullptr) {
// reach end of file ...
break;
}
@ -332,7 +330,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
meshFaceMaterialID = m_listFaces.getId(inputDataLine);
EGE_VERBOSE(" " << inputDataLine);
} else if (currentMode == EMFModuleMeshFaceMaterial) {
while (nullptr != loadNextData(inputDataLine, 2048, fileName, true, true) ) {
while (loadNextData(inputDataLine, 2048, fileName, true, true) != nullptr) {
if (inputDataLine[0] == '\0') {
// end of line
break;
@ -377,7 +375,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
break;
case EMFModuleMeshPhysics:
case EMFModuleMeshPhysicsNamed:
if (nullptr == loadNextData(inputDataLine, 2048, fileName, true, false, false)) {
if (loadNextData(inputDataLine, 2048, fileName, true, false, false) == nullptr) {
// reach end of file ...
break;
}
@ -396,7 +394,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
EGE_ERROR("Can not parse :'" << inputDataLine << "' in physical shape ...");
continue;
}
if (false == physics->parse(inputDataLine)) {
if (physics->parse(inputDataLine) == false) {
EGE_ERROR("ERROR when parsing :'" << inputDataLine << "' in physical shape ...");
}
}
@ -405,7 +403,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
continue;
} else if (currentMode >= EMFModuleMaterial && currentMode <= EMFModuleMaterial_END) {
// all material element is stored on 1 line (size < 2048)
if (nullptr == loadNextData(inputDataLine, 2048, fileName, true)) {
if (loadNextData(inputDataLine, 2048, fileName, true) == nullptr) {
// reach end of file ...
break;
}
@ -413,7 +411,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
if (level == 1) {
// add previous material :
if( materialName != ""
&& material!=nullptr) {
&& material != nullptr) {
m_materials.add(materialName, material);
materialName = "";
material = nullptr;
@ -430,17 +428,17 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
jumpEndLine(fileName);
continue;
}
if (nullptr == material) {
if (material == nullptr) {
EGE_ERROR("material allocation error");
jumpEndLine(fileName);
continue;
}
if(0 == strncmp(inputDataLine,"Ns ",3)) {
if(strncmp(inputDataLine,"Ns ",3) == 0) {
float tmpVal=0;
sscanf(&inputDataLine[3], "%f", &tmpVal);
material->setShininess(tmpVal);
EGE_VERBOSE(" Shininess " << tmpVal);
} else if(0 == strncmp(inputDataLine,"Ka ",3)) {
} else if(strncmp(inputDataLine,"Ka ",3) == 0) {
float tmpVal1=0;
float tmpVal2=0;
float tmpVal3=0;
@ -448,7 +446,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
vec4 tmp(tmpVal1, tmpVal2, tmpVal3, 1);
material->setAmbientFactor(tmp);
EGE_VERBOSE(" AmbientFactor " << tmp);
} else if(0 == strncmp(inputDataLine,"Kd ",3)) {
} else if(strncmp(inputDataLine,"Kd ",3) == 0) {
float tmpVal1=0;
float tmpVal2=0;
float tmpVal3=0;
@ -456,7 +454,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
vec4 tmp(tmpVal1, tmpVal2, tmpVal3, 1);
material->setDiffuseFactor(tmp);
EGE_VERBOSE(" DiffuseFactor " << tmp);
} else if(0 == strncmp(inputDataLine,"Ks ",3)) {
} else if(strncmp(inputDataLine,"Ks ",3) == 0) {
float tmpVal1=0;
float tmpVal2=0;
float tmpVal3=0;
@ -464,25 +462,25 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
vec4 tmp(tmpVal1, tmpVal2, tmpVal3, 1);
material->setSpecularFactor(tmp);
EGE_VERBOSE(" SpecularFactor " << tmp);
} else if(0 == strncmp(inputDataLine,"Ni ",3)) {
} else if(strncmp(inputDataLine,"Ni ",3) == 0) {
float tmpVal=0;
sscanf(&inputDataLine[3], "%f", &tmpVal);
// TODO : ...
EGE_VERBOSE(" Ni " << tmpVal);
} else if(0 == strncmp(inputDataLine,"d ",2)) {
} else if(strncmp(inputDataLine,"d ",2) == 0) {
float tmpVal=0;
sscanf(&inputDataLine[2], "%f", &tmpVal);
// TODO : ...
EGE_VERBOSE(" d " << tmpVal);
} else if(0 == strncmp(inputDataLine,"illum ",6)) {
} else if(strncmp(inputDataLine,"illum ",6) == 0) {
int tmpVal=0;
sscanf(&inputDataLine[6], "%d", &tmpVal);
// TODO : ...
EGE_VERBOSE(" illum " << tmpVal);
} else if(0 == strncmp(inputDataLine,"map_Kd ",7)) {
} else if(strncmp(inputDataLine,"map_Kd ",7) == 0) {
material->setTexture0(fileName.getRelativeFolder() + &inputDataLine[7]);
EGE_VERBOSE(" Texture " << &inputDataLine[7]);
} else if(0 == strncmp(inputDataLine,"renderMode ",11)) {
} else if(strncmp(inputDataLine,"renderMode ",11) == 0) {
gale::openGL::renderMode mode;
etk::from_string(mode, &inputDataLine[11]);
material->setRenderMode(mode);
@ -499,7 +497,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
}
// add last material ...
if( materialName != ""
&& material!=nullptr) {
&& material != nullptr) {
m_materials.add(materialName, material);
materialName = "";
material.reset();

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>
@ -20,14 +18,14 @@ bool ege::resource::Mesh::loadOBJ(const std::string& _fileName) {
EGE_ERROR("No data in the file named=\"" << fileName << "\"");
return false;
}
if(false == fileName.fileOpenRead() ) {
if (fileName.fileOpenRead() == false) {
EGE_ERROR("Can not find the file name=\"" << fileName << "\"");
return false;
}
char inputDataLine[2048];
int32_t lineID = 0;
while (nullptr != fileName.fileGets(inputDataLine, 2048) )
while (fileName.fileGets(inputDataLine, 2048) != nullptr)
{
lineID++;
if (inputDataLine[0] == 'v') {
@ -81,7 +79,7 @@ bool ege::resource::Mesh::loadOBJ(const std::string& _fileName) {
}
}
}
if (true == quadMode) {
if (quadMode == true) {
m_listFaces.push_back(Face(vertexIndex[0]-1, uvIndex[0]-1,
vertexIndex[1]-1, uvIndex[1]-1,
vertexIndex[2]-1, uvIndex[2]-1,

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>
@ -38,7 +36,7 @@ void ege::resource::ParticuleMesh::draw(mat4& _positionMatrix,
//EGE_DEBUG(m_name << " " << m_light);
if (_enableDepthTest == true) {
gale::openGL::enable(gale::openGL::flag_depthTest);
if (false == _enableDepthUpdate) {
if (_enableDepthUpdate == false) {
glDepthMask(GL_FALSE);
}
} else {
@ -67,7 +65,7 @@ void ege::resource::ParticuleMesh::draw(mat4& _positionMatrix,
int32_t nbElementDraw = 0;
#endif
for (int32_t kkk=0; kkk<m_listFaces.size(); kkk++) {
if (false == m_materials.exist(m_listFaces.getKey(kkk))) {
if (m_materials.exist(m_listFaces.getKey(kkk)) == false) {
EGE_WARNING("missing materials : '" << m_listFaces.getKey(kkk) << "'");
continue;
}
@ -121,7 +119,7 @@ void ege::resource::ParticuleMesh::draw(mat4& _positionMatrix,
#endif
m_GLprogram->unUse();
if (_enableDepthTest == true){
if (false == _enableDepthUpdate) {
if (_enableDepthUpdate == false) {
glDepthMask(GL_TRUE);
}
gale::openGL::disable(gale::openGL::flag_depthTest);

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/widget/Mesh.h>
@ -11,11 +9,6 @@
#include <gale/resource/Manager.h>
#include <ege/debug.h>
#undef __class__
#define __class__ "Mesh"
ege::widget::Mesh::Mesh():
signalPressed(this, "pressed", ""),
m_position(0,0,0),
@ -30,9 +23,9 @@ void ege::widget::Mesh::init() {
m_meshName = *propertyName;
// Limit event at 1:
setMouseLimit(1);
if (*propertyName!="") {
if (*propertyName != "") {
m_object = ege::resource::Mesh::create(m_meshName);
if (nullptr == m_object) {
if (m_object == nullptr) {
EGE_ERROR("Can not load the resource : \"" << m_meshName << "\"");
}
}
@ -48,7 +41,7 @@ void ege::widget::Mesh::onDraw() {
* etk::matRotate(vec3(1,0,0),m_angle.x())
* etk::matRotate(vec3(0,1,0),m_angle.y())
* etk::matRotate(vec3(0,0,1),m_angle.z());
if (nullptr != m_object) {
if (m_object != nullptr) {
m_object->draw(transformationMatrix);
}
}
@ -70,7 +63,7 @@ void ege::widget::Mesh::systemDraw(const ewol::DrawProperty& _displayProp) {
}
void ege::widget::Mesh::onRegenerateDisplay() {
if (true == needRedraw()) {
if (needRedraw() == true) {
}
}
@ -96,7 +89,7 @@ void ege::widget::Mesh::setFile(const std::string& _filename) {
&& m_meshName != _filename ) {
m_meshName = _filename;
m_object = ege::resource::Mesh::create(m_meshName);
if (nullptr == m_object) {
if (m_object == nullptr) {
EGE_ERROR("Can not load the resource : \"" << m_meshName << "\"");
}
}
@ -114,7 +107,7 @@ void ege::widget::Mesh::setAngle(const vec3& _angle) {
}
void ege::widget::Mesh::setAngleSpeed(const vec3& _speed) {
if (_speed!=vec3(0,0,0)) {
if (_speed != vec3(0,0,0)) {
periodicCallEnable();
} else {
periodicCallDisable();

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#include <ege/debug.h>
@ -27,8 +25,6 @@
#include <btBulletDynamicsCommon.h>
#include <BulletCollision/CollisionDispatch/btCollisionObject.h>
#undef __class__
#define __class__ "Scene"
namespace etk {
template<> std::string to_string<std::shared_ptr<ewol::resource::Colored3DObject> >(const std::shared_ptr<ewol::resource::Colored3DObject>& _value) {
return "{{ERROR}}";
@ -60,7 +56,7 @@ ege::widget::Scene::~Scene() {
}
void ege::widget::Scene::onRegenerateDisplay() {
if (true == needRedraw()) {
if (needRedraw() == true) {
}
}

View File

@ -1,9 +1,7 @@
/**
/** @file
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
* @license APACHE v2.0 (see license file)
*/
#pragma once