[DEBUG] correct the texture display
This commit is contained in:
parent
c8a5b1f125
commit
f301a63acb
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
@ -25,11 +22,8 @@
|
|||||||
// Documentetion of bullet library :
|
// Documentetion of bullet library :
|
||||||
// http://bulletphysics.org/mediawiki-1.5.8/index.php/Collision_Shapes
|
// 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) {
|
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)");
|
EGE_DEBUG("Create empty shape (no mesh)");
|
||||||
return new btEmptyShape();;
|
return new btEmptyShape();;
|
||||||
}
|
}
|
||||||
@ -40,7 +34,7 @@ btCollisionShape* ege::collision::createShape(const std::shared_ptr<ege::resourc
|
|||||||
}
|
}
|
||||||
int32_t count = 0;
|
int32_t count = 0;
|
||||||
for (size_t iii=0; iii<physiqueProperty.size(); iii++) {
|
for (size_t iii=0; iii<physiqueProperty.size(); iii++) {
|
||||||
if (nullptr == physiqueProperty[iii]) {
|
if (physiqueProperty[iii] == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
@ -53,19 +47,19 @@ btCollisionShape* ege::collision::createShape(const std::shared_ptr<ege::resourc
|
|||||||
EGE_DEBUG("Create simple shape");
|
EGE_DEBUG("Create simple shape");
|
||||||
}
|
}
|
||||||
for (size_t iii=0; iii<physiqueProperty.size(); iii++) {
|
for (size_t iii=0; iii<physiqueProperty.size(); iii++) {
|
||||||
if (nullptr == physiqueProperty[iii]) {
|
if (physiqueProperty[iii] == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
switch (physiqueProperty[iii]->getType()) {
|
switch (physiqueProperty[iii]->getType()) {
|
||||||
case ege::PhysicsShape::box : {
|
case ege::PhysicsShape::box : {
|
||||||
EGE_DEBUG(" Box");
|
EGE_DEBUG(" Box");
|
||||||
const ege::PhysicsBox* tmpElement = physiqueProperty[iii]->toBox();
|
const ege::PhysicsBox* tmpElement = physiqueProperty[iii]->toBox();
|
||||||
if (nullptr == tmpElement) {
|
if (tmpElement == nullptr) {
|
||||||
// ERROR ...
|
// ERROR ...
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
btCollisionShape* tmpShape = new btBoxShape(tmpElement->getSize());
|
btCollisionShape* tmpShape = new btBoxShape(tmpElement->getSize());
|
||||||
if (nullptr != tmpShape) {
|
if (tmpShape != nullptr) {
|
||||||
if (outputShape == nullptr) {
|
if (outputShape == nullptr) {
|
||||||
return tmpShape;
|
return tmpShape;
|
||||||
} else {
|
} else {
|
||||||
@ -79,12 +73,12 @@ btCollisionShape* ege::collision::createShape(const std::shared_ptr<ege::resourc
|
|||||||
case ege::PhysicsShape::cylinder : {
|
case ege::PhysicsShape::cylinder : {
|
||||||
EGE_DEBUG(" Cylinder");
|
EGE_DEBUG(" Cylinder");
|
||||||
const ege::PhysicsCylinder* tmpElement = physiqueProperty[iii]->toCylinder();
|
const ege::PhysicsCylinder* tmpElement = physiqueProperty[iii]->toCylinder();
|
||||||
if (nullptr == tmpElement) {
|
if (tmpElement == nullptr) {
|
||||||
// ERROR ...
|
// ERROR ...
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
btCollisionShape* tmpShape = new btCylinderShape(tmpElement->getSize());
|
btCollisionShape* tmpShape = new btCylinderShape(tmpElement->getSize());
|
||||||
if (nullptr != tmpShape) {
|
if (tmpShape != nullptr) {
|
||||||
if (outputShape == nullptr) {
|
if (outputShape == nullptr) {
|
||||||
return tmpShape;
|
return tmpShape;
|
||||||
} else {
|
} else {
|
||||||
@ -98,12 +92,12 @@ btCollisionShape* ege::collision::createShape(const std::shared_ptr<ege::resourc
|
|||||||
case ege::PhysicsShape::capsule : {
|
case ege::PhysicsShape::capsule : {
|
||||||
EGE_DEBUG(" Capsule");
|
EGE_DEBUG(" Capsule");
|
||||||
const ege::PhysicsCapsule* tmpElement = physiqueProperty[iii]->toCapsule();
|
const ege::PhysicsCapsule* tmpElement = physiqueProperty[iii]->toCapsule();
|
||||||
if (nullptr == tmpElement) {
|
if (tmpElement == nullptr) {
|
||||||
// ERROR ...
|
// ERROR ...
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
btCollisionShape* tmpShape = new btCapsuleShape(tmpElement->getRadius(), tmpElement->getHeight());
|
btCollisionShape* tmpShape = new btCapsuleShape(tmpElement->getRadius(), tmpElement->getHeight());
|
||||||
if (nullptr != tmpShape) {
|
if (tmpShape != nullptr) {
|
||||||
if (outputShape == nullptr) {
|
if (outputShape == nullptr) {
|
||||||
return tmpShape;
|
return tmpShape;
|
||||||
} else {
|
} else {
|
||||||
@ -117,12 +111,12 @@ btCollisionShape* ege::collision::createShape(const std::shared_ptr<ege::resourc
|
|||||||
case ege::PhysicsShape::cone : {
|
case ege::PhysicsShape::cone : {
|
||||||
EGE_DEBUG(" Cone");
|
EGE_DEBUG(" Cone");
|
||||||
const ege::PhysicsCone* tmpElement = physiqueProperty[iii]->toCone();
|
const ege::PhysicsCone* tmpElement = physiqueProperty[iii]->toCone();
|
||||||
if (nullptr == tmpElement) {
|
if (tmpElement == nullptr) {
|
||||||
// ERROR ...
|
// ERROR ...
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
btCollisionShape* tmpShape = new btConeShape(tmpElement->getRadius(), tmpElement->getHeight());
|
btCollisionShape* tmpShape = new btConeShape(tmpElement->getRadius(), tmpElement->getHeight());
|
||||||
if (nullptr != tmpShape) {
|
if (tmpShape != nullptr) {
|
||||||
if (outputShape == nullptr) {
|
if (outputShape == nullptr) {
|
||||||
return tmpShape;
|
return tmpShape;
|
||||||
} else {
|
} else {
|
||||||
@ -136,12 +130,12 @@ btCollisionShape* ege::collision::createShape(const std::shared_ptr<ege::resourc
|
|||||||
case ege::PhysicsShape::sphere : {
|
case ege::PhysicsShape::sphere : {
|
||||||
EGE_DEBUG(" Sphere");
|
EGE_DEBUG(" Sphere");
|
||||||
const ege::PhysicsSphere* tmpElement = physiqueProperty[iii]->toSphere();
|
const ege::PhysicsSphere* tmpElement = physiqueProperty[iii]->toSphere();
|
||||||
if (nullptr == tmpElement) {
|
if (tmpElement == nullptr) {
|
||||||
// ERROR ...
|
// ERROR ...
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
btCollisionShape* tmpShape = new btSphereShape(tmpElement->getRadius());
|
btCollisionShape* tmpShape = new btSphereShape(tmpElement->getRadius());
|
||||||
if (nullptr != tmpShape) {
|
if (tmpShape != nullptr) {
|
||||||
if (outputShape == nullptr) {
|
if (outputShape == nullptr) {
|
||||||
return tmpShape;
|
return tmpShape;
|
||||||
} else {
|
} else {
|
||||||
@ -155,12 +149,12 @@ btCollisionShape* ege::collision::createShape(const std::shared_ptr<ege::resourc
|
|||||||
case ege::PhysicsShape::convexHull : {
|
case ege::PhysicsShape::convexHull : {
|
||||||
EGE_DEBUG(" convexHull");
|
EGE_DEBUG(" convexHull");
|
||||||
const ege::PhysicsConvexHull* tmpElement = physiqueProperty[iii]->toConvexHull();
|
const ege::PhysicsConvexHull* tmpElement = physiqueProperty[iii]->toConvexHull();
|
||||||
if (nullptr == tmpElement) {
|
if (tmpElement == nullptr) {
|
||||||
// ERROR ...
|
// ERROR ...
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
btConvexHullShape* tmpShape = new btConvexHullShape(&(tmpElement->getPointList()[0].x()), tmpElement->getPointList().size());
|
btConvexHullShape* tmpShape = new btConvexHullShape(&(tmpElement->getPointList()[0].x()), tmpElement->getPointList().size());
|
||||||
if (nullptr != tmpShape) {
|
if (tmpShape != nullptr) {
|
||||||
if (outputShape == nullptr) {
|
if (outputShape == nullptr) {
|
||||||
return tmpShape;
|
return tmpShape;
|
||||||
} else {
|
} else {
|
||||||
@ -177,7 +171,7 @@ btCollisionShape* ege::collision::createShape(const std::shared_ptr<ege::resourc
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nullptr == outputShape) {
|
if (outputShape == nullptr) {
|
||||||
EGE_DEBUG("create empty shape ...");
|
EGE_DEBUG("create empty shape ...");
|
||||||
return new btEmptyShape();
|
return new btEmptyShape();
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
@ -26,10 +24,6 @@
|
|||||||
#include <btBulletDynamicsCommon.h>
|
#include <btBulletDynamicsCommon.h>
|
||||||
#include <BulletCollision/CollisionDispatch/btCollisionObject.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) {
|
std::shared_ptr<ege::Element> ege::Environement::getElementNearest(std::shared_ptr<ege::Element> _sourceRequest, float& _distance) {
|
||||||
if (_sourceRequest == nullptr) {
|
if (_sourceRequest == nullptr) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -71,7 +65,7 @@ void ege::Environement::getElementNearest(const vec3& _sourcePosition,
|
|||||||
for (size_t iii=0; iii<m_listElement.size() ; iii++) {
|
for (size_t iii=0; iii<m_listElement.size() ; iii++) {
|
||||||
// chack nullptr pointer
|
// chack nullptr pointer
|
||||||
result.element = m_listElement[iii];
|
result.element = m_listElement[iii];
|
||||||
if (nullptr == result.element) {
|
if (result.element == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// check distance ...
|
// check distance ...
|
||||||
@ -156,7 +150,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
|
|||||||
EGE_ERROR("allocation error '" << _type << "'");
|
EGE_ERROR("allocation error '" << _type << "'");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (false == tmpElement->initString(_description)) {
|
if (tmpElement->initString(_description) == false) {
|
||||||
EGE_ERROR("Init error ... '" << _type << "'");
|
EGE_ERROR("Init error ... '" << _type << "'");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -181,7 +175,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
|
|||||||
EGE_ERROR("allocation error '" << _type << "'");
|
EGE_ERROR("allocation error '" << _type << "'");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (false == tmpElement->initJSON(_value)) {
|
if (tmpElement->initJSON(_value) == false) {
|
||||||
EGE_ERROR("Init error ... '" << _type << "'");
|
EGE_ERROR("Init error ... '" << _type << "'");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -206,7 +200,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
|
|||||||
EGE_ERROR("allocation error '" << _type << "'");
|
EGE_ERROR("allocation error '" << _type << "'");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (false == tmpElement->initXML(_node)) {
|
if (tmpElement->initXML(_node) == false) {
|
||||||
EGE_ERROR("Init error ... '" << _type << "'");
|
EGE_ERROR("Init error ... '" << _type << "'");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -231,7 +225,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
|
|||||||
EGE_ERROR("allocation error '" << _type << "'");
|
EGE_ERROR("allocation error '" << _type << "'");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (false == tmpElement->initVoid(_data)) {
|
if (tmpElement->initVoid(_data) == false) {
|
||||||
EGE_ERROR("Init error ... '" << _type << "'");
|
EGE_ERROR("Init error ... '" << _type << "'");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -256,7 +250,7 @@ std::shared_ptr<ege::Element> ege::Environement::createElement(const std::string
|
|||||||
EGE_ERROR("allocation error '" << _type << "'");
|
EGE_ERROR("allocation error '" << _type << "'");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (false == tmpElement->init()) {
|
if (tmpElement->init() == false) {
|
||||||
EGE_ERROR("Init error ... '" << _type << "'");
|
EGE_ERROR("Init error ... '" << _type << "'");
|
||||||
return nullptr;
|
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 all element in the game we chek if it is needed to display it ...
|
||||||
for (size_t iii=0; iii<m_listElement.size() ; iii++) {
|
for (size_t iii=0; iii<m_listElement.size() ; iii++) {
|
||||||
// chack nullptr pointer
|
// chack nullptr pointer
|
||||||
if (nullptr == m_listElement[iii]) {
|
if (m_listElement[iii] == nullptr) {
|
||||||
// no pointer null are set in the output list ...
|
// no pointer null are set in the output list ...
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -360,7 +354,7 @@ void ege::Environement::getOrderedElementForDisplay(std::vector<ege::Environemen
|
|||||||
void ege::Environement::generateInteraction(ege::ElementInteraction& _event) {
|
void ege::Environement::generateInteraction(ege::ElementInteraction& _event) {
|
||||||
// inform the element that an element has been removed == > this permit to keep pointer on elements ...
|
// 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++) {
|
for (size_t iii=0; iii<m_listElement.size() ; iii++) {
|
||||||
if (nullptr == m_listElement[iii]) {
|
if (m_listElement[iii] == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
_event.applyEvent(*m_listElement[iii]);
|
_event.applyEvent(*m_listElement[iii]);
|
||||||
@ -456,7 +450,7 @@ void ege::Environement::onCallbackPeriodicCall(const ewol::event::Time& _event)
|
|||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (0 != numberEnnemyKilled) {
|
if (numberEnnemyKilled != 0) {
|
||||||
//signalKillEnemy.emit(numberEnnemyKilled);
|
//signalKillEnemy.emit(numberEnnemyKilled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ege/Light.h>
|
#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) {
|
void ege::Light::link(const std::shared_ptr<gale::resource::Program>& _prog, const std::string& _baseName) {
|
||||||
if (nullptr == _prog) {
|
if (_prog == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_GL_direction = _prog->getUniform(_baseName+".direction");
|
m_GL_direction = _prog->getUniform(_baseName+".direction");
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gale/resource/Manager.h>
|
#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) {
|
void ege::MaterialGlId::link(const std::shared_ptr<gale::resource::Program>& _prog, const std::string& _baseName) {
|
||||||
if (nullptr == _prog) {
|
if (_prog == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_GL_ambientFactor = _prog->getUniform(_baseName+".ambientFactor");
|
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) {
|
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_ambientFactor, m_ambientFactor);
|
||||||
_prog->uniform4(_glID.m_GL_diffuseFactor, m_diffuseFactor);
|
_prog->uniform4(_glID.m_GL_diffuseFactor, m_diffuseFactor);
|
||||||
_prog->uniform4(_glID.m_GL_specularFactor, m_specularFactor);
|
_prog->uniform4(_glID.m_GL_specularFactor, m_specularFactor);
|
||||||
_prog->uniform1f(_glID.m_GL_shininess, m_shininess);
|
_prog->uniform1f(_glID.m_GL_shininess, m_shininess);
|
||||||
if (nullptr != m_texture0) {
|
if (m_texture0 != nullptr) {
|
||||||
_prog->setTexture0(_glID.m_GL_texture0, m_texture0->getId());
|
EGE_INFO(" set texture: " << _glID.m_GL_texture0 << " " << m_texture0->getId());
|
||||||
|
_prog->setTexture0(_glID.m_GL_texture0, m_texture0->getRendererId());
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
if (_prog->checkIdValidity(_glID.m_GL_texture0) == false) {
|
if (_prog->checkIdValidity(_glID.m_GL_texture0) == false) {
|
||||||
EGE_ERROR("try to set texture on a unexistant shader interface (wrong ID)");
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
EGE_INFO("draw Material: ( end )");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ege::Material::setTexture0(const std::string& _filename) {
|
void ege::Material::setTexture0(const std::string& _filename) {
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,18 +1,13 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
#include <ege/Particule.h>
|
#include <ege/Particule.h>
|
||||||
#include <ege/ParticuleEngine.h>
|
#include <ege/ParticuleEngine.h>
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "Particule"
|
|
||||||
|
|
||||||
ege::Particule::Particule(ege::ParticuleEngine* _particuleEngine, const char* _particuleType) :
|
ege::Particule::Particule(ege::ParticuleEngine* _particuleEngine, const char* _particuleType) :
|
||||||
m_particuleEngine(_particuleEngine),
|
m_particuleEngine(_particuleEngine),
|
||||||
m_particuleType(_particuleType) {
|
m_particuleType(_particuleType) {
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
@ -11,9 +9,6 @@
|
|||||||
#include <ege/Environement.h>
|
#include <ege/Environement.h>
|
||||||
#include <ege/Particule.h>
|
#include <ege/Particule.h>
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "ParticuleEngine"
|
|
||||||
|
|
||||||
ege::ParticuleEngine::ParticuleEngine(ege::Environement* _env) :
|
ege::ParticuleEngine::ParticuleEngine(ege::Environement* _env) :
|
||||||
m_env(_env) {
|
m_env(_env) {
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
namespace ege {
|
namespace ege {
|
||||||
|
@ -1,23 +1,17 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
#include <ege/ParticuleSimple.h>
|
#include <ege/ParticuleSimple.h>
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "ParticuleSimple"
|
|
||||||
|
|
||||||
ege::ParticuleSimple::ParticuleSimple(ege::ParticuleEngine* _particuleEngine, const char* _particuleType) :
|
ege::ParticuleSimple::ParticuleSimple(ege::ParticuleEngine* _particuleEngine, const char* _particuleType) :
|
||||||
Particule(_particuleEngine, _particuleType) {
|
Particule(_particuleEngine, _particuleType) {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ege::ParticuleSimple::init() {
|
void ege::ParticuleSimple::init() {
|
||||||
m_lifeFull = 3;
|
m_lifeFull = 3;
|
||||||
m_life = m_lifeFull;
|
m_life = m_lifeFull;
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#include <etk/types.h>
|
#include <etk/types.h>
|
||||||
#include <ege/Ray.h>
|
#include <ege/Ray.h>
|
||||||
@ -13,9 +11,6 @@
|
|||||||
#include <BulletDynamics/Dynamics/btDynamicsWorld.h>
|
#include <BulletDynamics/Dynamics/btDynamicsWorld.h>
|
||||||
#include <BulletCollision/CollisionDispatch/btCollisionWorld.h>
|
#include <BulletCollision/CollisionDispatch/btCollisionWorld.h>
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "Ray"
|
|
||||||
|
|
||||||
ege::Ray::Ray(const vec3& _origin, const vec3& _direction) :
|
ege::Ray::Ray(const vec3& _origin, const vec3& _direction) :
|
||||||
m_origin(_origin),
|
m_origin(_origin),
|
||||||
m_direction(_direction) {
|
m_direction(_direction) {
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2013, Edouard DUPIN, all right reserved
|
* @copyright 2013, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -12,9 +10,6 @@
|
|||||||
|
|
||||||
#include <gale/renderer/openGL/openGL.h>
|
#include <gale/renderer/openGL/openGL.h>
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "Camera"
|
|
||||||
|
|
||||||
ege::Camera::Camera() :
|
ege::Camera::Camera() :
|
||||||
m_aspectRatio(0.5),
|
m_aspectRatio(0.5),
|
||||||
m_angleView(M_PI/3.0),
|
m_angleView(M_PI/3.0),
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2013, Edouard DUPIN, all right reserved
|
* @copyright 2013, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
#include <etk/types.h>
|
#include <etk/types.h>
|
||||||
#include <etk/math/Vector3D.h>
|
#include <etk/math/Vector3D.h>
|
||||||
#include <etk/math/Vector2D.h>
|
#include <etk/math/Vector2D.h>
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2013, Edouard DUPIN, all right reserved
|
* @copyright 2013, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -11,9 +9,6 @@
|
|||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
#include <etk/math/Vector3D.h>
|
#include <etk/math/Vector3D.h>
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "camera::View"
|
|
||||||
|
|
||||||
void ege::camera::View::update() {
|
void ege::camera::View::update() {
|
||||||
//m_matrix = etk::matLookAt(m_eye, m_target, m_up);
|
//m_matrix = etk::matLookAt(m_eye, m_target, m_up);
|
||||||
//m_matrix.translate(m_eye);
|
//m_matrix.translate(m_eye);
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2013, Edouard DUPIN, all right reserved
|
* @copyright 2013, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <etk/types.h>
|
#include <etk/types.h>
|
||||||
@ -80,7 +78,7 @@ bool ege::Element::unInit() {
|
|||||||
|
|
||||||
bool ege::Element::loadMesh(const std::string& _meshFileName) {
|
bool ege::Element::loadMesh(const std::string& _meshFileName) {
|
||||||
std::shared_ptr<ege::resource::Mesh> tmpMesh = ege::resource::Mesh::create(_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);
|
EGE_ERROR("can not load the resources : " << _meshFileName);
|
||||||
return false;
|
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) {
|
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.reset();
|
||||||
}
|
}
|
||||||
m_mesh = _mesh;
|
m_mesh = _mesh;
|
||||||
@ -114,7 +112,7 @@ void ege::Element::setFireOn(int32_t _groupIdSource, int32_t _type, float _power
|
|||||||
if (m_life <= 0) {
|
if (m_life <= 0) {
|
||||||
EGE_DEBUG("[" << getUID() << "] element is killed ..." << getType());
|
EGE_DEBUG("[" << getUID() << "] element is killed ..." << getType());
|
||||||
}
|
}
|
||||||
if (m_life!=previousLife) {
|
if (m_life != previousLife) {
|
||||||
onLifeChange();
|
onLifeChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,7 +130,7 @@ const float lifeWidth = 2.0f;
|
|||||||
const float lifeYPos = 1.7f;
|
const float lifeYPos = 1.7f;
|
||||||
|
|
||||||
void ege::Element::drawLife(const std::shared_ptr<ewol::resource::Colored3DObject>& _draw, const std::shared_ptr<ege::Camera>& _camera) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
float ratio = getLifeRatio();
|
float ratio = getLifeRatio();
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <etk/types.h>
|
#include <etk/types.h>
|
||||||
@ -25,9 +23,6 @@
|
|||||||
|
|
||||||
#include <ege/CollisionShapeCreator.h>
|
#include <ege/CollisionShapeCreator.h>
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "ElementPhysic"
|
|
||||||
|
|
||||||
const std::string& ege::ElementPhysic::getType() const {
|
const std::string& ege::ElementPhysic::getType() const {
|
||||||
static const std::string nameType("----");
|
static const std::string nameType("----");
|
||||||
return nameType;
|
return nameType;
|
||||||
@ -117,7 +112,7 @@ bool ege::ElementPhysic::setShape(btCollisionShape* _shape) {
|
|||||||
|
|
||||||
void ege::ElementPhysic::removeShape() {
|
void ege::ElementPhysic::removeShape() {
|
||||||
// no shape
|
// no shape
|
||||||
if (nullptr == m_shape) {
|
if (m_shape == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// need to chek if the shape is the same as the mesh shape ...
|
// need to chek if the shape is the same as the mesh shape ...
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ege/physics/Engine.h>
|
#include <ege/physics/Engine.h>
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,20 +1,17 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
#include <ege/physicsShape/PhysicsBox.h>
|
#include <ege/physicsShape/PhysicsBox.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool ege::PhysicsBox::parse(const char* _line) {
|
bool ege::PhysicsBox::parse(const char* _line) {
|
||||||
if (true == ege::PhysicsShape::parse(_line)) {
|
if (ege::PhysicsShape::parse(_line) == true) {
|
||||||
return 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] );
|
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);
|
EGE_VERBOSE(" halfSize=" << m_size);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
#include <ege/physicsShape/PhysicsCapsule.h>
|
#include <ege/physicsShape/PhysicsCapsule.h>
|
||||||
@ -11,15 +9,15 @@
|
|||||||
|
|
||||||
|
|
||||||
bool ege::PhysicsCapsule::parse(const char* _line) {
|
bool ege::PhysicsCapsule::parse(const char* _line) {
|
||||||
if (true == ege::PhysicsShape::parse(_line)) {
|
if (ege::PhysicsShape::parse(_line) == true) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(0 == strncmp(_line, "radius : ", 9) ) {
|
if(strncmp(_line, "radius : ", 9) == 0) {
|
||||||
sscanf(&_line[9], "%f", &m_radius );
|
sscanf(&_line[9], "%f", &m_radius );
|
||||||
EGE_VERBOSE(" radius=" << m_radius);
|
EGE_VERBOSE(" radius=" << m_radius);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(0 == strncmp(_line, "height : ", 9) ) {
|
if(strncmp(_line, "height : ", 9) == 0) {
|
||||||
sscanf(&_line[9], "%f", &m_height );
|
sscanf(&_line[9], "%f", &m_height );
|
||||||
EGE_VERBOSE(" height=" << m_height);
|
EGE_VERBOSE(" height=" << m_height);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
#include <ege/physicsShape/PhysicsCone.h>
|
#include <ege/physicsShape/PhysicsCone.h>
|
||||||
@ -11,15 +9,15 @@
|
|||||||
|
|
||||||
|
|
||||||
bool ege::PhysicsCone::parse(const char* _line) {
|
bool ege::PhysicsCone::parse(const char* _line) {
|
||||||
if (true == ege::PhysicsShape::parse(_line)) {
|
if (ege::PhysicsShape::parse(_line) == true) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(0 == strncmp(_line, "radius : ", 9) ) {
|
if(strncmp(_line, "radius : ", 9) == 0) {
|
||||||
sscanf(&_line[9], "%f", &m_radius );
|
sscanf(&_line[9], "%f", &m_radius );
|
||||||
EGE_VERBOSE(" radius=" << m_radius);
|
EGE_VERBOSE(" radius=" << m_radius);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(0 == strncmp(_line, "height : ", 9) ) {
|
if(strncmp(_line, "height : ", 9) == 0) {
|
||||||
sscanf(&_line[9], "%f", &m_height );
|
sscanf(&_line[9], "%f", &m_height );
|
||||||
EGE_VERBOSE(" height=" << m_height);
|
EGE_VERBOSE(" height=" << m_height);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
#include <ege/physicsShape/PhysicsConvexHull.h>
|
#include <ege/physicsShape/PhysicsConvexHull.h>
|
||||||
@ -11,10 +9,10 @@
|
|||||||
|
|
||||||
|
|
||||||
bool ege::PhysicsConvexHull::parse(const char* _line) {
|
bool ege::PhysicsConvexHull::parse(const char* _line) {
|
||||||
if (true == ege::PhysicsShape::parse(_line)) {
|
if (ege::PhysicsShape::parse(_line) == true) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(0 == strncmp(_line, "points : ", 8) ) {
|
if(strncmp(_line, "points : ", 8) == 0) {
|
||||||
//EGE_DEBUG("convex hull point parsing " << _line);
|
//EGE_DEBUG("convex hull point parsing " << _line);
|
||||||
char* base = (char*)(&_line[8]);
|
char* base = (char*)(&_line[8]);
|
||||||
char* tmp= strchr(base, '|');
|
char* tmp= strchr(base, '|');
|
||||||
@ -35,7 +33,7 @@ bool ege::PhysicsConvexHull::parse(const char* _line) {
|
|||||||
*/
|
*/
|
||||||
return true;
|
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] );
|
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);
|
EGE_VERBOSE(" scale=" << m_scale);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,19 +1,17 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
#include <ege/physicsShape/PhysicsCylinder.h>
|
#include <ege/physicsShape/PhysicsCylinder.h>
|
||||||
|
|
||||||
|
|
||||||
bool ege::PhysicsCylinder::parse(const char* _line) {
|
bool ege::PhysicsCylinder::parse(const char* _line) {
|
||||||
if (true == ege::PhysicsShape::parse(_line)) {
|
if (ege::PhysicsShape::parse(_line) == true) {
|
||||||
return 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] );
|
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);
|
EGE_VERBOSE(" halfSize=" << m_size);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
#include <ege/physicsShape/PhysicsShape.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) {
|
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] );
|
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);
|
EGE_VERBOSE(" Origin=" << m_origin);
|
||||||
return true;
|
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] );
|
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);
|
EGE_VERBOSE(" rotate=" << m_quaternion);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
#include <ege/physicsShape/PhysicsSphere.h>
|
#include <ege/physicsShape/PhysicsSphere.h>
|
||||||
@ -11,10 +9,10 @@
|
|||||||
|
|
||||||
|
|
||||||
bool ege::PhysicsSphere::parse(const char* _line) {
|
bool ege::PhysicsSphere::parse(const char* _line) {
|
||||||
if (true == ege::PhysicsShape::parse(_line)) {
|
if (ege::PhysicsShape::parse(_line) == true) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(0 == strncmp(_line, "radius : ", 9) ) {
|
if(strncmp(_line, "radius : ", 9) == 0) {
|
||||||
sscanf(&_line[9], "%f", &m_radius );
|
sscanf(&_line[9], "%f", &m_radius );
|
||||||
EGE_VERBOSE(" radius=" << m_radius);
|
EGE_VERBOSE(" radius=" << m_radius);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
@ -15,9 +13,6 @@
|
|||||||
#include <ege/resource/tools/isoSphere.h>
|
#include <ege/resource/tools/isoSphere.h>
|
||||||
#include <ege/resource/tools/icoSphere.h>
|
#include <ege/resource/tools/icoSphere.h>
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "resource::Mesh"
|
|
||||||
|
|
||||||
ege::resource::Mesh::Mesh() :
|
ege::resource::Mesh::Mesh() :
|
||||||
m_normalMode(normalModeNone),
|
m_normalMode(normalModeNone),
|
||||||
m_checkNormal(false),
|
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.setDiffuseColor(vec4(1.0f,1.0f,1.0f,1.0f));
|
||||||
m_light.setSpecularColor(vec4(0.0f,0.0f,0.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);
|
m_GLprogram = gale::resource::Program::create(_shaderName);
|
||||||
if (m_GLprogram != nullptr) {
|
if (m_GLprogram != nullptr) {
|
||||||
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
|
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() {
|
ege::resource::Mesh::~Mesh() {
|
||||||
// remove dynamics dependencies :
|
// remove dynamics dependencies :
|
||||||
if (m_functionFreeShape!=nullptr) {
|
if (m_functionFreeShape != nullptr) {
|
||||||
m_functionFreeShape(m_pointerShape);
|
m_functionFreeShape(m_pointerShape);
|
||||||
m_pointerShape = nullptr;
|
m_pointerShape = nullptr;
|
||||||
}
|
}
|
||||||
@ -112,6 +107,10 @@ void ege::resource::Mesh::clean() {
|
|||||||
void ege::resource::Mesh::draw(mat4& _positionMatrix,
|
void ege::resource::Mesh::draw(mat4& _positionMatrix,
|
||||||
bool _enableDepthTest,
|
bool _enableDepthTest,
|
||||||
bool _enableDepthUpdate) {
|
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) {
|
if (m_GLprogram == nullptr) {
|
||||||
EGE_ERROR("No shader ...");
|
EGE_ERROR("No shader ...");
|
||||||
return;
|
return;
|
||||||
@ -159,7 +158,7 @@ void ege::resource::Mesh::draw(mat4& _positionMatrix,
|
|||||||
int32_t nbElementDraw = 0;
|
int32_t nbElementDraw = 0;
|
||||||
#endif
|
#endif
|
||||||
for (int32_t kkk=0; kkk<m_listFaces.size(); kkk++) {
|
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) << "'");
|
EGE_WARNING("missing materials : '" << m_listFaces.getKey(kkk) << "'");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -239,6 +238,7 @@ void ege::resource::Mesh::draw(mat4& _positionMatrix,
|
|||||||
}
|
}
|
||||||
// TODO : UNDERSTAND why ... it is needed
|
// TODO : UNDERSTAND why ... it is needed
|
||||||
glBindBuffer(GL_ARRAY_BUFFER,0);
|
glBindBuffer(GL_ARRAY_BUFFER,0);
|
||||||
|
EGE_INFO("draw Mesh : " << m_name << " ( end )");
|
||||||
}
|
}
|
||||||
|
|
||||||
// normal calculation of the normal face is really easy :
|
// 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 ....
|
// when no normal detected == > auto generate Face normal ....
|
||||||
calculateNormaleFace(m_listFaces.getKeys()[0]);
|
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 :
|
// generate element in 2 pass :
|
||||||
// - create new index dependeng a vertex is a unique componenet of position, texture, normal
|
// - create new index dependeng a vertex is a unique componenet of position, texture, normal
|
||||||
@ -392,7 +392,7 @@ void ege::resource::Mesh::generateVBO() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (false == elementFind) {
|
if (elementFind == false) {
|
||||||
m_verticesVBO->pushOnBuffer(MESH_VBO_VERTICES, position);
|
m_verticesVBO->pushOnBuffer(MESH_VBO_VERTICES, position);
|
||||||
if (m_normalMode != normalModeNone) {
|
if (m_normalMode != normalModeNone) {
|
||||||
m_verticesVBO->pushOnBuffer(MESH_VBO_VERTICES_NORMAL, normal);
|
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) {
|
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");
|
EGE_ERROR(" can not add material with null pointer");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -554,6 +554,7 @@ void ege::resource::Mesh::addTriangle(const std::string& _layerName,
|
|||||||
const vec3& _pos1, const vec3& _pos2, const vec3& _pos3,
|
const vec3& _pos1, const vec3& _pos2, const vec3& _pos3,
|
||||||
const vec2& _uv1, const vec2& _uv2, const vec2& _uv3,
|
const vec2& _uv1, const vec2& _uv2, const vec2& _uv3,
|
||||||
const etk::Color<float>& _color1, const etk::Color<float>& _color2, const etk::Color<float>& _color3) {
|
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
|
if ( m_listFaces.exist(_layerName) == false
|
||||||
|| m_materials.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) << " ...");
|
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);
|
pos3, uv3);
|
||||||
tmpFace.setColor(color1, color2, color3);
|
tmpFace.setColor(color1, color2, color3);
|
||||||
m_listFaces[_layerName].m_faces.push_back(tmpFace);
|
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,
|
void ege::resource::Mesh::addTriangle(const std::string& _layerName, const vec3& _pos1, const vec3& _pos2, const vec3& _pos3,
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ege/debug.h>
|
#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 << "\"");
|
EGE_ERROR("No data in the file named=\"" << fileName << "\"");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(false == fileName.fileOpenRead() ) {
|
if (fileName.fileOpenRead() == false) {
|
||||||
EGE_ERROR("Can not find the file name=\"" << fileName << "\"");
|
EGE_ERROR("Can not find the file name=\"" << fileName << "\"");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
char inputDataLine[2048];
|
char inputDataLine[2048];
|
||||||
// load the first line :
|
// load the first line :
|
||||||
fileName.fileGets(inputDataLine, 2048);
|
fileName.fileGets(inputDataLine, 2048);
|
||||||
if(0 == strncmp(inputDataLine, "EMF(STRING)", 11)) {
|
if(strncmp(inputDataLine, "EMF(STRING)", 11) == 0) {
|
||||||
// parse in string mode ...
|
// 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)'");
|
EGE_ERROR(" file binary mode is not supported now : 'EMF(BINARY)'");
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@ -176,18 +174,18 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
|
|||||||
std::shared_ptr<ege::Material> material;
|
std::shared_ptr<ege::Material> material;
|
||||||
// physical shape:
|
// physical shape:
|
||||||
std::shared_ptr<ege::PhysicsShape> physics;
|
std::shared_ptr<ege::PhysicsShape> physics;
|
||||||
while(1) {
|
while (1) {
|
||||||
int32_t level = countIndent(fileName);
|
int32_t level = countIndent(fileName);
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
// new section ...
|
// new section ...
|
||||||
if (nullptr == loadNextData(inputDataLine, 2048, fileName)) {
|
if (loadNextData(inputDataLine, 2048, fileName) == nullptr) {
|
||||||
// reach end of file ...
|
// reach end of file ...
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(0 == strncmp(inputDataLine, "Mesh :", 6) ) {
|
if(strncmp(inputDataLine, "Mesh :", 6) == 0) {
|
||||||
currentMode = EMFModuleMesh;
|
currentMode = EMFModuleMesh;
|
||||||
EGE_VERBOSE("Parse Mesh :");
|
EGE_VERBOSE("Parse Mesh :");
|
||||||
} else if(0 == strncmp(inputDataLine, "Materials : ", 11) ) {
|
} else if(strncmp(inputDataLine, "Materials : ", 11) == 0) {
|
||||||
currentMode = EMFModuleMaterial;
|
currentMode = EMFModuleMaterial;
|
||||||
EGE_VERBOSE("Parse Material :");
|
EGE_VERBOSE("Parse Material :");
|
||||||
} else {
|
} else {
|
||||||
@ -197,7 +195,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
|
|||||||
if (currentMode >= EMFModuleMesh && currentMode <= EMFModuleMesh_END) {
|
if (currentMode >= EMFModuleMesh && currentMode <= EMFModuleMesh_END) {
|
||||||
if (level == 1) {
|
if (level == 1) {
|
||||||
//Find mesh name ...
|
//Find mesh name ...
|
||||||
if (nullptr == loadNextData(inputDataLine, 2048, fileName, true)) {
|
if (loadNextData(inputDataLine, 2048, fileName, true) == nullptr) {
|
||||||
// reach end of file ...
|
// reach end of file ...
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -209,27 +207,27 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
|
|||||||
}
|
}
|
||||||
if (level == 2) {
|
if (level == 2) {
|
||||||
// In the mesh level 2 the line size must not exced 2048
|
// 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 ...
|
// reach end of file ...
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
removeEndLine(inputDataLine);
|
removeEndLine(inputDataLine);
|
||||||
if(0 == strncmp(inputDataLine, "Vertex", 6) ) {
|
if(strncmp(inputDataLine, "Vertex", 6) == 0) {
|
||||||
currentMode = EMFModuleMeshVertex;
|
currentMode = EMFModuleMeshVertex;
|
||||||
EGE_VERBOSE(" Vertex ...");
|
EGE_VERBOSE(" Vertex ...");
|
||||||
} else if(0 == strncmp(inputDataLine, "UV-mapping", 10) ) {
|
} else if(strncmp(inputDataLine, "UV-mapping", 10) == 0) {
|
||||||
currentMode = EMFModuleMeshUVMapping;
|
currentMode = EMFModuleMeshUVMapping;
|
||||||
EGE_VERBOSE(" UV-mapping ...");
|
EGE_VERBOSE(" UV-mapping ...");
|
||||||
} else if(0 == strncmp(inputDataLine, "Normal(vertex)", 14) ) {
|
} else if(strncmp(inputDataLine, "Normal(vertex)", 14) == 0) {
|
||||||
currentMode = EMFModuleMeshNormalVertex;
|
currentMode = EMFModuleMeshNormalVertex;
|
||||||
EGE_VERBOSE(" Normal(vertex) ...");
|
EGE_VERBOSE(" Normal(vertex) ...");
|
||||||
} else if(0 == strncmp(inputDataLine, "Normal(face)", 12) ) {
|
} else if(strncmp(inputDataLine, "Normal(face)", 12) == 0) {
|
||||||
currentMode = EMFModuleMeshNormalFace;
|
currentMode = EMFModuleMeshNormalFace;
|
||||||
EGE_VERBOSE(" Normal(face) ...");
|
EGE_VERBOSE(" Normal(face) ...");
|
||||||
} else if(0 == strncmp(inputDataLine, "Face", 4) ) {
|
} else if(strncmp(inputDataLine, "Face", 4) == 0) {
|
||||||
currentMode = EMFModuleMeshFace;
|
currentMode = EMFModuleMeshFace;
|
||||||
EGE_VERBOSE(" Face ...");
|
EGE_VERBOSE(" Face ...");
|
||||||
} else if(0 == strncmp(inputDataLine, "Physics", 7) ) {
|
} else if(strncmp(inputDataLine, "Physics", 7) == 0) {
|
||||||
currentMode = EMFModuleMeshPhysics;
|
currentMode = EMFModuleMeshPhysics;
|
||||||
EGE_VERBOSE(" Physics ...");
|
EGE_VERBOSE(" Physics ...");
|
||||||
} else {
|
} else {
|
||||||
@ -246,7 +244,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
|
|||||||
break;
|
break;
|
||||||
case EMFModuleMeshVertex: {
|
case EMFModuleMeshVertex: {
|
||||||
vec3 vertex(0,0,0);
|
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') {
|
if (inputDataLine[0] == '\0') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -263,7 +261,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
|
|||||||
}
|
}
|
||||||
case EMFModuleMeshUVMapping: {
|
case EMFModuleMeshUVMapping: {
|
||||||
vec2 uvMap(0,0);
|
vec2 uvMap(0,0);
|
||||||
while (nullptr != loadNextData(inputDataLine, 2048, fileName, true, true) ) {
|
while (loadNextData(inputDataLine, 2048, fileName, true, true) != nullptr) {
|
||||||
if (inputDataLine[0] == '\0') {
|
if (inputDataLine[0] == '\0') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -282,7 +280,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
|
|||||||
m_normalMode = normalModeVertex;
|
m_normalMode = normalModeVertex;
|
||||||
vec3 normal(0,0,0);
|
vec3 normal(0,0,0);
|
||||||
// find the vertex Normal list.
|
// 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') {
|
if (inputDataLine[0] == '\0') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -301,7 +299,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
|
|||||||
m_normalMode = normalModeFace;
|
m_normalMode = normalModeFace;
|
||||||
vec3 normal(0,0,0);
|
vec3 normal(0,0,0);
|
||||||
// find the face Normal list.
|
// 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') {
|
if (inputDataLine[0] == '\0') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -320,7 +318,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
|
|||||||
case EMFModuleMeshFaceMaterial:
|
case EMFModuleMeshFaceMaterial:
|
||||||
if (level == 3) {
|
if (level == 3) {
|
||||||
//Find mesh name ...
|
//Find mesh name ...
|
||||||
if (nullptr == loadNextData(inputDataLine, 2048, fileName, true)) {
|
if (loadNextData(inputDataLine, 2048, fileName, true) == nullptr) {
|
||||||
// reach end of file ...
|
// reach end of file ...
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -332,7 +330,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
|
|||||||
meshFaceMaterialID = m_listFaces.getId(inputDataLine);
|
meshFaceMaterialID = m_listFaces.getId(inputDataLine);
|
||||||
EGE_VERBOSE(" " << inputDataLine);
|
EGE_VERBOSE(" " << inputDataLine);
|
||||||
} else if (currentMode == EMFModuleMeshFaceMaterial) {
|
} else if (currentMode == EMFModuleMeshFaceMaterial) {
|
||||||
while (nullptr != loadNextData(inputDataLine, 2048, fileName, true, true) ) {
|
while (loadNextData(inputDataLine, 2048, fileName, true, true) != nullptr) {
|
||||||
if (inputDataLine[0] == '\0') {
|
if (inputDataLine[0] == '\0') {
|
||||||
// end of line
|
// end of line
|
||||||
break;
|
break;
|
||||||
@ -377,7 +375,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
|
|||||||
break;
|
break;
|
||||||
case EMFModuleMeshPhysics:
|
case EMFModuleMeshPhysics:
|
||||||
case EMFModuleMeshPhysicsNamed:
|
case EMFModuleMeshPhysicsNamed:
|
||||||
if (nullptr == loadNextData(inputDataLine, 2048, fileName, true, false, false)) {
|
if (loadNextData(inputDataLine, 2048, fileName, true, false, false) == nullptr) {
|
||||||
// reach end of file ...
|
// reach end of file ...
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -396,7 +394,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
|
|||||||
EGE_ERROR("Can not parse :'" << inputDataLine << "' in physical shape ...");
|
EGE_ERROR("Can not parse :'" << inputDataLine << "' in physical shape ...");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (false == physics->parse(inputDataLine)) {
|
if (physics->parse(inputDataLine) == false) {
|
||||||
EGE_ERROR("ERROR when parsing :'" << inputDataLine << "' in physical shape ...");
|
EGE_ERROR("ERROR when parsing :'" << inputDataLine << "' in physical shape ...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -405,7 +403,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
|
|||||||
continue;
|
continue;
|
||||||
} else if (currentMode >= EMFModuleMaterial && currentMode <= EMFModuleMaterial_END) {
|
} else if (currentMode >= EMFModuleMaterial && currentMode <= EMFModuleMaterial_END) {
|
||||||
// all material element is stored on 1 line (size < 2048)
|
// 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 ...
|
// reach end of file ...
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -413,7 +411,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
|
|||||||
if (level == 1) {
|
if (level == 1) {
|
||||||
// add previous material :
|
// add previous material :
|
||||||
if( materialName != ""
|
if( materialName != ""
|
||||||
&& material!=nullptr) {
|
&& material != nullptr) {
|
||||||
m_materials.add(materialName, material);
|
m_materials.add(materialName, material);
|
||||||
materialName = "";
|
materialName = "";
|
||||||
material = nullptr;
|
material = nullptr;
|
||||||
@ -430,17 +428,17 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
|
|||||||
jumpEndLine(fileName);
|
jumpEndLine(fileName);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (nullptr == material) {
|
if (material == nullptr) {
|
||||||
EGE_ERROR("material allocation error");
|
EGE_ERROR("material allocation error");
|
||||||
jumpEndLine(fileName);
|
jumpEndLine(fileName);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(0 == strncmp(inputDataLine,"Ns ",3)) {
|
if(strncmp(inputDataLine,"Ns ",3) == 0) {
|
||||||
float tmpVal=0;
|
float tmpVal=0;
|
||||||
sscanf(&inputDataLine[3], "%f", &tmpVal);
|
sscanf(&inputDataLine[3], "%f", &tmpVal);
|
||||||
material->setShininess(tmpVal);
|
material->setShininess(tmpVal);
|
||||||
EGE_VERBOSE(" Shininess " << tmpVal);
|
EGE_VERBOSE(" Shininess " << tmpVal);
|
||||||
} else if(0 == strncmp(inputDataLine,"Ka ",3)) {
|
} else if(strncmp(inputDataLine,"Ka ",3) == 0) {
|
||||||
float tmpVal1=0;
|
float tmpVal1=0;
|
||||||
float tmpVal2=0;
|
float tmpVal2=0;
|
||||||
float tmpVal3=0;
|
float tmpVal3=0;
|
||||||
@ -448,7 +446,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
|
|||||||
vec4 tmp(tmpVal1, tmpVal2, tmpVal3, 1);
|
vec4 tmp(tmpVal1, tmpVal2, tmpVal3, 1);
|
||||||
material->setAmbientFactor(tmp);
|
material->setAmbientFactor(tmp);
|
||||||
EGE_VERBOSE(" AmbientFactor " << tmp);
|
EGE_VERBOSE(" AmbientFactor " << tmp);
|
||||||
} else if(0 == strncmp(inputDataLine,"Kd ",3)) {
|
} else if(strncmp(inputDataLine,"Kd ",3) == 0) {
|
||||||
float tmpVal1=0;
|
float tmpVal1=0;
|
||||||
float tmpVal2=0;
|
float tmpVal2=0;
|
||||||
float tmpVal3=0;
|
float tmpVal3=0;
|
||||||
@ -456,7 +454,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
|
|||||||
vec4 tmp(tmpVal1, tmpVal2, tmpVal3, 1);
|
vec4 tmp(tmpVal1, tmpVal2, tmpVal3, 1);
|
||||||
material->setDiffuseFactor(tmp);
|
material->setDiffuseFactor(tmp);
|
||||||
EGE_VERBOSE(" DiffuseFactor " << tmp);
|
EGE_VERBOSE(" DiffuseFactor " << tmp);
|
||||||
} else if(0 == strncmp(inputDataLine,"Ks ",3)) {
|
} else if(strncmp(inputDataLine,"Ks ",3) == 0) {
|
||||||
float tmpVal1=0;
|
float tmpVal1=0;
|
||||||
float tmpVal2=0;
|
float tmpVal2=0;
|
||||||
float tmpVal3=0;
|
float tmpVal3=0;
|
||||||
@ -464,25 +462,25 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
|
|||||||
vec4 tmp(tmpVal1, tmpVal2, tmpVal3, 1);
|
vec4 tmp(tmpVal1, tmpVal2, tmpVal3, 1);
|
||||||
material->setSpecularFactor(tmp);
|
material->setSpecularFactor(tmp);
|
||||||
EGE_VERBOSE(" SpecularFactor " << tmp);
|
EGE_VERBOSE(" SpecularFactor " << tmp);
|
||||||
} else if(0 == strncmp(inputDataLine,"Ni ",3)) {
|
} else if(strncmp(inputDataLine,"Ni ",3) == 0) {
|
||||||
float tmpVal=0;
|
float tmpVal=0;
|
||||||
sscanf(&inputDataLine[3], "%f", &tmpVal);
|
sscanf(&inputDataLine[3], "%f", &tmpVal);
|
||||||
// TODO : ...
|
// TODO : ...
|
||||||
EGE_VERBOSE(" Ni " << tmpVal);
|
EGE_VERBOSE(" Ni " << tmpVal);
|
||||||
} else if(0 == strncmp(inputDataLine,"d ",2)) {
|
} else if(strncmp(inputDataLine,"d ",2) == 0) {
|
||||||
float tmpVal=0;
|
float tmpVal=0;
|
||||||
sscanf(&inputDataLine[2], "%f", &tmpVal);
|
sscanf(&inputDataLine[2], "%f", &tmpVal);
|
||||||
// TODO : ...
|
// TODO : ...
|
||||||
EGE_VERBOSE(" d " << tmpVal);
|
EGE_VERBOSE(" d " << tmpVal);
|
||||||
} else if(0 == strncmp(inputDataLine,"illum ",6)) {
|
} else if(strncmp(inputDataLine,"illum ",6) == 0) {
|
||||||
int tmpVal=0;
|
int tmpVal=0;
|
||||||
sscanf(&inputDataLine[6], "%d", &tmpVal);
|
sscanf(&inputDataLine[6], "%d", &tmpVal);
|
||||||
// TODO : ...
|
// TODO : ...
|
||||||
EGE_VERBOSE(" illum " << tmpVal);
|
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]);
|
material->setTexture0(fileName.getRelativeFolder() + &inputDataLine[7]);
|
||||||
EGE_VERBOSE(" Texture " << &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;
|
gale::openGL::renderMode mode;
|
||||||
etk::from_string(mode, &inputDataLine[11]);
|
etk::from_string(mode, &inputDataLine[11]);
|
||||||
material->setRenderMode(mode);
|
material->setRenderMode(mode);
|
||||||
@ -499,7 +497,7 @@ bool ege::resource::Mesh::loadEMF(const std::string& _fileName) {
|
|||||||
}
|
}
|
||||||
// add last material ...
|
// add last material ...
|
||||||
if( materialName != ""
|
if( materialName != ""
|
||||||
&& material!=nullptr) {
|
&& material != nullptr) {
|
||||||
m_materials.add(materialName, material);
|
m_materials.add(materialName, material);
|
||||||
materialName = "";
|
materialName = "";
|
||||||
material.reset();
|
material.reset();
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ege/debug.h>
|
#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 << "\"");
|
EGE_ERROR("No data in the file named=\"" << fileName << "\"");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(false == fileName.fileOpenRead() ) {
|
if (fileName.fileOpenRead() == false) {
|
||||||
EGE_ERROR("Can not find the file name=\"" << fileName << "\"");
|
EGE_ERROR("Can not find the file name=\"" << fileName << "\"");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
char inputDataLine[2048];
|
char inputDataLine[2048];
|
||||||
|
|
||||||
int32_t lineID = 0;
|
int32_t lineID = 0;
|
||||||
while (nullptr != fileName.fileGets(inputDataLine, 2048) )
|
while (fileName.fileGets(inputDataLine, 2048) != nullptr)
|
||||||
{
|
{
|
||||||
lineID++;
|
lineID++;
|
||||||
if (inputDataLine[0] == 'v') {
|
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,
|
m_listFaces.push_back(Face(vertexIndex[0]-1, uvIndex[0]-1,
|
||||||
vertexIndex[1]-1, uvIndex[1]-1,
|
vertexIndex[1]-1, uvIndex[1]-1,
|
||||||
vertexIndex[2]-1, uvIndex[2]-1,
|
vertexIndex[2]-1, uvIndex[2]-1,
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
@ -38,7 +36,7 @@ void ege::resource::ParticuleMesh::draw(mat4& _positionMatrix,
|
|||||||
//EGE_DEBUG(m_name << " " << m_light);
|
//EGE_DEBUG(m_name << " " << m_light);
|
||||||
if (_enableDepthTest == true) {
|
if (_enableDepthTest == true) {
|
||||||
gale::openGL::enable(gale::openGL::flag_depthTest);
|
gale::openGL::enable(gale::openGL::flag_depthTest);
|
||||||
if (false == _enableDepthUpdate) {
|
if (_enableDepthUpdate == false) {
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -67,7 +65,7 @@ void ege::resource::ParticuleMesh::draw(mat4& _positionMatrix,
|
|||||||
int32_t nbElementDraw = 0;
|
int32_t nbElementDraw = 0;
|
||||||
#endif
|
#endif
|
||||||
for (int32_t kkk=0; kkk<m_listFaces.size(); kkk++) {
|
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) << "'");
|
EGE_WARNING("missing materials : '" << m_listFaces.getKey(kkk) << "'");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -121,7 +119,7 @@ void ege::resource::ParticuleMesh::draw(mat4& _positionMatrix,
|
|||||||
#endif
|
#endif
|
||||||
m_GLprogram->unUse();
|
m_GLprogram->unUse();
|
||||||
if (_enableDepthTest == true){
|
if (_enableDepthTest == true){
|
||||||
if (false == _enableDepthUpdate) {
|
if (_enableDepthUpdate == false) {
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
}
|
}
|
||||||
gale::openGL::disable(gale::openGL::flag_depthTest);
|
gale::openGL::disable(gale::openGL::flag_depthTest);
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ege/widget/Mesh.h>
|
#include <ege/widget/Mesh.h>
|
||||||
@ -11,11 +9,6 @@
|
|||||||
#include <gale/resource/Manager.h>
|
#include <gale/resource/Manager.h>
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "Mesh"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ege::widget::Mesh::Mesh():
|
ege::widget::Mesh::Mesh():
|
||||||
signalPressed(this, "pressed", ""),
|
signalPressed(this, "pressed", ""),
|
||||||
m_position(0,0,0),
|
m_position(0,0,0),
|
||||||
@ -30,9 +23,9 @@ void ege::widget::Mesh::init() {
|
|||||||
m_meshName = *propertyName;
|
m_meshName = *propertyName;
|
||||||
// Limit event at 1:
|
// Limit event at 1:
|
||||||
setMouseLimit(1);
|
setMouseLimit(1);
|
||||||
if (*propertyName!="") {
|
if (*propertyName != "") {
|
||||||
m_object = ege::resource::Mesh::create(m_meshName);
|
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 << "\"");
|
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(1,0,0),m_angle.x())
|
||||||
* etk::matRotate(vec3(0,1,0),m_angle.y())
|
* etk::matRotate(vec3(0,1,0),m_angle.y())
|
||||||
* etk::matRotate(vec3(0,0,1),m_angle.z());
|
* etk::matRotate(vec3(0,0,1),m_angle.z());
|
||||||
if (nullptr != m_object) {
|
if (m_object != nullptr) {
|
||||||
m_object->draw(transformationMatrix);
|
m_object->draw(transformationMatrix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,7 +63,7 @@ void ege::widget::Mesh::systemDraw(const ewol::DrawProperty& _displayProp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ege::widget::Mesh::onRegenerateDisplay() {
|
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_meshName = _filename;
|
m_meshName = _filename;
|
||||||
m_object = ege::resource::Mesh::create(m_meshName);
|
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 << "\"");
|
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) {
|
void ege::widget::Mesh::setAngleSpeed(const vec3& _speed) {
|
||||||
if (_speed!=vec3(0,0,0)) {
|
if (_speed != vec3(0,0,0)) {
|
||||||
periodicCallEnable();
|
periodicCallEnable();
|
||||||
} else {
|
} else {
|
||||||
periodicCallDisable();
|
periodicCallDisable();
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ege/debug.h>
|
#include <ege/debug.h>
|
||||||
@ -27,8 +25,6 @@
|
|||||||
#include <btBulletDynamicsCommon.h>
|
#include <btBulletDynamicsCommon.h>
|
||||||
#include <BulletCollision/CollisionDispatch/btCollisionObject.h>
|
#include <BulletCollision/CollisionDispatch/btCollisionObject.h>
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "Scene"
|
|
||||||
namespace etk {
|
namespace etk {
|
||||||
template<> std::string to_string<std::shared_ptr<ewol::resource::Colored3DObject> >(const std::shared_ptr<ewol::resource::Colored3DObject>& _value) {
|
template<> std::string to_string<std::shared_ptr<ewol::resource::Colored3DObject> >(const std::shared_ptr<ewol::resource::Colored3DObject>& _value) {
|
||||||
return "{{ERROR}}";
|
return "{{ERROR}}";
|
||||||
@ -60,7 +56,7 @@ ege::widget::Scene::~Scene() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ege::widget::Scene::onRegenerateDisplay() {
|
void ege::widget::Scene::onRegenerateDisplay() {
|
||||||
if (true == needRedraw()) {
|
if (needRedraw() == true) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
*
|
* @license APACHE v2.0 (see license file)
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user