[DEV] update nullptr in null (specific etk)
This commit is contained in:
parent
e515e411fd
commit
1fe5bececb
@ -35,7 +35,7 @@ ege::Entity::~Entity() {
|
||||
}
|
||||
|
||||
void ege::Entity::addComponent(const ememory::SharedPtr<ege::Component>& _ref) {
|
||||
if (_ref == nullptr) {
|
||||
if (_ref == null) {
|
||||
EGE_ERROR("try to add an empty component");
|
||||
return;
|
||||
}
|
||||
@ -43,7 +43,7 @@ void ege::Entity::addComponent(const ememory::SharedPtr<ege::Component>& _ref) {
|
||||
int32_t findId = -1;
|
||||
// check if not exist
|
||||
for (size_t iii=0; iii<m_component.size(); ++iii) {
|
||||
if (m_component[iii] == nullptr) {
|
||||
if (m_component[iii] == null) {
|
||||
continue;
|
||||
}
|
||||
if (m_component[iii]->getType() == _ref->getType()) {
|
||||
@ -56,7 +56,7 @@ void ege::Entity::addComponent(const ememory::SharedPtr<ege::Component>& _ref) {
|
||||
// try to add in an empty slot
|
||||
if (findId == -1) {
|
||||
for (size_t iii=0; iii<m_component.size(); ++iii) {
|
||||
if (m_component[iii] != nullptr) {
|
||||
if (m_component[iii] != null) {
|
||||
continue;
|
||||
}
|
||||
findId = iii;
|
||||
@ -70,10 +70,10 @@ void ege::Entity::addComponent(const ememory::SharedPtr<ege::Component>& _ref) {
|
||||
m_component.pushBack(_ref);
|
||||
}
|
||||
for (size_t iii=0; iii<m_component.size(); ++iii) {
|
||||
if (m_component[iii] == nullptr) {
|
||||
if (m_component[iii] == null) {
|
||||
continue;
|
||||
}
|
||||
if (componentRemoved != nullptr) {
|
||||
if (componentRemoved != null) {
|
||||
m_env->engineComponentRemove(componentRemoved);
|
||||
m_component[iii]->removeFriendComponent(componentRemoved);
|
||||
}
|
||||
@ -83,7 +83,7 @@ void ege::Entity::addComponent(const ememory::SharedPtr<ege::Component>& _ref) {
|
||||
// notify new component of all previously added component:
|
||||
componentRemoved = _ref;
|
||||
for (size_t iii=0; iii<m_component.size(); ++iii) {
|
||||
if (m_component[iii] == nullptr) {
|
||||
if (m_component[iii] == null) {
|
||||
continue;
|
||||
}
|
||||
if (m_component[iii] == _ref) {
|
||||
@ -94,18 +94,18 @@ void ege::Entity::addComponent(const ememory::SharedPtr<ege::Component>& _ref) {
|
||||
}
|
||||
|
||||
void ege::Entity::rmComponent(const ememory::SharedPtr<ege::Component>& _ref) {
|
||||
if (_ref == nullptr) {
|
||||
if (_ref == null) {
|
||||
EGE_ERROR("try to remove an empty component");
|
||||
return;
|
||||
}
|
||||
int32_t findId = -1;
|
||||
// check if not exist
|
||||
for (size_t iii=0; iii<m_component.size(); ++iii) {
|
||||
if (m_component[iii] == nullptr) {
|
||||
if (m_component[iii] == null) {
|
||||
continue;
|
||||
}
|
||||
if (m_component[iii] == _ref) {
|
||||
m_component[iii] = nullptr;
|
||||
m_component[iii] = null;
|
||||
findId = iii;
|
||||
break;
|
||||
}
|
||||
@ -115,7 +115,7 @@ void ege::Entity::rmComponent(const ememory::SharedPtr<ege::Component>& _ref) {
|
||||
return;
|
||||
}
|
||||
for (size_t iii=0; iii<m_component.size(); ++iii) {
|
||||
if (m_component[iii] == nullptr) {
|
||||
if (m_component[iii] == null) {
|
||||
continue;
|
||||
}
|
||||
m_env->engineComponentRemove(_ref);
|
||||
@ -128,12 +128,12 @@ void ege::Entity::rmComponent(const etk::String& _type) {
|
||||
ememory::SharedPtr<ege::Component> componentRemoved;
|
||||
// check if not exist
|
||||
for (size_t iii=0; iii<m_component.size(); ++iii) {
|
||||
if (m_component[iii] == nullptr) {
|
||||
if (m_component[iii] == null) {
|
||||
continue;
|
||||
}
|
||||
if (m_component[iii]->getType() == _type) {
|
||||
componentRemoved = m_component[iii];
|
||||
m_component[iii] = nullptr;
|
||||
m_component[iii] = null;
|
||||
findId = iii;
|
||||
break;
|
||||
}
|
||||
@ -143,7 +143,7 @@ void ege::Entity::rmComponent(const etk::String& _type) {
|
||||
return;
|
||||
}
|
||||
for (size_t iii=0; iii<m_component.size(); ++iii) {
|
||||
if (m_component[iii] == nullptr) {
|
||||
if (m_component[iii] == null) {
|
||||
continue;
|
||||
}
|
||||
m_env->engineComponentRemove(componentRemoved);
|
||||
@ -154,14 +154,14 @@ void ege::Entity::rmComponent(const etk::String& _type) {
|
||||
ememory::SharedPtr<ege::Component> ege::Entity::getComponent(const etk::String& _type) {
|
||||
// check if not exist
|
||||
for (size_t iii=0; iii<m_component.size(); ++iii) {
|
||||
if (m_component[iii] == nullptr) {
|
||||
if (m_component[iii] == null) {
|
||||
continue;
|
||||
}
|
||||
if (m_component[iii]->getType() == _type) {
|
||||
return m_component[iii];
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -219,7 +219,7 @@ const float lifeYPos = 1.7f;
|
||||
|
||||
#if 0
|
||||
void ege::Entity::drawLife(ememory::SharedPtr<ewol::resource::Colored3DObject> _draw, ememory::SharedPtr<ege::Camera> _camera) {
|
||||
if (_draw == nullptr) {
|
||||
if (_draw == null) {
|
||||
return;
|
||||
}
|
||||
float ratio = getLifeRatio();
|
||||
|
@ -21,13 +21,13 @@
|
||||
ETK_DECLARE_TYPE(ege::gameStatus);
|
||||
|
||||
void ege::Environement::addEngine(const ememory::SharedPtr<ege::Engine>& _ref) {
|
||||
if (_ref == nullptr) {
|
||||
if (_ref == null) {
|
||||
EGE_ERROR("try to add an empty Engine");
|
||||
return;
|
||||
}
|
||||
// check if not exist
|
||||
for (auto &it: m_engine) {
|
||||
if (it == nullptr) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
if (it->getType() == _ref->getType()) {
|
||||
@ -37,7 +37,7 @@ void ege::Environement::addEngine(const ememory::SharedPtr<ege::Engine>& _ref) {
|
||||
}
|
||||
// try to add in an empty slot
|
||||
for (auto &it: m_engine) {
|
||||
if (it != nullptr) {
|
||||
if (it != null) {
|
||||
continue;
|
||||
}
|
||||
it = _ref;
|
||||
@ -48,17 +48,17 @@ void ege::Environement::addEngine(const ememory::SharedPtr<ege::Engine>& _ref) {
|
||||
}
|
||||
|
||||
void ege::Environement::rmEngine(const ememory::SharedPtr<ege::Engine>& _ref) {
|
||||
if (_ref == nullptr) {
|
||||
if (_ref == null) {
|
||||
EGE_ERROR("try to remove an empty engine");
|
||||
return;
|
||||
}
|
||||
// check if not exist
|
||||
for (auto &it: m_engine) {
|
||||
if (it == nullptr) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
if (it == _ref) {
|
||||
it = nullptr;
|
||||
it = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -68,11 +68,11 @@ void ege::Environement::rmEngine(const ememory::SharedPtr<ege::Engine>& _ref) {
|
||||
void ege::Environement::rmEngine(const etk::String& _type) {
|
||||
// check if not exist
|
||||
for (auto &it: m_engine) {
|
||||
if (it == nullptr) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
if (it->getType() == _type) {
|
||||
it = nullptr;
|
||||
it = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -83,7 +83,7 @@ void ege::Environement::rmEngine(const etk::String& _type) {
|
||||
ememory::SharedPtr<ege::Engine> ege::Environement::getEngine(const etk::String& _type) {
|
||||
// check if not exist
|
||||
for (auto &it: m_engine) {
|
||||
if (it == nullptr) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
if (it->getType() == _type) {
|
||||
@ -91,12 +91,12 @@ ememory::SharedPtr<ege::Engine> ege::Environement::getEngine(const etk::String&
|
||||
}
|
||||
}
|
||||
EGE_ERROR("try to get an unexisting engine type : '" << _type << "'");
|
||||
return nullptr;
|
||||
return null;
|
||||
}
|
||||
|
||||
void ege::Environement::engineComponentRemove(const ememory::SharedPtr<ege::Component>& _ref) {
|
||||
for (auto &it: m_engine) {
|
||||
if (it == nullptr) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
if (it->getType() == _ref->getType()) {
|
||||
@ -107,7 +107,7 @@ void ege::Environement::engineComponentRemove(const ememory::SharedPtr<ege::Comp
|
||||
}
|
||||
void ege::Environement::engineComponentAdd(const ememory::SharedPtr<ege::Component>& _ref) {
|
||||
for (auto &it: m_engine) {
|
||||
if (it == nullptr) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
if (it->getType() == _ref->getType()) {
|
||||
@ -119,14 +119,14 @@ void ege::Environement::engineComponentAdd(const ememory::SharedPtr<ege::Compone
|
||||
|
||||
/*
|
||||
ememory::SharedPtr<ege::Entity> ege::Environement::getEntityNearest(ememory::SharedPtr<ege::Entity> _sourceRequest, float& _distance) {
|
||||
if (_sourceRequest == nullptr) {
|
||||
return nullptr;
|
||||
if (_sourceRequest == null) {
|
||||
return null;
|
||||
}
|
||||
vec3 sourcePosition = _sourceRequest->getPosition();
|
||||
ememory::SharedPtr<ege::Entity> result = nullptr;
|
||||
ememory::SharedPtr<ege::Entity> result = null;
|
||||
for (size_t iii=0; iii<m_listEntity.size() ; iii++) {
|
||||
// chack nullptr pointer
|
||||
if (m_listEntity[iii] == nullptr) {
|
||||
// chack null pointer
|
||||
if (m_listEntity[iii] == null) {
|
||||
continue;
|
||||
}
|
||||
if (m_listEntity[iii]->getGroup() <= 0) {
|
||||
@ -155,11 +155,11 @@ void ege::Environement::getEntityNearest(const vec3& _sourcePosition,
|
||||
_resultList.clear();
|
||||
ege::Environement::ResultNearestEntity result;
|
||||
result.dist = 99999999999.0f;
|
||||
result.entity = nullptr;
|
||||
result.entity = null;
|
||||
for (size_t iii=0; iii<m_listEntity.size() ; iii++) {
|
||||
// chack nullptr pointer
|
||||
// chack null pointer
|
||||
result.entity = m_listEntity[iii];
|
||||
if (result.entity == nullptr) {
|
||||
if (result.entity == null) {
|
||||
continue;
|
||||
}
|
||||
// check distance ...
|
||||
@ -181,11 +181,11 @@ void ege::Environement::getEntityNearestFixed(const vec3& _sourcePosition,
|
||||
_resultList.clear();
|
||||
ege::Environement::ResultNearestEntity result;
|
||||
result.dist = 99999999999.0f;
|
||||
result.entity = nullptr;
|
||||
result.entity = null;
|
||||
for (size_t iii=0; iii<m_listEntity.size() ; iii++) {
|
||||
// chack nullptr pointer
|
||||
// chack null pointer
|
||||
result.entity = m_listEntity[iii];
|
||||
if (result.entity == nullptr) {
|
||||
if (result.entity == null) {
|
||||
continue;
|
||||
}
|
||||
if (result.entity->isFixed() == false) {
|
||||
@ -220,7 +220,7 @@ static etk::Map<etk::String,ege::createEntity_tf>& getHachTableCreating() {
|
||||
}
|
||||
|
||||
void ege::Environement::addCreator(const etk::String& _type, ege::createEntity_tf _creator) {
|
||||
if (_creator == nullptr) {
|
||||
if (_creator == null) {
|
||||
EGE_ERROR("Try to add an empty CREATOR ...");
|
||||
return;
|
||||
}
|
||||
@ -233,17 +233,17 @@ void ege::Environement::addCreator(const etk::String& _type, ege::createEntity_t
|
||||
ememory::SharedPtr<ege::Entity> ege::Environement::createEntity(const etk::String& _type, const ejson::Value& _value, bool _autoAddEntity) {
|
||||
if (getHachTableCreating().exist(_type) == false) {
|
||||
EGE_ERROR("Request creating of an type that is not known '" << _type << "'");
|
||||
return nullptr;
|
||||
return null;
|
||||
}
|
||||
ege::createEntity_tf creatorPointer = getHachTableCreating()[_type];
|
||||
if (creatorPointer == nullptr) {
|
||||
EGE_ERROR("nullptr pointer creator == > internal error... '" << _type << "'");
|
||||
return nullptr;
|
||||
if (creatorPointer == null) {
|
||||
EGE_ERROR("null pointer creator == > internal error... '" << _type << "'");
|
||||
return null;
|
||||
}
|
||||
ememory::SharedPtr<ege::Entity> tmpEntity = creatorPointer(ememory::dynamicPointerCast<ege::Environement>(sharedFromThis()), _value);
|
||||
if (tmpEntity == nullptr) {
|
||||
if (tmpEntity == null) {
|
||||
EGE_ERROR("allocation error '" << _type << "'");
|
||||
return nullptr;
|
||||
return null;
|
||||
}
|
||||
if (_autoAddEntity == true) {
|
||||
addEntity(tmpEntity);
|
||||
@ -258,11 +258,11 @@ ememory::SharedPtr<ege::Entity> ege::Environement::createEntity(const etk::Strin
|
||||
|
||||
void ege::Environement::addEntity(ememory::SharedPtr<ege::Entity> _newEntity) {
|
||||
// prevent memory allocation and un allocation ...
|
||||
if (_newEntity == nullptr) {
|
||||
if (_newEntity == null) {
|
||||
return;
|
||||
}
|
||||
for (size_t iii=0; iii<m_listEntity.size() ; iii++) {
|
||||
if (m_listEntity[iii] == nullptr) {
|
||||
if (m_listEntity[iii] == null) {
|
||||
m_listEntity[iii] = _newEntity;
|
||||
m_listEntity[iii]->dynamicEnable();
|
||||
return;
|
||||
@ -273,12 +273,12 @@ void ege::Environement::addEntity(ememory::SharedPtr<ege::Entity> _newEntity) {
|
||||
}
|
||||
|
||||
void ege::Environement::rmEntity(ememory::SharedPtr<ege::Entity> _removeEntity) {
|
||||
if (_removeEntity == nullptr) {
|
||||
if (_removeEntity == null) {
|
||||
return;
|
||||
}
|
||||
// inform the entity that an entity has been removed == > this permit to keep pointer on entitys ...
|
||||
for (size_t iii=0; iii<m_listEntity.size() ; iii++) {
|
||||
if (m_listEntity[iii] != nullptr) {
|
||||
if (m_listEntity[iii] != null) {
|
||||
m_listEntity[iii]->entityIsRemoved(_removeEntity);
|
||||
}
|
||||
}
|
||||
@ -296,7 +296,7 @@ void ege::Environement::rmEntity(ememory::SharedPtr<ege::Entity> _removeEntity)
|
||||
void ege::Environement::generateInteraction(ege::EntityInteraction& _event) {
|
||||
// inform the entity that an entity has been removed == > this permit to keep pointer on entitys ...
|
||||
for (size_t iii=0; iii<m_listEntity.size() ; iii++) {
|
||||
if (m_listEntity[iii] == nullptr) {
|
||||
if (m_listEntity[iii] == null) {
|
||||
continue;
|
||||
}
|
||||
_event.applyEvent(*m_listEntity[iii]);
|
||||
@ -341,19 +341,19 @@ void ege::Environement::clear() {
|
||||
void ege::Environement::render(const echrono::Duration& _delta, const etk::String& _camera) {
|
||||
// get the correct camera:
|
||||
ememory::SharedPtr<ege::Camera> camera = getCamera(_camera);
|
||||
if (camera == nullptr) {
|
||||
if (camera == null) {
|
||||
EGE_ERROR("Render: Can not get camera named: '" << _camera << "'");
|
||||
return;
|
||||
}
|
||||
for (auto &it: m_engine) {
|
||||
if(it == nullptr) {
|
||||
if(it == null) {
|
||||
continue;
|
||||
}
|
||||
EGE_VERBOSE(" render: " << it->getType());
|
||||
it->render(_delta, camera);
|
||||
}
|
||||
for (auto &it: m_engine) {
|
||||
if(it == nullptr) {
|
||||
if(it == null) {
|
||||
continue;
|
||||
}
|
||||
EGE_VERBOSE(" render: " << it->getType());
|
||||
@ -382,14 +382,14 @@ void ege::Environement::onCallbackPeriodicCall(const ewol::event::Time& _event)
|
||||
|
||||
// update camera positions:
|
||||
for (auto &it : m_listCamera) {
|
||||
if (it.second != nullptr) {
|
||||
if (it.second != null) {
|
||||
EGE_VERBOSE(" update camera : '" << it.first << "'");
|
||||
it.second->periodicCall(curentDelta);
|
||||
}
|
||||
}
|
||||
EGE_VERBOSE(" step simulation : " << curentDelta);
|
||||
for (auto &it: m_engine) {
|
||||
if(it == nullptr) {
|
||||
if(it == null) {
|
||||
continue;
|
||||
}
|
||||
EGE_VERBOSE(" update: " << it->getType());
|
||||
@ -410,7 +410,7 @@ void ege::Environement::onCallbackPeriodicCall(const ewol::event::Time& _event)
|
||||
int32_t victoryPoint=0;
|
||||
auto it(m_listEntity.begin());
|
||||
while (it != m_listEntity.end()) {
|
||||
if(*it != nullptr) {
|
||||
if(*it != null) {
|
||||
if ((*it)->needToRemove() == true) {
|
||||
if ((*it)->getGroup() > 1) {
|
||||
numberEnnemyKilled++;
|
||||
@ -443,7 +443,7 @@ ememory::SharedPtr<ege::Camera> ege::Environement::getCamera(const etk::String&
|
||||
if (cameraIt != m_listCamera.end()) {
|
||||
return cameraIt->second;
|
||||
}
|
||||
return nullptr;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
@ -138,7 +138,7 @@ namespace ege {
|
||||
* @param[in] _type Type of the entity that might be created.
|
||||
* @param[in] _description String that describe the content of the entity properties.
|
||||
* @param[in] _autoAddEntity this permit to add the entity if it is created == > no more action ...
|
||||
* @return nullptr if an error occured OR the pointer on the entity and it is already added on the system.
|
||||
* @return null if an error occured OR the pointer on the entity and it is already added on the system.
|
||||
* @note Pointer is return in case of setting properties on it...
|
||||
*/
|
||||
ememory::SharedPtr<ege::Entity> createEntity(const etk::String& _type, const ejson::Value& _value, bool _autoAddEntity=true);
|
||||
@ -176,7 +176,7 @@ namespace ege {
|
||||
* @brief get the nearest Entity
|
||||
* @param[in] _sourceRequest Pointer on the entity that request this.
|
||||
* @param[in] _distance Maximum distance search == > return the entity distance
|
||||
* @return Pointer on the neares entity OR nullptr
|
||||
* @return Pointer on the neares entity OR null
|
||||
*/
|
||||
/*
|
||||
ememory::SharedPtr<ege::Entity> getEntityNearest(ememory::SharedPtr<ege::Entity> _sourceRequest, float& _distance);
|
||||
|
@ -26,7 +26,7 @@ ege::Light::~Light() {
|
||||
}
|
||||
|
||||
void ege::Light::link(ememory::SharedPtr<gale::resource::Program> _prog, const etk::String& _baseName) {
|
||||
if (_prog == nullptr) {
|
||||
if (_prog == null) {
|
||||
return;
|
||||
}
|
||||
m_GL_direction = _prog->getUniform(_baseName+".direction");
|
||||
|
@ -18,7 +18,7 @@ ege::MaterialGlId::MaterialGlId() :
|
||||
}
|
||||
|
||||
void ege::MaterialGlId::link(ememory::SharedPtr<gale::resource::Program> _prog, const etk::String& _baseName) {
|
||||
if (_prog == nullptr) {
|
||||
if (_prog == null) {
|
||||
return;
|
||||
}
|
||||
m_GL_ambientFactor = _prog->getUniform(_baseName+".ambientFactor");
|
||||
@ -34,7 +34,7 @@ ege::Material::Material() :
|
||||
m_specularFactor(0,0,0,1),
|
||||
m_shininess(1),
|
||||
m_renderMode(gale::openGL::renderMode::triangle),
|
||||
m_texture0(nullptr) {
|
||||
m_texture0(null) {
|
||||
// nothing to do else ...
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ void ege::Material::draw(ememory::SharedPtr<gale::resource::Program> _prog, cons
|
||||
_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 (m_texture0 != nullptr) {
|
||||
if (m_texture0 != null) {
|
||||
EGE_VERBOSE(" set texture: " << _glID.m_GL_texture0 << " " << m_texture0->getId());
|
||||
_prog->setTexture0(_glID.m_GL_texture0, m_texture0->getRendererId());
|
||||
#if DEBUG
|
||||
@ -89,11 +89,11 @@ void ege::Material::setTexture0(const etk::String& _filename) {
|
||||
// prevent overloard error :
|
||||
ememory::SharedPtr<ewol::resource::Texture> tmpCopy = m_texture0;
|
||||
m_texture0 = ewol::resource::TextureFile::create(_filename, tmpSize);
|
||||
if (m_texture0 == nullptr) {
|
||||
if (m_texture0 == null) {
|
||||
EGE_ERROR("Can not load specific texture : " << _filename);
|
||||
// retreave previous texture:
|
||||
m_texture0 = tmpCopy;
|
||||
if (m_texture0 != nullptr) {
|
||||
if (m_texture0 != null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -105,7 +105,7 @@ void ege::Material::setTexture0(const etk::String& _filename) {
|
||||
void ege::Material::setTexture0Magic(const ivec2& _size) {
|
||||
// create a simple custum texture :
|
||||
m_texture0 = ewol::resource::Texture::create();
|
||||
if (m_texture0 != nullptr) {
|
||||
if (m_texture0 != null) {
|
||||
setImageSize(_size);
|
||||
egami::Image& img = m_texture0->get();
|
||||
for (int32_t xxx=0; xxx<_size.x(); ++xxx) {
|
||||
@ -166,21 +166,21 @@ void ege::Material::setRenderMode(enum gale::openGL::renderMode _val) {
|
||||
}
|
||||
|
||||
void ege::Material::setImageSize(const ivec2& _newSize) {
|
||||
if (m_texture0 == nullptr){
|
||||
if (m_texture0 == null){
|
||||
return;
|
||||
}
|
||||
m_texture0->setImageSize(_newSize);
|
||||
}
|
||||
|
||||
egami::Image* ege::Material::get() {
|
||||
if (m_texture0 == nullptr){
|
||||
return nullptr;
|
||||
if (m_texture0 == null){
|
||||
return null;
|
||||
}
|
||||
return &m_texture0->get();
|
||||
}
|
||||
|
||||
void ege::Material::flush() {
|
||||
if (m_texture0 == nullptr){
|
||||
if (m_texture0 == null){
|
||||
return;
|
||||
}
|
||||
m_texture0->flush();
|
||||
|
@ -22,7 +22,7 @@ ege::camera::ControlBase::ControlBase() :
|
||||
void ege::camera::ControlBase::setCamera(const ememory::SharedPtr<ege::camera::View>& _camera) {
|
||||
m_camera.reset();
|
||||
m_PCH.disconnect();
|
||||
if (_camera == nullptr) {
|
||||
if (_camera == null) {
|
||||
return;
|
||||
}
|
||||
m_camera = _camera;
|
||||
@ -111,7 +111,7 @@ bool ege::camera::ControlBase::onEventEntry(const ewol::event::Entry& _event) {
|
||||
}
|
||||
|
||||
bool ege::camera::ControlBase::onEventInput(const ewol::event::Input& _event, const vec2& _relativePosition) {
|
||||
if (m_camera == nullptr) {
|
||||
if (m_camera == null) {
|
||||
return false;
|
||||
}
|
||||
if (_event.getId() == 4) {
|
||||
@ -163,7 +163,7 @@ bool ege::camera::ControlBase::onEventInput(const ewol::event::Input& _event, co
|
||||
}
|
||||
|
||||
void ege::camera::ControlBase::periodicCall(const ewol::event::Time& _event) {
|
||||
if (m_camera == nullptr) {
|
||||
if (m_camera == null) {
|
||||
return;
|
||||
}
|
||||
if ( m_destinationCameraOffset.x() < 0.7f
|
||||
|
@ -26,10 +26,10 @@ const etk::String& ege::ElementPhysic::getType() const {
|
||||
|
||||
ege::ElementPhysic::ElementPhysic(const ememory::SharedPtr<ege::Environement>& _env, bool _autoRigidBody) ://, float _mass) :
|
||||
ege::Element(_env),
|
||||
m_body(nullptr),
|
||||
//m_shape(nullptr),
|
||||
m_body(null),
|
||||
//m_shape(null),
|
||||
m_elementInPhysicsSystem(false),
|
||||
m_IA(nullptr),
|
||||
m_IA(null),
|
||||
m_detectCollisionEnable(false) {
|
||||
if (_autoRigidBody == true) {
|
||||
createRigidBody();
|
||||
@ -46,7 +46,7 @@ ege::ElementPhysic::~ElementPhysic() {
|
||||
//removeShape();
|
||||
// Destroy the rigid body
|
||||
//m_dynamicsWorld->destroyRigidBody(m_body);
|
||||
m_body = nullptr;
|
||||
m_body = null;
|
||||
}
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@ void ege::ElementPhysic::createRigidBody(float _mass, bool _static) {
|
||||
rp3d::Transform transform(initPosition, initOrientation);
|
||||
|
||||
// Create a rigid body in the world
|
||||
m_body = nullptr;//m_dynamicsWorld->createRigidBody(transform);
|
||||
m_body = null;//m_dynamicsWorld->createRigidBody(transform);
|
||||
/*
|
||||
if (_static = true) {
|
||||
m_body->setType(STATIC);
|
||||
@ -72,16 +72,16 @@ void ege::ElementPhysic::createRigidBody(float _mass, bool _static) {
|
||||
|
||||
bool ege::ElementPhysic::setMesh(ememory::SharedPtr<ege::resource::Mesh> _mesh) {
|
||||
EGE_WARNING("Set Mesh");
|
||||
if (m_mesh != nullptr) {
|
||||
if (m_mesh != null) {
|
||||
//removeShape();
|
||||
}
|
||||
ege::Element::setMesh(_mesh);
|
||||
// auto load the shape:
|
||||
if (m_mesh == nullptr) {
|
||||
if (m_mesh == null) {
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
if (m_mesh->getShape() != nullptr) {
|
||||
if (m_mesh->getShape() != null) {
|
||||
EGE_WARNING("create shape whith mesh internal shape ...");
|
||||
m_shape = static_cast<btCollisionShape*>(m_mesh->getShape());
|
||||
return true;
|
||||
@ -102,7 +102,7 @@ bool ege::ElementPhysic::setShape(btCollisionShape* _shape) {
|
||||
EGE_DEBUG("Set Shape");
|
||||
removeShape();
|
||||
m_shape = _shape;
|
||||
if (_shape == nullptr) {
|
||||
if (_shape == null) {
|
||||
EGE_WARNING("Remove shape ...");
|
||||
} else {
|
||||
EGE_INFO("set shape ...");
|
||||
@ -112,20 +112,20 @@ bool ege::ElementPhysic::setShape(btCollisionShape* _shape) {
|
||||
|
||||
void ege::ElementPhysic::removeShape() {
|
||||
// no shape
|
||||
if (m_shape == nullptr) {
|
||||
if (m_shape == null) {
|
||||
return;
|
||||
}
|
||||
// need to chek if the shape is the same as the mesh shape ...
|
||||
if (m_mesh == nullptr) {
|
||||
if (m_mesh == null) {
|
||||
// no mesh == > standalone shape
|
||||
ETK_DELETE(btCollisionShape, m_shape);
|
||||
m_shape=nullptr;
|
||||
m_shape=null;
|
||||
EGE_WARNING("Remove shape .2.");
|
||||
return;
|
||||
}
|
||||
if (m_shape != m_mesh->getShape()) {
|
||||
ETK_DELETE(btCollisionShape, m_shape);
|
||||
m_shape=nullptr;
|
||||
m_shape=null;
|
||||
EGE_WARNING("Remove shape .3.");
|
||||
return;
|
||||
}
|
||||
@ -133,14 +133,14 @@ void ege::ElementPhysic::removeShape() {
|
||||
}
|
||||
|
||||
void ege::ElementPhysic::FunctionFreeShape(void* _pointer) {
|
||||
if (_pointer == nullptr) {
|
||||
if (_pointer == null) {
|
||||
return;
|
||||
}
|
||||
ETK_DELETE(btCollisionShape, _pointer);
|
||||
}
|
||||
*/
|
||||
void ege::ElementPhysic::setPosition(const vec3& _pos) {
|
||||
if (m_body != nullptr) {
|
||||
if (m_body != null) {
|
||||
/*
|
||||
btTransform transformation = m_body->getCenterOfMassTransform();
|
||||
transformation.setOrigin(_pos);
|
||||
@ -151,7 +151,7 @@ void ege::ElementPhysic::setPosition(const vec3& _pos) {
|
||||
|
||||
const vec3& ege::ElementPhysic::getPosition() {
|
||||
/*
|
||||
if (m_body != nullptr) {
|
||||
if (m_body != null) {
|
||||
return m_body->getCenterOfMassPosition();
|
||||
}
|
||||
*/
|
||||
@ -161,7 +161,7 @@ const vec3& ege::ElementPhysic::getPosition() {
|
||||
const vec3& ege::ElementPhysic::getSpeed() {
|
||||
static vec3 emptySpeed(0,0,0);
|
||||
/*
|
||||
if (m_body != nullptr) {
|
||||
if (m_body != null) {
|
||||
return m_body->getLinearVelocity();
|
||||
}
|
||||
*/
|
||||
@ -170,7 +170,7 @@ const vec3& ege::ElementPhysic::getSpeed() {
|
||||
|
||||
const float ege::ElementPhysic::getInvMass() {
|
||||
/*
|
||||
if (m_body != nullptr) {
|
||||
if (m_body != null) {
|
||||
return m_body->getInvMass();
|
||||
}
|
||||
*/
|
||||
@ -182,8 +182,8 @@ void ege::ElementPhysic::drawShape(/*const btCollisionShape* _shape,*/
|
||||
mat4 _transformationMatrix,
|
||||
etk::Vector<vec3> _tmpVertices) {
|
||||
#if 0
|
||||
if( _draw == nullptr
|
||||
|| _shape == nullptr) {
|
||||
if( _draw == null
|
||||
|| _shape == null) {
|
||||
return;
|
||||
}
|
||||
etk::Color<float> tmpColor(1.0, 0.0, 0.0, 0.3);
|
||||
@ -227,7 +227,7 @@ void ege::ElementPhysic::drawShape(/*const btCollisionShape* _shape,*/
|
||||
if (_shape->isConvex()) {
|
||||
EGE_DEBUG(" shape->isConvex()");
|
||||
const btConvexPolyhedron* poly = _shape->isPolyhedral() ? ((btPolyhedralConvexShape*) _shape)->getConvexPolyhedron() : 0;
|
||||
if (nullptr!=poly) {
|
||||
if (null!=poly) {
|
||||
EGE_DEBUG(" have poly");
|
||||
/*
|
||||
glBegin(GL_TRIANGLES);
|
||||
@ -333,8 +333,8 @@ void ege::ElementPhysic::draw(int32_t _pass) {
|
||||
/*
|
||||
//EGE_INFO("draw : " << _pass );
|
||||
if (_pass == 0) {
|
||||
if( m_body != nullptr
|
||||
&& m_mesh != nullptr) {
|
||||
if( m_body != null
|
||||
&& m_mesh != null) {
|
||||
//EGE_INFO("element pos = " << getPosition());
|
||||
float mmm[16];
|
||||
// Get the interpolated transform of the rigid body
|
||||
@ -356,11 +356,11 @@ void ege::ElementPhysic::dynamicEnable() {
|
||||
if (m_elementInPhysicsSystem == true) {
|
||||
return;
|
||||
}
|
||||
if(m_body != nullptr) {
|
||||
if(m_body != null) {
|
||||
EGE_VERBOSE("dynamicEnable : RigidBody");
|
||||
//m_env->getPhysicEngine().getDynamicWorld()->addRigidBody(m_body);
|
||||
}
|
||||
if(m_IA != nullptr) {
|
||||
if(m_IA != null) {
|
||||
EGE_VERBOSE("dynamicEnable : IA");
|
||||
//m_env->getPhysicEngine().getDynamicWorld()->addAction(m_IA);
|
||||
}
|
||||
@ -371,11 +371,11 @@ void ege::ElementPhysic::dynamicDisable() {
|
||||
if (m_elementInPhysicsSystem == false) {
|
||||
return;
|
||||
}
|
||||
if(m_IA != nullptr) {
|
||||
if(m_IA != null) {
|
||||
EGE_VERBOSE("dynamicDisable : IA");
|
||||
//m_env->getPhysicEngine().getDynamicWorld()->removeAction(m_IA);
|
||||
}
|
||||
if(m_body != nullptr) {
|
||||
if(m_body != null) {
|
||||
EGE_VERBOSE("dynamicDisable : RigidBody");
|
||||
// Unlink element from the engine
|
||||
//m_env->getPhysicEngine().getDynamicWorld()->removeRigidBody(m_body);
|
||||
@ -385,12 +385,12 @@ void ege::ElementPhysic::dynamicDisable() {
|
||||
}
|
||||
|
||||
void ege::ElementPhysic::iaEnable() {
|
||||
if (m_IA != nullptr) {
|
||||
if (m_IA != null) {
|
||||
// IA already started ...
|
||||
return;
|
||||
}
|
||||
m_IA = ETK_NEW(localIA, *this);
|
||||
if (m_IA == nullptr) {
|
||||
if (m_IA == null) {
|
||||
EGE_ERROR("Can not start the IA == > allocation error");
|
||||
return;
|
||||
}
|
||||
@ -400,7 +400,7 @@ void ege::ElementPhysic::iaEnable() {
|
||||
}
|
||||
|
||||
void ege::ElementPhysic::iaDisable() {
|
||||
if (m_IA == nullptr) {
|
||||
if (m_IA == null) {
|
||||
// IA already stopped ...
|
||||
return;
|
||||
}
|
||||
@ -409,16 +409,16 @@ void ege::ElementPhysic::iaDisable() {
|
||||
}
|
||||
// remove IA:
|
||||
ETK_DELETE(localIA, m_IA);
|
||||
m_IA = nullptr;
|
||||
m_IA = null;
|
||||
}
|
||||
|
||||
void ege::ElementPhysic::setMass(float _value) {
|
||||
if (m_body == nullptr) {
|
||||
if (m_body == null) {
|
||||
return;
|
||||
}
|
||||
/*
|
||||
vec3 localInertia(0,0,0);
|
||||
if (_value != 0.0f && getShape()!=nullptr) {
|
||||
if (_value != 0.0f && getShape()!=null) {
|
||||
//getShape()->calculateLocalInertia(_value, localInertia);
|
||||
EWOL_ERROR("Update inertia calculated : " << localInertia);
|
||||
}
|
||||
@ -427,7 +427,7 @@ void ege::ElementPhysic::setMass(float _value) {
|
||||
}
|
||||
|
||||
void ege::ElementPhysic::setLinearVelocity(const vec3& _value) {
|
||||
if (m_body == nullptr) {
|
||||
if (m_body == null) {
|
||||
EGE_WARNING("no body");
|
||||
return;
|
||||
}
|
||||
@ -438,7 +438,7 @@ void ege::ElementPhysic::setLinearVelocity(const vec3& _value) {
|
||||
}
|
||||
|
||||
void ege::ElementPhysic::setTorqueImpulse(const vec3& _value) {
|
||||
if (m_body == nullptr) {
|
||||
if (m_body == null) {
|
||||
EGE_WARNING("no body");
|
||||
return;
|
||||
}
|
||||
@ -449,7 +449,7 @@ void ege::ElementPhysic::setTorqueImpulse(const vec3& _value) {
|
||||
}
|
||||
|
||||
void ege::ElementPhysic::setAngularVelocity(const vec3& _value) {
|
||||
if (m_body == nullptr) {
|
||||
if (m_body == null) {
|
||||
EGE_WARNING("no body");
|
||||
return;
|
||||
}
|
||||
@ -457,7 +457,7 @@ void ege::ElementPhysic::setAngularVelocity(const vec3& _value) {
|
||||
}
|
||||
/*
|
||||
btQuaternion ege::ElementPhysic::getOrientation() const {
|
||||
if (m_body == nullptr) {
|
||||
if (m_body == null) {
|
||||
EGE_WARNING("no body");
|
||||
return btQuaternion(0,0,0,0);
|
||||
}
|
||||
@ -467,7 +467,7 @@ btQuaternion ege::ElementPhysic::getOrientation() const {
|
||||
*/
|
||||
|
||||
void ege::ElementPhysic::setCollisionDetectionStatus(bool _status) {
|
||||
if (m_body == nullptr) {
|
||||
if (m_body == null) {
|
||||
EGE_WARNING("no body");
|
||||
return;
|
||||
}
|
||||
|
@ -24,9 +24,9 @@ namespace ege {
|
||||
/**
|
||||
* @brief Constructor.
|
||||
* @param[in] _particuleEngine reference on the particule engine ...
|
||||
* @param[in] _particuleType Type of the particule (set nullptr if you did not want to use the respowner ...)
|
||||
* @param[in] _particuleType Type of the particule (set null if you did not want to use the respowner ...)
|
||||
*/
|
||||
Component(ege::particule::Engine* _particuleEngine, const char* _particuleType = nullptr);
|
||||
Component(ege::particule::Engine* _particuleEngine, const char* _particuleType = null);
|
||||
/**
|
||||
* @brief Destructor.
|
||||
*/
|
||||
|
@ -34,12 +34,12 @@ void ege::particule::Engine::componentAdd(const ememory::SharedPtr<ege::Componen
|
||||
|
||||
|
||||
void ege::particule::Engine::add(const ememory::SharedPtr<ege::particule::Component>& _particule) {
|
||||
if (_particule == nullptr) {
|
||||
EGE_ERROR("Try to add particule nullptr");
|
||||
if (_particule == null) {
|
||||
EGE_ERROR("Try to add particule null");
|
||||
return;
|
||||
}
|
||||
for (size_t iii=0; iii<m_particuleList.size(); ++iii) {
|
||||
if (m_particuleList[iii] != nullptr) {
|
||||
if (m_particuleList[iii] != null) {
|
||||
continue;
|
||||
}
|
||||
m_particuleList[iii] = _particule;
|
||||
@ -50,11 +50,11 @@ void ege::particule::Engine::add(const ememory::SharedPtr<ege::particule::Compon
|
||||
}
|
||||
|
||||
void ege::particule::Engine::addRemoved(const ememory::SharedPtr<ege::particule::Component>& _particule) {
|
||||
if (_particule == nullptr) {
|
||||
if (_particule == null) {
|
||||
return;
|
||||
}
|
||||
for (size_t iii=0; iii<m_particuleRemoved.size(); ++iii) {
|
||||
if (m_particuleRemoved[iii] != nullptr) {
|
||||
if (m_particuleRemoved[iii] != null) {
|
||||
continue;
|
||||
}
|
||||
m_particuleRemoved[iii] = _particule;
|
||||
@ -65,11 +65,11 @@ void ege::particule::Engine::addRemoved(const ememory::SharedPtr<ege::particule:
|
||||
}
|
||||
|
||||
ememory::SharedPtr<ege::particule::Component> ege::particule::Engine::respown(const char* _particuleType) {
|
||||
if (_particuleType == nullptr) {
|
||||
return nullptr;
|
||||
if (_particuleType == null) {
|
||||
return null;
|
||||
}
|
||||
for (size_t iii=0; iii<m_particuleRemoved.size(); ++iii) {
|
||||
if (m_particuleRemoved[iii] == nullptr) {
|
||||
if (m_particuleRemoved[iii] == null) {
|
||||
continue;
|
||||
}
|
||||
if (m_particuleRemoved[iii]->getParticuleType() == _particuleType) {
|
||||
@ -80,7 +80,7 @@ ememory::SharedPtr<ege::particule::Component> ege::particule::Engine::respown(co
|
||||
return tmpParticule;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
return null;
|
||||
}
|
||||
|
||||
void ege::particule::Engine::update(const echrono::Duration& _delta) {
|
||||
@ -90,31 +90,31 @@ void ege::particule::Engine::update(const echrono::Duration& _delta) {
|
||||
}
|
||||
EGE_DEBUG("Update the Particule engine ... " << deltaTime);
|
||||
for (size_t iii=0; iii<m_particuleList.size(); ++iii) {
|
||||
if (m_particuleList[iii] == nullptr) {
|
||||
if (m_particuleList[iii] == null) {
|
||||
continue;
|
||||
}
|
||||
m_particuleList[iii]->update(deltaTime);
|
||||
}
|
||||
// check removing elements
|
||||
for (size_t iii=0; iii<m_particuleList.size(); ++iii) {
|
||||
if (m_particuleList[iii] == nullptr) {
|
||||
if (m_particuleList[iii] == null) {
|
||||
continue;
|
||||
}
|
||||
if (m_particuleList[iii]->needRemove()) {
|
||||
m_particuleList[iii]->onEnd();
|
||||
if (m_particuleList[iii]->getParticuleType() == nullptr) {
|
||||
if (m_particuleList[iii]->getParticuleType() == null) {
|
||||
// Real remove particule ...
|
||||
m_particuleList[iii].reset();
|
||||
} else {
|
||||
addRemoved(m_particuleList[iii]);
|
||||
}
|
||||
m_particuleList[iii] = nullptr;
|
||||
m_particuleList[iii] = null;
|
||||
}
|
||||
}
|
||||
/*
|
||||
int32_t nbParticule = 0;
|
||||
for (int32_t iii=0; iii<m_particuleList.size(); ++iii) {
|
||||
if (m_particuleList[iii] == nullptr) {
|
||||
if (m_particuleList[iii] == null) {
|
||||
continue;
|
||||
}
|
||||
nbParticule++;
|
||||
@ -125,7 +125,7 @@ void ege::particule::Engine::update(const echrono::Duration& _delta) {
|
||||
|
||||
void ege::particule::Engine::render(const echrono::Duration& _delta, const ememory::SharedPtr<ege::Camera>& _camera) {
|
||||
for (size_t iii=0; iii<m_particuleList.size(); ++iii) {
|
||||
if (m_particuleList[iii] == nullptr) {
|
||||
if (m_particuleList[iii] == null) {
|
||||
continue;
|
||||
}
|
||||
m_particuleList[iii]->draw(*_camera);
|
||||
@ -135,7 +135,7 @@ void ege::particule::Engine::render(const echrono::Duration& _delta, const ememo
|
||||
void ege::particule::Engine::clear() {
|
||||
// clear element not removed
|
||||
for (size_t iii=0; iii<m_particuleList.size(); ++iii) {
|
||||
if (m_particuleList[iii] == nullptr) {
|
||||
if (m_particuleList[iii] == null) {
|
||||
continue;
|
||||
}
|
||||
m_particuleList[iii].reset();
|
||||
@ -143,7 +143,7 @@ void ege::particule::Engine::clear() {
|
||||
m_particuleList.clear();
|
||||
// clear element that are auto-removed
|
||||
for (size_t iii=0; iii<m_particuleRemoved.size(); ++iii) {
|
||||
if (m_particuleRemoved[iii] == nullptr) {
|
||||
if (m_particuleRemoved[iii] == null) {
|
||||
continue;
|
||||
}
|
||||
m_particuleRemoved[iii].reset();
|
||||
|
@ -40,9 +40,9 @@ namespace ege {
|
||||
/**
|
||||
* @brief get a particue with his type, we get particule that has been already removed, otherwise, you will create new
|
||||
* @param[in] _particuleType Particule type, this chek only the pointer not the data.
|
||||
* @return nullptr, the particule has not been removed from the created pool
|
||||
* @return null, the particule has not been removed from the created pool
|
||||
* @return The pointer on the requested element (an init has been done).
|
||||
* @note If you did not want to use respawn set type at nullptr.
|
||||
* @note If you did not want to use respawn set type at null.
|
||||
*/
|
||||
ememory::SharedPtr<ege::particule::Component> respown(const char* _particuleType);
|
||||
|
||||
|
@ -65,7 +65,7 @@ ege::physics::Component::Component(ememory::SharedPtr<ege::Environement> _env, c
|
||||
}
|
||||
|
||||
void ege::physics::Component::setType(enum ege::physics::Component::type _type) {
|
||||
if (m_rigidBody == nullptr) {
|
||||
if (m_rigidBody == null) {
|
||||
return;
|
||||
}
|
||||
switch(_type) {
|
||||
@ -82,14 +82,14 @@ void ege::physics::Component::setType(enum ege::physics::Component::type _type)
|
||||
}
|
||||
|
||||
ege::physics::Component::~Component() {
|
||||
if (m_rigidBody == nullptr) {
|
||||
if (m_rigidBody == null) {
|
||||
return;
|
||||
}
|
||||
// disable callback
|
||||
m_rigidBody->setUserData(nullptr);
|
||||
m_engine->getDynamicWorld()->testCollision(m_rigidBody, nullptr);
|
||||
m_rigidBody->setUserData(null);
|
||||
m_engine->getDynamicWorld()->testCollision(m_rigidBody, null);
|
||||
m_engine->getDynamicWorld()->destroyRigidBody(m_rigidBody);
|
||||
m_rigidBody = nullptr;
|
||||
m_rigidBody = null;
|
||||
}
|
||||
|
||||
void ege::physics::Component::generate() {
|
||||
@ -99,14 +99,14 @@ void ege::physics::Component::generate() {
|
||||
}
|
||||
|
||||
for (auto &it: m_shape) {
|
||||
if (it == nullptr) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
switch (it->getType()) {
|
||||
case ege::physics::Shape::type::box: {
|
||||
EGE_DEBUG(" Box");
|
||||
const ege::physics::shape::Box* tmpElement = it->toBox();
|
||||
if (tmpElement == nullptr) {
|
||||
if (tmpElement == null) {
|
||||
EGE_ERROR(" Box ==> can not cast in BOX");
|
||||
continue;
|
||||
}
|
||||
@ -128,7 +128,7 @@ void ege::physics::Component::generate() {
|
||||
case ege::physics::Shape::type::cylinder: {
|
||||
EGE_DEBUG(" Cylinder");
|
||||
const ege::physics::shape::Cylinder* tmpElement = it->toCylinder();
|
||||
if (tmpElement == nullptr) {
|
||||
if (tmpElement == null) {
|
||||
EGE_ERROR(" Cylinder ==> can not cast in Cylinder");
|
||||
continue;
|
||||
}
|
||||
@ -145,7 +145,7 @@ void ege::physics::Component::generate() {
|
||||
case ege::physics::Shape::type::capsule: {
|
||||
EGE_DEBUG(" Capsule");
|
||||
const ege::physics::shape::Capsule* tmpElement = it->toCapsule();
|
||||
if (tmpElement == nullptr) {
|
||||
if (tmpElement == null) {
|
||||
EGE_ERROR(" Capsule ==> can not cast in Capsule");
|
||||
continue;
|
||||
}
|
||||
@ -162,7 +162,7 @@ void ege::physics::Component::generate() {
|
||||
case ege::physics::Shape::type::cone: {
|
||||
EGE_DEBUG(" Cone");
|
||||
const ege::physics::shape::Cone* tmpElement = it->toCone();
|
||||
if (tmpElement == nullptr) {
|
||||
if (tmpElement == null) {
|
||||
EGE_ERROR(" Cone ==> can not cast in Cone");
|
||||
continue;
|
||||
}
|
||||
@ -179,7 +179,7 @@ void ege::physics::Component::generate() {
|
||||
case ege::physics::Shape::type::sphere: {
|
||||
EGE_DEBUG(" Sphere");
|
||||
const ege::physics::shape::Sphere* tmpElement = it->toSphere();
|
||||
if (tmpElement == nullptr) {
|
||||
if (tmpElement == null) {
|
||||
EGE_ERROR(" Sphere ==> can not cast in Sphere");
|
||||
continue;
|
||||
}
|
||||
@ -196,7 +196,7 @@ void ege::physics::Component::generate() {
|
||||
case ege::physics::Shape::type::concave: {
|
||||
EGE_DEBUG(" Concave");
|
||||
const ege::physics::shape::Concave* tmpElement = it->toConcave();
|
||||
if (tmpElement == nullptr) {
|
||||
if (tmpElement == null) {
|
||||
EGE_ERROR(" etkConcave ==> can not cast in Concave");
|
||||
continue;
|
||||
}
|
||||
@ -243,7 +243,7 @@ void ege::physics::Component::emitAll() {
|
||||
}
|
||||
|
||||
void ege::physics::Component::update(float _delta) {
|
||||
if (m_rigidBody == nullptr) {
|
||||
if (m_rigidBody == null) {
|
||||
return;
|
||||
}
|
||||
if (m_staticForceApplyCenterOfMass != vec3(0,0,0)) {
|
||||
@ -260,35 +260,35 @@ void ege::physics::Component::update(float _delta) {
|
||||
|
||||
|
||||
void ege::physics::Component::setTransform(const etk::Transform3D& _transform) {
|
||||
if (m_rigidBody == nullptr) {
|
||||
if (m_rigidBody == null) {
|
||||
return;
|
||||
}
|
||||
m_rigidBody->setTransform(_transform);
|
||||
}
|
||||
|
||||
etk::Transform3D ege::physics::Component::getTransform() const {
|
||||
if (m_rigidBody == nullptr) {
|
||||
if (m_rigidBody == null) {
|
||||
return etk::Transform3D::identity();
|
||||
}
|
||||
return m_rigidBody->getTransform();
|
||||
}
|
||||
|
||||
vec3 ege::physics::Component::getLinearVelocity() const {
|
||||
if (m_rigidBody == nullptr) {
|
||||
if (m_rigidBody == null) {
|
||||
return vec3(0,0,0);
|
||||
}
|
||||
return m_rigidBody->getLinearVelocity();
|
||||
}
|
||||
|
||||
void ege::physics::Component::setLinearVelocity(const vec3& _linearVelocity) {
|
||||
if (m_rigidBody == nullptr) {
|
||||
if (m_rigidBody == null) {
|
||||
return;
|
||||
}
|
||||
m_rigidBody->setLinearVelocity(_linearVelocity);
|
||||
}
|
||||
|
||||
vec3 ege::physics::Component::getRelativeLinearVelocity() const {
|
||||
if (m_rigidBody == nullptr) {
|
||||
if (m_rigidBody == null) {
|
||||
return vec3(0,0,0);
|
||||
}
|
||||
vec3 value = m_rigidBody->getLinearVelocity();
|
||||
@ -296,7 +296,7 @@ vec3 ege::physics::Component::getRelativeLinearVelocity() const {
|
||||
}
|
||||
|
||||
void ege::physics::Component::setRelativeLinearVelocity(const vec3& _linearVelocity) {
|
||||
if (m_rigidBody == nullptr) {
|
||||
if (m_rigidBody == null) {
|
||||
return;
|
||||
}
|
||||
vec3 value = m_rigidBody->getTransform().getOrientation()*_linearVelocity;
|
||||
@ -304,27 +304,27 @@ void ege::physics::Component::setRelativeLinearVelocity(const vec3& _linearVeloc
|
||||
}
|
||||
|
||||
vec3 ege::physics::Component::getAngularVelocity() const {
|
||||
if (m_rigidBody == nullptr) {
|
||||
if (m_rigidBody == null) {
|
||||
return vec3(0,0,0);
|
||||
}
|
||||
return m_rigidBody->getAngularVelocity();
|
||||
}
|
||||
void ege::physics::Component::setAngularVelocity(const vec3& _angularVelocity) {
|
||||
if (m_rigidBody == nullptr) {
|
||||
if (m_rigidBody == null) {
|
||||
return;
|
||||
}
|
||||
m_rigidBody->setAngularVelocity(_angularVelocity);
|
||||
}
|
||||
|
||||
vec3 ege::physics::Component::getRelativeAngularVelocity() const {
|
||||
if (m_rigidBody == nullptr) {
|
||||
if (m_rigidBody == null) {
|
||||
return vec3(0,0,0);
|
||||
}
|
||||
vec3 value = m_rigidBody->getAngularVelocity();
|
||||
return m_rigidBody->getTransform().getOrientation().getInverse()*value;
|
||||
}
|
||||
void ege::physics::Component::setRelativeAngularVelocity(const vec3& _angularVelocity) {
|
||||
if (m_rigidBody == nullptr) {
|
||||
if (m_rigidBody == null) {
|
||||
return;
|
||||
}
|
||||
vec3 value = m_rigidBody->getTransform().getOrientation()*_angularVelocity;
|
||||
@ -333,14 +333,14 @@ void ege::physics::Component::setRelativeAngularVelocity(const vec3& _angularVel
|
||||
|
||||
|
||||
void ege::physics::Component::applyForce(const vec3& _force,const vec3& _point) {
|
||||
if (m_rigidBody == nullptr) {
|
||||
if (m_rigidBody == null) {
|
||||
return;
|
||||
}
|
||||
m_rigidBody->applyForce(_force, _point);
|
||||
}
|
||||
|
||||
void ege::physics::Component::applyForceToCenterOfMass(const vec3& _force, bool _static) {
|
||||
if (m_rigidBody == nullptr) {
|
||||
if (m_rigidBody == null) {
|
||||
return;
|
||||
}
|
||||
if(_static == true) {
|
||||
@ -351,7 +351,7 @@ void ege::physics::Component::applyForceToCenterOfMass(const vec3& _force, bool
|
||||
}
|
||||
|
||||
void ege::physics::Component::applyRelativeForceToCenterOfMass(const vec3& _force, bool _static) {
|
||||
if (m_rigidBody == nullptr) {
|
||||
if (m_rigidBody == null) {
|
||||
return;
|
||||
}
|
||||
vec3 force = m_rigidBody->getTransform().getOrientation()*_force;
|
||||
@ -363,7 +363,7 @@ void ege::physics::Component::applyRelativeForceToCenterOfMass(const vec3& _forc
|
||||
}
|
||||
|
||||
void ege::physics::Component::applyTorque(const vec3& _torque, bool _static) {
|
||||
if (m_rigidBody == nullptr) {
|
||||
if (m_rigidBody == null) {
|
||||
return;
|
||||
}
|
||||
if(_static == true) {
|
||||
@ -374,7 +374,7 @@ void ege::physics::Component::applyTorque(const vec3& _torque, bool _static) {
|
||||
}
|
||||
|
||||
void ege::physics::Component::applyRelativeTorque(const vec3& _torque, bool _static) {
|
||||
if (m_rigidBody == nullptr) {
|
||||
if (m_rigidBody == null) {
|
||||
return;
|
||||
}
|
||||
vec3 torque = m_rigidBody->getTransform().getOrientation()*_torque;
|
||||
@ -407,14 +407,14 @@ void ege::physics::Component::drawShape(ememory::SharedPtr<ewol::resource::Color
|
||||
transformationMatrix.transpose();
|
||||
etk::Color<float> tmpColor(1.0, 0.0, 0.0, 0.3);
|
||||
for (auto &it: m_shape) {
|
||||
if (it == nullptr) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
switch (it->getType()) {
|
||||
case ege::physics::Shape::type::box: {
|
||||
EGE_DEBUG(" Box");
|
||||
const ege::physics::shape::Box* tmpElement = it->toBox();
|
||||
if (tmpElement == nullptr) {
|
||||
if (tmpElement == null) {
|
||||
EGE_ERROR(" Box ==> can not cast in BOX");
|
||||
continue;
|
||||
}
|
||||
@ -429,7 +429,7 @@ void ege::physics::Component::drawShape(ememory::SharedPtr<ewol::resource::Color
|
||||
case ege::physics::Shape::type::cylinder: {
|
||||
EGE_DEBUG(" Cylinder");
|
||||
const ege::physics::shape::Cylinder* tmpElement = it->toCylinder();
|
||||
if (tmpElement == nullptr) {
|
||||
if (tmpElement == null) {
|
||||
EGE_ERROR(" Cylinder ==> can not cast in Cylinder");
|
||||
continue;
|
||||
}
|
||||
@ -444,7 +444,7 @@ void ege::physics::Component::drawShape(ememory::SharedPtr<ewol::resource::Color
|
||||
case ege::physics::Shape::type::capsule: {
|
||||
EGE_DEBUG(" Capsule");
|
||||
const ege::physics::shape::Capsule* tmpElement = it->toCapsule();
|
||||
if (tmpElement == nullptr) {
|
||||
if (tmpElement == null) {
|
||||
EGE_ERROR(" Capsule ==> can not cast in Capsule");
|
||||
continue;
|
||||
}
|
||||
@ -459,7 +459,7 @@ void ege::physics::Component::drawShape(ememory::SharedPtr<ewol::resource::Color
|
||||
case ege::physics::Shape::type::cone: {
|
||||
EGE_DEBUG(" Cone");
|
||||
const ege::physics::shape::Cone* tmpElement = it->toCone();
|
||||
if (tmpElement == nullptr) {
|
||||
if (tmpElement == null) {
|
||||
EGE_ERROR(" Cone ==> can not cast in Cone");
|
||||
continue;
|
||||
}
|
||||
@ -474,7 +474,7 @@ void ege::physics::Component::drawShape(ememory::SharedPtr<ewol::resource::Color
|
||||
case ege::physics::Shape::type::sphere: {
|
||||
EGE_DEBUG(" Sphere");
|
||||
const ege::physics::shape::Sphere* tmpElement = it->toSphere();
|
||||
if (tmpElement == nullptr) {
|
||||
if (tmpElement == null) {
|
||||
EGE_ERROR(" Sphere ==> can not cast in Sphere");
|
||||
continue;
|
||||
}
|
||||
@ -489,7 +489,7 @@ void ege::physics::Component::drawShape(ememory::SharedPtr<ewol::resource::Color
|
||||
case ege::physics::Shape::type::concave: {
|
||||
EGE_DEBUG(" concave");
|
||||
const ege::physics::shape::Concave* tmpElement = it->toConcave();
|
||||
if (tmpElement == nullptr) {
|
||||
if (tmpElement == null) {
|
||||
EGE_ERROR(" concave ==> can not cast in convexHull");
|
||||
continue;
|
||||
}
|
||||
@ -505,7 +505,7 @@ void ege::physics::Component::drawShape(ememory::SharedPtr<ewol::resource::Color
|
||||
case ege::physics::Shape::type::convexHull: {
|
||||
EGE_DEBUG(" convexHull");
|
||||
const ege::physics::shape::ConvexHull* tmpElement = it->toConvexHull();
|
||||
if (tmpElement == nullptr) {
|
||||
if (tmpElement == null) {
|
||||
EGE_ERROR(" convexHull ==> can not cast in convexHull");
|
||||
continue;
|
||||
}
|
||||
@ -520,7 +520,7 @@ void ege::physics::Component::drawShape(ememory::SharedPtr<ewol::resource::Color
|
||||
}
|
||||
|
||||
void ege::physics::Component::drawAABB(ememory::SharedPtr<ewol::resource::Colored3DObject> _draw, ememory::SharedPtr<ege::Camera> _camera) {
|
||||
if (m_rigidBody == nullptr) {
|
||||
if (m_rigidBody == null) {
|
||||
return;
|
||||
}
|
||||
mat4 transformationMatrix;
|
||||
|
@ -18,43 +18,43 @@ const etk::String& ege::physics::Engine::getType() const {
|
||||
}
|
||||
|
||||
void ege::physics::Engine::beginContact(const ephysics::ContactPointInfo& _contact) {
|
||||
ege::physics::Component* component1 = nullptr;
|
||||
ege::physics::Component* component2 = nullptr;
|
||||
ege::physics::Component* component1 = null;
|
||||
ege::physics::Component* component2 = null;
|
||||
// Called when a new contact point is found between two bodies that were separated before.
|
||||
EGE_WARNING("collision detection [BEGIN] " << _contact.localPoint1 << " depth=" << _contact.penetrationDepth);
|
||||
if ( _contact.shape1 != nullptr
|
||||
&& _contact.shape1->getUserData() != nullptr) {
|
||||
if ( _contact.shape1 != null
|
||||
&& _contact.shape1->getUserData() != null) {
|
||||
component1 = static_cast<ege::physics::Component*>(_contact.shape1->getUserData());
|
||||
}
|
||||
if ( _contact.shape2 != nullptr
|
||||
&& _contact.shape2->getUserData() != nullptr) {
|
||||
if ( _contact.shape2 != null
|
||||
&& _contact.shape2->getUserData() != null) {
|
||||
component2 = static_cast<ege::physics::Component*>(_contact.shape2->getUserData());
|
||||
}
|
||||
if (component1 != nullptr) {
|
||||
if (component1 != null) {
|
||||
component1->beginContact(component2, _contact.normal, _contact.localPoint1, _contact.localPoint2, _contact.penetrationDepth);
|
||||
}
|
||||
if (component2 != nullptr) {
|
||||
if (component2 != null) {
|
||||
component2->beginContact(component1, -_contact.normal, _contact.localPoint2, _contact.localPoint1, _contact.penetrationDepth);
|
||||
}
|
||||
}
|
||||
|
||||
void ege::physics::Engine::newContact(const ephysics::ContactPointInfo& _contact) {
|
||||
ege::physics::Component* component1 = nullptr;
|
||||
ege::physics::Component* component2 = nullptr;
|
||||
ege::physics::Component* component1 = null;
|
||||
ege::physics::Component* component2 = null;
|
||||
//Called when a new contact point is found between two bodies.
|
||||
EGE_WARNING("collision detection [ NEW ] " << _contact.localPoint1 << " depth=" << _contact.penetrationDepth);
|
||||
if ( _contact.shape1 != nullptr
|
||||
&& _contact.shape1->getUserData() != nullptr) {
|
||||
if ( _contact.shape1 != null
|
||||
&& _contact.shape1->getUserData() != null) {
|
||||
component1 = static_cast<ege::physics::Component*>(_contact.shape1->getUserData());
|
||||
}
|
||||
if ( _contact.shape2 != nullptr
|
||||
&& _contact.shape2->getUserData() != nullptr) {
|
||||
if ( _contact.shape2 != null
|
||||
&& _contact.shape2->getUserData() != null) {
|
||||
component2 = static_cast<ege::physics::Component*>(_contact.shape2->getUserData());
|
||||
}
|
||||
if (component1 != nullptr) {
|
||||
if (component1 != null) {
|
||||
component1->newContact(component2, _contact.normal, _contact.localPoint1, _contact.localPoint2, _contact.penetrationDepth);
|
||||
}
|
||||
if (component2 != nullptr) {
|
||||
if (component2 != null) {
|
||||
component2->newContact(component1, -_contact.normal, _contact.localPoint2, _contact.localPoint1, _contact.penetrationDepth);
|
||||
}
|
||||
}
|
||||
@ -76,7 +76,7 @@ void ege::physics::Engine::componentAdd(const ememory::SharedPtr<ege::Component>
|
||||
for (auto it=m_component.begin();
|
||||
it != m_component.end();
|
||||
++it) {
|
||||
if (*it == nullptr) {
|
||||
if (*it == null) {
|
||||
*it = ref;
|
||||
return;
|
||||
}
|
||||
@ -88,14 +88,14 @@ ege::physics::Engine::Engine(ege::Environement* _env) :
|
||||
ege::Engine(_env),
|
||||
propertyDebugAABB(this, "debug-AABB", false, "display the global AABB box of every shape"),
|
||||
propertyDebugShape(this, "debug-shape", false, "display the physic shape"),
|
||||
m_dynamicsWorld(nullptr),
|
||||
m_dynamicsWorld(null),
|
||||
m_accumulator(0.0f) {
|
||||
m_debugDrawProperty = ewol::resource::Colored3DObject::create();
|
||||
// Start engine with no gravity
|
||||
vec3 gravity(0.0f, 0.0f, 0.0f);
|
||||
// Create the dynamics world
|
||||
m_dynamicsWorld = ETK_NEW(ephysics::DynamicsWorld, gravity);
|
||||
if (m_dynamicsWorld != nullptr) {
|
||||
if (m_dynamicsWorld != null) {
|
||||
// Set the number of iterations of the constraint solver
|
||||
m_dynamicsWorld->setNbIterationsVelocitySolver(15);
|
||||
m_dynamicsWorld->setEventListener(this);
|
||||
@ -103,15 +103,15 @@ ege::physics::Engine::Engine(ege::Environement* _env) :
|
||||
}
|
||||
|
||||
ege::physics::Engine::~Engine() {
|
||||
if (m_dynamicsWorld != nullptr) {
|
||||
m_dynamicsWorld->setEventListener(nullptr);
|
||||
if (m_dynamicsWorld != null) {
|
||||
m_dynamicsWorld->setEventListener(null);
|
||||
ETK_DELETE(ephysics::DynamicsWorld, m_dynamicsWorld);
|
||||
m_dynamicsWorld = nullptr;
|
||||
m_dynamicsWorld = null;
|
||||
}
|
||||
}
|
||||
|
||||
void ege::physics::Engine::setGravity(const vec3& _axePower) {
|
||||
if (m_dynamicsWorld != nullptr) {
|
||||
if (m_dynamicsWorld != null) {
|
||||
vec3 gravity(_axePower);
|
||||
m_dynamicsWorld->setGravity(gravity);
|
||||
}
|
||||
@ -126,11 +126,11 @@ void ege::physics::Engine::update(const echrono::Duration& _delta) {
|
||||
m_accumulator += deltaTime;
|
||||
// While there is enough accumulated time to take one or several physics steps
|
||||
while (m_accumulator >= timeStep) {
|
||||
if (m_dynamicsWorld != nullptr) {
|
||||
if (m_dynamicsWorld != null) {
|
||||
// call every object to usdate their constant forces applyed
|
||||
for (auto &it: m_component) {
|
||||
// check nullptr pointer
|
||||
if (it == nullptr) {
|
||||
// check null pointer
|
||||
if (it == null) {
|
||||
// no pointer null are set in the output list ...
|
||||
continue;
|
||||
}
|
||||
@ -144,8 +144,8 @@ void ege::physics::Engine::update(const echrono::Duration& _delta) {
|
||||
m_accumulator -= timeStep;
|
||||
}
|
||||
for (auto &it: m_component) {
|
||||
// check nullptr pointer
|
||||
if (it == nullptr) {
|
||||
// check null pointer
|
||||
if (it == null) {
|
||||
// no pointer null are set in the output list ...
|
||||
continue;
|
||||
}
|
||||
@ -156,7 +156,7 @@ void ege::physics::Engine::update(const echrono::Duration& _delta) {
|
||||
void ege::physics::Engine::renderDebug(const echrono::Duration& _delta, const ememory::SharedPtr<ege::Camera>& _camera) {
|
||||
if (propertyDebugShape.get() == true) {
|
||||
for (auto &it : m_component) {
|
||||
if (it == nullptr) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
it->drawShape(m_debugDrawProperty, _camera);
|
||||
@ -164,7 +164,7 @@ void ege::physics::Engine::renderDebug(const echrono::Duration& _delta, const em
|
||||
}
|
||||
if (propertyDebugAABB.get() == true) {
|
||||
for (auto &it : m_component) {
|
||||
if (it == nullptr) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
it->drawAABB(m_debugDrawProperty, _camera);
|
||||
@ -180,7 +180,7 @@ class MyCallbackClass : public ephysics::RaycastCallback {
|
||||
ephysics::CollisionBody* m_body;
|
||||
MyCallbackClass():
|
||||
m_haveImpact(false),
|
||||
m_body(nullptr) {
|
||||
m_body(null) {
|
||||
|
||||
}
|
||||
public:
|
||||
@ -224,15 +224,15 @@ etk::Pair<ememory::SharedPtr<ege::Component>, etk::Pair<vec3,vec3>> ege::physics
|
||||
// Raycast test
|
||||
m_dynamicsWorld->raycast(ray, &callbackObject);
|
||||
if (callbackObject.m_haveImpact == true) {
|
||||
if ( callbackObject.m_body == nullptr
|
||||
|| callbackObject.m_body->getUserData() == nullptr) {
|
||||
etk::Pair<ememory::SharedPtr<ege::Component>, etk::Pair<vec3,vec3>>(nullptr, etk::Pair<vec3,vec3>(callbackObject.m_position, callbackObject.m_normal));
|
||||
if ( callbackObject.m_body == null
|
||||
|| callbackObject.m_body->getUserData() == null) {
|
||||
etk::Pair<ememory::SharedPtr<ege::Component>, etk::Pair<vec3,vec3>>(null, etk::Pair<vec3,vec3>(callbackObject.m_position, callbackObject.m_normal));
|
||||
}
|
||||
// TODO: je n'ai pas une entity, main un component ...
|
||||
ege::physics::Component* elem = static_cast<ege::physics::Component*>(callbackObject.m_body->getUserData());
|
||||
return etk::Pair<ememory::SharedPtr<ege::Component>, etk::Pair<vec3,vec3>>(elem->sharedFromThis(), etk::Pair<vec3,vec3>(callbackObject.m_position, callbackObject.m_normal));
|
||||
}
|
||||
EGE_VERBOSE(" No Hit");
|
||||
return etk::Pair<ememory::SharedPtr<ege::Component>, etk::Pair<vec3,vec3>>(nullptr, etk::Pair<vec3,vec3>(vec3(0,0,0),vec3(0,0,0)));
|
||||
return etk::Pair<ememory::SharedPtr<ege::Component>, etk::Pair<vec3,vec3>>(null, etk::Pair<vec3,vec3>(vec3(0,0,0),vec3(0,0,0)));
|
||||
|
||||
}
|
@ -17,7 +17,7 @@ bool ege::physics::shape::ConvexHull::parse(const char* _line) {
|
||||
char* base = (char*)(&_line[6]);
|
||||
char* tmp= strchr(base, '|');
|
||||
vec3 pos(0,0,0);
|
||||
while (tmp != nullptr) {
|
||||
while (tmp != null) {
|
||||
*tmp = '\0';
|
||||
sscanf(base, "%f %f %f", &pos.m_floats[0], &pos.m_floats[1], &pos.m_floats[2] );
|
||||
m_points.pushBack(pos);
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
|
||||
ememory::SharedPtr<ege::physics::Shape> ege::physics::Shape::create(const etk::String& _name) {
|
||||
ememory::SharedPtr<ege::physics::Shape> tmpp = nullptr;
|
||||
ememory::SharedPtr<ege::physics::Shape> tmpp = null;
|
||||
etk::String name = etk::toLower(_name);
|
||||
if (name == "box") {
|
||||
tmpp = ememory::makeShared<ege::physics::shape::Box>();
|
||||
@ -33,9 +33,9 @@ ememory::SharedPtr<ege::physics::Shape> ege::physics::Shape::create(const etk::S
|
||||
tmpp = ememory::makeShared<ege::physics::shape::Concave>();
|
||||
} else {
|
||||
EGE_ERROR("Create an unknow element : '" << _name << "' availlable : [BOX,SPHERE,CONE,CYLINDER,CAPSULE,CONVEXHULL,autoConcave]");
|
||||
return nullptr;
|
||||
return null;
|
||||
}
|
||||
if (tmpp == nullptr) {
|
||||
if (tmpp == null) {
|
||||
EGE_ERROR("Allocation error for physical element : '" << _name << "'");
|
||||
}
|
||||
return tmpp;
|
||||
|
@ -101,51 +101,51 @@ namespace ege {
|
||||
};
|
||||
|
||||
virtual const ege::physics::shape::Box* toBox() const {
|
||||
return nullptr;
|
||||
return null;
|
||||
};
|
||||
virtual ege::physics::shape::Box* toBox() {
|
||||
return nullptr;
|
||||
return null;
|
||||
};
|
||||
|
||||
virtual const ege::physics::shape::Cylinder* toCylinder() const {
|
||||
return nullptr;
|
||||
return null;
|
||||
};
|
||||
virtual ege::physics::shape::Cylinder* toCylinder() {
|
||||
return nullptr;
|
||||
return null;
|
||||
};
|
||||
|
||||
virtual const ege::physics::shape::Capsule* toCapsule() const {
|
||||
return nullptr;
|
||||
return null;
|
||||
};
|
||||
virtual ege::physics::shape::Capsule* toCapsule() {
|
||||
return nullptr;
|
||||
return null;
|
||||
};
|
||||
|
||||
virtual const ege::physics::shape::Cone* toCone() const {
|
||||
return nullptr;
|
||||
return null;
|
||||
};
|
||||
virtual ege::physics::shape::Cone* toCone() {
|
||||
return nullptr;
|
||||
return null;
|
||||
};
|
||||
|
||||
virtual const ege::physics::shape::ConvexHull* toConvexHull() const {
|
||||
return nullptr;
|
||||
return null;
|
||||
};
|
||||
virtual ege::physics::shape::ConvexHull* toConvexHull() {
|
||||
return nullptr;
|
||||
return null;
|
||||
};
|
||||
|
||||
virtual const ege::physics::shape::Sphere* toSphere() const {
|
||||
return nullptr;
|
||||
return null;
|
||||
};
|
||||
virtual ege::physics::shape::Sphere* toSphere() {
|
||||
return nullptr;
|
||||
return null;
|
||||
};
|
||||
virtual const ege::physics::shape::Concave* toConcave() const {
|
||||
return nullptr;
|
||||
return null;
|
||||
};
|
||||
virtual ege::physics::shape::Concave* toConcave() {
|
||||
return nullptr;
|
||||
return null;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ void ege::render::Component::onSignalPositionChange(const etk::Transform3D& _tra
|
||||
|
||||
bool ege::render::Component::loadMesh(const etk::String& _meshFileName) {
|
||||
ememory::SharedPtr<ege::resource::Mesh> tmpMesh = ege::resource::Mesh::create(_meshFileName);
|
||||
if(tmpMesh == nullptr) {
|
||||
if(tmpMesh == null) {
|
||||
EGE_ERROR("can not load the resources : " << _meshFileName);
|
||||
return false;
|
||||
}
|
||||
@ -57,12 +57,12 @@ bool ege::render::Component::loadMesh(const etk::String& _meshFileName) {
|
||||
}
|
||||
|
||||
bool ege::render::Component::setMesh(ememory::SharedPtr<ege::resource::Mesh> _mesh) {
|
||||
if (m_mesh != nullptr) {
|
||||
if (m_mesh != null) {
|
||||
m_mesh.reset();
|
||||
}
|
||||
m_mesh = _mesh;
|
||||
// auto load the shape :
|
||||
if (m_mesh == nullptr) {
|
||||
if (m_mesh == null) {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
@ -71,7 +71,7 @@ bool ege::render::Component::setMesh(ememory::SharedPtr<ege::resource::Mesh> _me
|
||||
void ege::render::Component::draw(int32_t _pass) {
|
||||
//EGE_INFO("draw : " << _pass );
|
||||
if (_pass == 0) {
|
||||
if(m_mesh != nullptr) {
|
||||
if(m_mesh != null) {
|
||||
//EGE_INFO("element pos = " << getPosition());
|
||||
float mmm[16];
|
||||
// Get the OpenGL matrix array of the transform
|
||||
@ -85,7 +85,7 @@ void ege::render::Component::draw(int32_t _pass) {
|
||||
}
|
||||
|
||||
void ege::render::Component::drawNormalDebug(ememory::SharedPtr<ewol::resource::Colored3DObject> _draw) {
|
||||
if(m_mesh != nullptr) {
|
||||
if(m_mesh != null) {
|
||||
float mmm[16];
|
||||
// Get the OpenGL matrix array of the transform
|
||||
m_transform.getOpenGLMatrix(mmm);
|
||||
|
@ -32,7 +32,7 @@ namespace ege {
|
||||
*/
|
||||
Component(ememory::SharedPtr<ege::resource::Mesh> _mesh);
|
||||
protected:
|
||||
ememory::SharedPtr<ege::resource::Mesh> m_mesh; //!< Mesh of the Element (can be nullptr)
|
||||
ememory::SharedPtr<ege::resource::Mesh> m_mesh; //!< Mesh of the Element (can be null)
|
||||
public:
|
||||
/**
|
||||
* @brief Select a mesh with a specific name.
|
||||
@ -43,7 +43,7 @@ namespace ege {
|
||||
virtual bool loadMesh(const etk::String& _fileName);
|
||||
/**
|
||||
* @brief set the the Mesh properties.
|
||||
* @param[in] _mesh The mesh pointer. (nullptr to force the mesh remove ...)
|
||||
* @param[in] _mesh The mesh pointer. (null to force the mesh remove ...)
|
||||
* @note : this remove the shape and the mesh properties.
|
||||
* @return true if no error occured
|
||||
*/
|
||||
|
@ -33,7 +33,7 @@ void ege::render::Engine::componentAdd(const ememory::SharedPtr<ege::Component>&
|
||||
for (auto it=m_component.begin();
|
||||
it != m_component.end();
|
||||
++it) {
|
||||
if (*it == nullptr) {
|
||||
if (*it == null) {
|
||||
*it = ref;
|
||||
return;
|
||||
}
|
||||
@ -51,11 +51,11 @@ void ege::render::Engine::getOrderedElementForDisplay(etk::Vector<ege::render::E
|
||||
// basic element result
|
||||
ege::render::Engine::ResultNearestElement result;
|
||||
result.dist = 99999999999.0f;
|
||||
result.element = nullptr;
|
||||
result.element = null;
|
||||
// for all element in the game we chek if it is needed to display it ...
|
||||
for (auto &it: m_component) {
|
||||
// check nullptr pointer
|
||||
if (it == nullptr) {
|
||||
// check null pointer
|
||||
if (it == null) {
|
||||
// no pointer null are set in the output list ...
|
||||
continue;
|
||||
}
|
||||
@ -98,7 +98,7 @@ void ege::render::Engine::getOrderedElementForDisplay(etk::Vector<ege::render::E
|
||||
void ege::render::Engine::render(const echrono::Duration& _delta, const ememory::SharedPtr<ege::Camera>& _camera) {
|
||||
/*
|
||||
for (auto &it : m_component) {
|
||||
if (it == nullptr) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ void ege::render::Engine::renderDebug(const echrono::Duration& _delta, const eme
|
||||
/*
|
||||
etk::Map<etk::String, ememory::SharedPtr<ege::Camera>> listCamera = m_env->getCameraList();
|
||||
for (auto &itCam : listCamera) {
|
||||
if (itCam.second != nullptr) {
|
||||
if (itCam.second != null) {
|
||||
itCam.second->drawDebug(m_debugDrawProperty, camera);
|
||||
}
|
||||
}
|
||||
@ -156,7 +156,7 @@ void ege::render::Engine::renderDebug(const echrono::Duration& _delta, const eme
|
||||
signalDisplayDebug.emit(m_debugDrawProperty);
|
||||
}
|
||||
/* TODO: set it back ...
|
||||
if (camera != nullptr) {
|
||||
if (camera != null) {
|
||||
m_env->getParticuleEngine().draw(*camera);
|
||||
}
|
||||
*/
|
||||
|
@ -26,8 +26,8 @@ ege::resource::Mesh::Mesh() :
|
||||
m_numberOfElments(-1),
|
||||
m_listFaces(0,false),
|
||||
m_materials(0,false),
|
||||
m_pointerShape(nullptr),
|
||||
m_functionFreeShape(nullptr) {
|
||||
m_pointerShape(null),
|
||||
m_functionFreeShape(null) {
|
||||
addResourceType("ege::resource::Mesh");
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ void ege::resource::Mesh::init(const etk::String& _fileName, const etk::String&
|
||||
|
||||
EGE_VERBOSE(m_name << " " << m_light << " shader=" << _shaderName);
|
||||
m_GLprogram = gale::resource::Program::create(_shaderName);
|
||||
if (m_GLprogram != nullptr) {
|
||||
if (m_GLprogram != null) {
|
||||
m_GLPosition = m_GLprogram->getAttribute("EW_coord3d");
|
||||
m_GLtexture = m_GLprogram->getAttribute("EW_texture2d");
|
||||
m_GLNormal = m_GLprogram->getAttribute("EW_normal");
|
||||
@ -58,7 +58,7 @@ void ege::resource::Mesh::init(const etk::String& _fileName, const etk::String&
|
||||
}
|
||||
// this is the properties of the buffer requested : "r"/"w" + "-" + buffer type "f"=flaot "i"=integer
|
||||
m_verticesVBO = gale::resource::VirtualBufferObject::create(5);
|
||||
if (m_verticesVBO == nullptr) {
|
||||
if (m_verticesVBO == null) {
|
||||
EGE_ERROR("can not instanciate VBO ...");
|
||||
return;
|
||||
}
|
||||
@ -86,9 +86,9 @@ void ege::resource::Mesh::init(const etk::String& _fileName, const etk::String&
|
||||
|
||||
ege::resource::Mesh::~Mesh() {
|
||||
// remove dynamics dependencies :
|
||||
if (m_functionFreeShape != nullptr) {
|
||||
if (m_functionFreeShape != null) {
|
||||
m_functionFreeShape(m_pointerShape);
|
||||
m_pointerShape = nullptr;
|
||||
m_pointerShape = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ void ege::resource::Mesh::draw(mat4& _positionMatrix,
|
||||
// TODO : Remove this, it is just for test the 23-04-2016
|
||||
//m_checkNormal = false;
|
||||
EGE_VERBOSE("draw Mesh : " << m_name << " (start)");
|
||||
if (m_GLprogram == nullptr) {
|
||||
if (m_GLprogram == null) {
|
||||
EGE_ERROR("No shader ...");
|
||||
return;
|
||||
}
|
||||
@ -407,7 +407,7 @@ void ege::resource::Mesh::generateVBO() {
|
||||
// clean faces indexes :
|
||||
m_listFaces.getValue(kkk).m_index.clear();
|
||||
int32_t nbIndicInFace = 3;
|
||||
if (m_materials[m_listFaces.getKey(kkk)] == nullptr) {
|
||||
if (m_materials[m_listFaces.getKey(kkk)] == null) {
|
||||
EGE_ERROR("Can not get material : " << m_listFaces.getKey(kkk) << " pointer value: " << size_t(m_materials[m_listFaces.getKey(kkk)].get()));
|
||||
continue;
|
||||
}
|
||||
@ -524,7 +524,7 @@ void ege::resource::Mesh::createIcoSphere(const etk::String& _materialName,float
|
||||
|
||||
|
||||
void ege::resource::Mesh::addMaterial(const etk::String& _name, ememory::SharedPtr<ege::Material> _data) {
|
||||
if (_data == nullptr) {
|
||||
if (_data == null) {
|
||||
EGE_ERROR(" can not add material with null pointer");
|
||||
return;
|
||||
}
|
||||
@ -537,9 +537,9 @@ void ege::resource::Mesh::addMaterial(const etk::String& _name, ememory::SharedP
|
||||
}
|
||||
|
||||
void ege::resource::Mesh::setShape(void* _shape) {
|
||||
if (m_functionFreeShape!=nullptr) {
|
||||
if (m_functionFreeShape!=null) {
|
||||
m_functionFreeShape(m_pointerShape);
|
||||
m_pointerShape = nullptr;
|
||||
m_pointerShape = null;
|
||||
}
|
||||
m_pointerShape=_shape;
|
||||
}
|
||||
@ -717,14 +717,14 @@ void ege::resource::Mesh::addTriangle(const etk::String& _layerName, const vec3&
|
||||
#include <ege/physics/shape/Concave.hpp>
|
||||
const etk::Vector<ememory::SharedPtr<ege::physics::Shape>>& ege::resource::Mesh::getPhysicalProperties() {
|
||||
for (auto &it: m_physics) {
|
||||
if (it == nullptr) {
|
||||
EGE_WARNING("Get nullptr ... ");
|
||||
if (it == null) {
|
||||
EGE_WARNING("Get null ... ");
|
||||
continue;
|
||||
}
|
||||
if (it->getType() == ege::physics::Shape::type::concave) {
|
||||
// need to generate the internal list of point and triangle needed:
|
||||
ege::physics::shape::Concave* tmpElement = it->toConcave();
|
||||
if (tmpElement == nullptr) {
|
||||
if (tmpElement == null) {
|
||||
EGE_ERROR(" Concave ==> can not cast in Concave");
|
||||
return m_physics;
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ namespace ege {
|
||||
};
|
||||
const etk::Vector<ememory::SharedPtr<ege::physics::Shape>>& getPhysicalProperties();
|
||||
void addPhysicElement(const ememory::SharedPtr<ege::physics::Shape>& _shape) {
|
||||
if (_shape == nullptr) {
|
||||
if (_shape == null) {
|
||||
return;
|
||||
}
|
||||
m_physics.pushBack(_shape);
|
||||
|
@ -10,7 +10,7 @@
|
||||
ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createCapsule(float _radius, float _size, const etk::String& _materialName, const etk::Color<float>& _color, int32_t _lats, int32_t _longs) {
|
||||
EGE_VERBOSE(" create a capsule _size=" << _size << " _materialName=" << _materialName << " _color=" << _color);
|
||||
ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("---", "DATA:color3.prog");
|
||||
if (out != nullptr) {
|
||||
if (out != null) {
|
||||
ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
|
||||
// set the element material properties :
|
||||
material->setAmbientFactor(vec4(1,1,1,1));
|
||||
|
@ -10,7 +10,7 @@
|
||||
ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createCone(float _radius, float _size, const etk::String& _materialName, const etk::Color<float>& _color, int32_t _lats, int32_t _longs) {
|
||||
EGE_VERBOSE(" create a cylinder _size=" << _size << " _materialName=" << _materialName << " _color=" << _color);
|
||||
ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("---", "DATA:color3.prog");
|
||||
if (out != nullptr) {
|
||||
if (out != null) {
|
||||
ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
|
||||
// set the element material properties :
|
||||
material->setAmbientFactor(vec4(1,1,1,1));
|
||||
|
@ -14,7 +14,7 @@ ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createCube(float _s
|
||||
ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createCube(const vec3& _size, const etk::String& _materialName, const etk::Color<float>& _color) {
|
||||
EGE_VERBOSE(" create a cube _size=" << _size << " _materialName=" << _materialName << " _color=" << _color);
|
||||
ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("---", "DATA:color3.prog");
|
||||
if (out != nullptr) {
|
||||
if (out != null) {
|
||||
ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
|
||||
// set the element material properties :
|
||||
material->setAmbientFactor(vec4(1,1,1,1));
|
||||
|
@ -10,7 +10,7 @@
|
||||
ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createCylinder(float _radius, float _size, const etk::String& _materialName, const etk::Color<float>& _color, int32_t _lats, int32_t _longs) {
|
||||
EGE_VERBOSE(" create a cylinder _size=" << _size << " _materialName=" << _materialName << " _color=" << _color);
|
||||
ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("---", "DATA:color3.prog");
|
||||
if (out != nullptr) {
|
||||
if (out != null) {
|
||||
ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
|
||||
// set the element material properties :
|
||||
material->setAmbientFactor(vec4(1,1,1,1));
|
||||
|
@ -62,7 +62,7 @@ static char* loadNextData(char* _elementLine,
|
||||
/*
|
||||
if (m_zipReadingOffset >= m_zipContent->size()) {
|
||||
element[0] = '\0';
|
||||
return nullptr;
|
||||
return null;
|
||||
}
|
||||
*/
|
||||
char current = _file.fileGet();
|
||||
@ -95,12 +95,12 @@ static char* loadNextData(char* _elementLine,
|
||||
current = _file.fileGet();
|
||||
}
|
||||
if (outSize == 0) {
|
||||
return nullptr;
|
||||
return null;
|
||||
} else {
|
||||
// send last line
|
||||
return _elementLine;
|
||||
}
|
||||
return nullptr;
|
||||
return null;
|
||||
}
|
||||
|
||||
static void removeEndLine(char* _val) {
|
||||
@ -184,7 +184,7 @@ bool ege::resource::Mesh::loadEMF(const etk::String& _fileName) {
|
||||
int32_t level = countIndent(fileName);
|
||||
if (level == 0) {
|
||||
// new section ...
|
||||
if (loadNextData(inputDataLine, 2048, fileName) == nullptr) {
|
||||
if (loadNextData(inputDataLine, 2048, fileName) == null) {
|
||||
// reach end of file ...
|
||||
break;
|
||||
}
|
||||
@ -202,10 +202,10 @@ bool ege::resource::Mesh::loadEMF(const etk::String& _fileName) {
|
||||
currentMode = EMFModuleMaterial;
|
||||
// add previous material:
|
||||
if( materialName != ""
|
||||
&& material != nullptr) {
|
||||
&& material != null) {
|
||||
m_materials.add(materialName, material);
|
||||
materialName = "";
|
||||
material = nullptr;
|
||||
material = null;
|
||||
}
|
||||
material = ememory::makeShared<ege::Material>();
|
||||
removeEndLine(inputDataLine);
|
||||
@ -223,7 +223,7 @@ bool ege::resource::Mesh::loadEMF(const etk::String& _fileName) {
|
||||
&& currentMode <= EMFModuleMesh_END) {
|
||||
if (level == 1) {
|
||||
// In the mesh level 2 the line size must not exced 2048
|
||||
if (loadNextData(inputDataLine, 2048, fileName, true) == nullptr) {
|
||||
if (loadNextData(inputDataLine, 2048, fileName, true) == null) {
|
||||
// reach end of file ...
|
||||
break;
|
||||
}
|
||||
@ -261,7 +261,7 @@ bool ege::resource::Mesh::loadEMF(const etk::String& _fileName) {
|
||||
break;
|
||||
case EMFModuleMeshVertex: {
|
||||
vec3 vertex(0,0,0);
|
||||
while (loadNextData(inputDataLine, 2048, fileName, true, true) != nullptr) {
|
||||
while (loadNextData(inputDataLine, 2048, fileName, true, true) != null) {
|
||||
if (inputDataLine[0] == '\0') {
|
||||
break;
|
||||
}
|
||||
@ -278,7 +278,7 @@ bool ege::resource::Mesh::loadEMF(const etk::String& _fileName) {
|
||||
}
|
||||
case EMFModuleMeshUVMapping: {
|
||||
vec2 uvMap(0,0);
|
||||
while (loadNextData(inputDataLine, 2048, fileName, true, true) != nullptr) {
|
||||
while (loadNextData(inputDataLine, 2048, fileName, true, true) != null) {
|
||||
if (inputDataLine[0] == '\0') {
|
||||
break;
|
||||
}
|
||||
@ -297,7 +297,7 @@ bool ege::resource::Mesh::loadEMF(const etk::String& _fileName) {
|
||||
m_normalMode = ege::resource::Mesh::normalMode::vertex;
|
||||
vec3 normal(0,0,0);
|
||||
// find the vertex Normal list.
|
||||
while (loadNextData(inputDataLine, 2048, fileName, true, true) != nullptr) {
|
||||
while (loadNextData(inputDataLine, 2048, fileName, true, true) != null) {
|
||||
if (inputDataLine[0] == '\0') {
|
||||
break;
|
||||
}
|
||||
@ -317,7 +317,7 @@ bool ege::resource::Mesh::loadEMF(const etk::String& _fileName) {
|
||||
m_normalMode = ege::resource::Mesh::normalMode::face; // TODO : check if it is the same mode of display the normal from the start of the file
|
||||
vec3 normal(0,0,0);
|
||||
// find the face Normal list.
|
||||
while (loadNextData(inputDataLine, 2048, fileName, true, true) != nullptr) {
|
||||
while (loadNextData(inputDataLine, 2048, fileName, true, true) != null) {
|
||||
if (inputDataLine[0] == '\0') {
|
||||
break;
|
||||
}
|
||||
@ -336,7 +336,7 @@ bool ege::resource::Mesh::loadEMF(const etk::String& _fileName) {
|
||||
case EMFModuleMeshFaceMaterial:
|
||||
if (level == 2) {
|
||||
//Find mesh name ...
|
||||
if (loadNextData(inputDataLine, 2048, fileName, true) == nullptr) {
|
||||
if (loadNextData(inputDataLine, 2048, fileName, true) == null) {
|
||||
// reach end of file ...
|
||||
break;
|
||||
}
|
||||
@ -350,7 +350,7 @@ bool ege::resource::Mesh::loadEMF(const etk::String& _fileName) {
|
||||
meshFaceMaterialID = m_listFaces.getId(inputDataLine);
|
||||
EGE_VERBOSE(" " << inputDataLine);
|
||||
} else if (currentMode == EMFModuleMeshFaceMaterial) {
|
||||
while (loadNextData(inputDataLine, 2048, fileName, true, true) != nullptr) {
|
||||
while (loadNextData(inputDataLine, 2048, fileName, true, true) != null) {
|
||||
if (inputDataLine[0] == '\0') {
|
||||
// end of line
|
||||
break;
|
||||
@ -429,14 +429,14 @@ bool ege::resource::Mesh::loadEMF(const etk::String& _fileName) {
|
||||
break;
|
||||
case EMFModuleMeshPhysics:
|
||||
case EMFModuleMeshPhysicsNamed:
|
||||
if (loadNextData(inputDataLine, 2048, fileName, true, false, false) == nullptr) {
|
||||
if (loadNextData(inputDataLine, 2048, fileName, true, false, false) == null) {
|
||||
// reach end of file ...
|
||||
break;
|
||||
}
|
||||
removeEndLine(inputDataLine);
|
||||
if (level == 2) {
|
||||
physics = ege::physics::Shape::create(inputDataLine);
|
||||
if (physics == nullptr) {
|
||||
if (physics == null) {
|
||||
EGE_ERROR("Allocation error when creating physical shape ...");
|
||||
continue;
|
||||
}
|
||||
@ -444,7 +444,7 @@ bool ege::resource::Mesh::loadEMF(const etk::String& _fileName) {
|
||||
EGE_VERBOSE(" " << m_physics.size() << " " << inputDataLine);
|
||||
currentMode = EMFModuleMeshPhysicsNamed;
|
||||
} else if (currentMode == EMFModuleMeshPhysicsNamed) {
|
||||
if (physics == nullptr) {
|
||||
if (physics == null) {
|
||||
EGE_ERROR("Can not parse :'" << inputDataLine << "' in physical shape ...");
|
||||
continue;
|
||||
}
|
||||
@ -458,12 +458,12 @@ bool ege::resource::Mesh::loadEMF(const etk::String& _fileName) {
|
||||
} else if ( currentMode >= EMFModuleMaterial
|
||||
&& currentMode <= EMFModuleMaterial_END) {
|
||||
// all material element is stored on 1 line (size < 2048)
|
||||
if (loadNextData(inputDataLine, 2048, fileName, true) == nullptr) {
|
||||
if (loadNextData(inputDataLine, 2048, fileName, true) == null) {
|
||||
// reach end of file ...
|
||||
break;
|
||||
}
|
||||
removeEndLine(inputDataLine);
|
||||
if (material == nullptr) {
|
||||
if (material == null) {
|
||||
EGE_ERROR("material allocation error");
|
||||
jumpEndLine(fileName);
|
||||
continue;
|
||||
@ -528,7 +528,7 @@ bool ege::resource::Mesh::loadEMF(const etk::String& _fileName) {
|
||||
}
|
||||
} else if ( currentMode >= EMFModulePhysics
|
||||
&& currentMode <= EMFModulePhysics_END) {
|
||||
if (loadNextData(inputDataLine, 2048, fileName, true, false, false) == nullptr) {
|
||||
if (loadNextData(inputDataLine, 2048, fileName, true, false, false) == null) {
|
||||
// reach end of file ...
|
||||
break;
|
||||
}
|
||||
@ -536,7 +536,7 @@ bool ege::resource::Mesh::loadEMF(const etk::String& _fileName) {
|
||||
if (level == 1) {
|
||||
EGE_ERROR("Load shape : " << inputDataLine);
|
||||
physics = ege::physics::Shape::create(inputDataLine);
|
||||
if (physics == nullptr) {
|
||||
if (physics == null) {
|
||||
EGE_ERROR("Allocation error when creating physical shape ...");
|
||||
continue;
|
||||
}
|
||||
@ -544,7 +544,7 @@ bool ege::resource::Mesh::loadEMF(const etk::String& _fileName) {
|
||||
EGE_VERBOSE(" " << m_physics.size() << " " << inputDataLine);
|
||||
currentMode = EMFModulePhysicsNamed;
|
||||
} else if (currentMode == EMFModulePhysicsNamed) {
|
||||
if (physics == nullptr) {
|
||||
if (physics == null) {
|
||||
EGE_ERROR("Can not parse :'" << inputDataLine << "' in physical shape ...");
|
||||
continue;
|
||||
}
|
||||
@ -561,7 +561,7 @@ bool ege::resource::Mesh::loadEMF(const etk::String& _fileName) {
|
||||
}
|
||||
// add last material ...
|
||||
if( materialName != ""
|
||||
&& material != nullptr) {
|
||||
&& material != null) {
|
||||
m_materials.add(materialName, material);
|
||||
materialName = "";
|
||||
material.reset();
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createGrid(int32_t _lineCount, const vec3& _position, float _size, const etk::String& _materialName) {
|
||||
ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("---", "DATA:color3.prog");
|
||||
if (out != nullptr) {
|
||||
if (out != null) {
|
||||
ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
|
||||
// set the element material properties :
|
||||
material->setAmbientFactor(vec4(1,1,1,1));
|
||||
|
@ -25,7 +25,7 @@ bool ege::resource::Mesh::loadOBJ(const etk::String& _fileName) {
|
||||
char inputDataLine[2048];
|
||||
|
||||
int32_t lineID = 0;
|
||||
while (fileName.fileGets(inputDataLine, 2048) != nullptr)
|
||||
while (fileName.fileGets(inputDataLine, 2048) != null)
|
||||
{
|
||||
lineID++;
|
||||
if (inputDataLine[0] == 'v') {
|
||||
|
@ -10,7 +10,7 @@
|
||||
ememory::SharedPtr<ege::resource::Mesh> ege::resource::Mesh::createSphere(float _radius, const etk::String& _materialName, const etk::Color<float>& _color, int32_t _lats, int32_t _longs) {
|
||||
EGE_VERBOSE(" create a sphere _size=" << _radius << " _materialName=" << _materialName << " _color=" << _color);
|
||||
ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("---", "DATA:color3.prog");
|
||||
if (out != nullptr) {
|
||||
if (out != null) {
|
||||
ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
|
||||
// set the element material properties :
|
||||
material->setAmbientFactor(vec4(1,1,1,1));
|
||||
|
@ -15,7 +15,7 @@ ege::resource::ParticuleMesh::ParticuleMesh() {
|
||||
|
||||
void ege::resource::ParticuleMesh::init(const etk::String& _fileName, const etk::String& _shaderName) {
|
||||
ege::resource::Mesh::init(_fileName, _shaderName);
|
||||
if (m_GLprogram != nullptr) {
|
||||
if (m_GLprogram != null) {
|
||||
m_GLMainColor = m_GLprogram->getUniform("EW_mainColor");
|
||||
}
|
||||
}
|
||||
@ -29,7 +29,7 @@ void ege::resource::ParticuleMesh::draw(mat4& _positionMatrix,
|
||||
bool _enableDepthTest,
|
||||
bool _enableDepthUpdate)
|
||||
{
|
||||
if (m_GLprogram == nullptr) {
|
||||
if (m_GLprogram == null) {
|
||||
EGE_ERROR("No shader ...");
|
||||
return;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ void ege::widget::Mesh::init() {
|
||||
setMouseLimit(1);
|
||||
if (*propertyName != "") {
|
||||
m_object = ege::resource::Mesh::create(m_meshName);
|
||||
if (m_object == nullptr) {
|
||||
if (m_object == null) {
|
||||
EGE_ERROR("Can not load the resource : \"" << m_meshName << "\"");
|
||||
}
|
||||
}
|
||||
@ -42,7 +42,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 (m_object != nullptr) {
|
||||
if (m_object != null) {
|
||||
m_object->draw(transformationMatrix);
|
||||
}
|
||||
}
|
||||
@ -90,7 +90,7 @@ void ege::widget::Mesh::setFile(const etk::String& _filename) {
|
||||
&& m_meshName != _filename ) {
|
||||
m_meshName = _filename;
|
||||
m_object = ege::resource::Mesh::create(m_meshName);
|
||||
if (m_object == nullptr) {
|
||||
if (m_object == null) {
|
||||
EGE_ERROR("Can not load the resource : \"" << m_meshName << "\"");
|
||||
}
|
||||
}
|
||||
|
@ -52,9 +52,9 @@ ege::widget::Scene::~Scene() {
|
||||
void ege::widget::Scene::onRegenerateDisplay() {
|
||||
if (needRedraw() == true) {
|
||||
// Update the curent camera with the aspect ratio
|
||||
if (m_env != nullptr) {
|
||||
if (m_env != null) {
|
||||
ememory::SharedPtr<ege::Camera> camera = m_env->getCamera(m_cameraName);
|
||||
if (camera != nullptr) {
|
||||
if (camera != null) {
|
||||
camera->setSceenSize(getSize());
|
||||
}
|
||||
}
|
||||
@ -107,7 +107,7 @@ void ege::widget::Scene::systemDraw(const ewol::DrawProperty& _displayProp) {
|
||||
gale::openGL::setViewPort(m_origin, m_size);
|
||||
// configure render with the camera...
|
||||
ememory::SharedPtr<ege::Camera> camera = m_env->getCamera(m_cameraName);
|
||||
if (camera != nullptr) {
|
||||
if (camera != null) {
|
||||
camera->configureOpenGL();
|
||||
}
|
||||
onDraw();
|
||||
@ -126,7 +126,7 @@ void ege::widget::Scene::setCamera(const etk::String& _cameraName) {
|
||||
m_cameraName = _cameraName;
|
||||
// Update camera aspect ratio:
|
||||
ememory::SharedPtr<ege::Camera> camera = m_env->getCamera(m_cameraName);
|
||||
if (camera != nullptr) {
|
||||
if (camera != null) {
|
||||
camera->setSceenSize(m_size);
|
||||
}
|
||||
}
|
||||
@ -135,7 +135,7 @@ void ege::widget::Scene::calculateSize() {
|
||||
ewol::Widget::calculateSize();
|
||||
// Update camera aspect ratio:
|
||||
ememory::SharedPtr<ege::Camera> camera = m_env->getCamera(m_cameraName);
|
||||
if (camera != nullptr) {
|
||||
if (camera != null) {
|
||||
camera->setSceenSize(m_size);
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ appl::Windows::Windows() {
|
||||
|
||||
static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
|
||||
ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog");
|
||||
if (out != nullptr) {
|
||||
if (out != null) {
|
||||
ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
|
||||
// set the entity material properties :
|
||||
material->setAmbientFactor(vec4(1,1,1,1));
|
||||
@ -48,7 +48,7 @@ static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
|
||||
out->addMaterial("basics", material);
|
||||
//material->setImageSize(ivec2(size,size));
|
||||
egami::Image* myImage = material->get();
|
||||
if (nullptr == myImage) {
|
||||
if (null == myImage) {
|
||||
return out;
|
||||
}
|
||||
myImage->clear(etk::color::black);
|
||||
@ -80,7 +80,7 @@ void appl::Windows::init() {
|
||||
m_env->addCamera("basic", m_camera);
|
||||
|
||||
ememory::SharedPtr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create();
|
||||
if (tmpWidget == nullptr) {
|
||||
if (tmpWidget == null) {
|
||||
APPL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
tmpWidget->setEnv(m_env);
|
||||
@ -92,7 +92,7 @@ void appl::Windows::init() {
|
||||
ememory::SharedPtr<ege::resource::Mesh> myMesh;
|
||||
// Create an external box: (no physics)
|
||||
myMesh = createViewBoxStar();
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// 1st Position component:
|
||||
etk::Transform3D transform(vec3(0,0,0), etk::Quaternion::identity());
|
||||
@ -106,7 +106,7 @@ void appl::Windows::init() {
|
||||
}
|
||||
// create basic gird: (no physics)
|
||||
myMesh = ege::resource::Mesh::createGrid(10, vec3(0,0,0), 5);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// 1st Position component:
|
||||
etk::Transform3D transform(vec3(0,0,0), etk::Quaternion::identity());
|
||||
|
@ -34,7 +34,7 @@ appl::Windows::Windows() {
|
||||
|
||||
static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
|
||||
ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog");
|
||||
if (out == nullptr) {
|
||||
if (out == null) {
|
||||
return out;
|
||||
}
|
||||
ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
|
||||
@ -52,7 +52,7 @@ static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
|
||||
out->addMaterial("basics", material);
|
||||
//material->setImageSize(ivec2(size,size));
|
||||
egami::Image* myImage = material->get();
|
||||
if (myImage == nullptr) {
|
||||
if (myImage == null) {
|
||||
return out;
|
||||
}
|
||||
myImage->clear(etk::color::black);
|
||||
@ -86,7 +86,7 @@ void appl::Windows::init() {
|
||||
m_cameraControler.setCamera(m_camera);
|
||||
|
||||
ememory::SharedPtr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create();
|
||||
if (tmpWidget == nullptr) {
|
||||
if (tmpWidget == null) {
|
||||
APPL_CRITICAL("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
tmpWidget->setEnv(m_env);
|
||||
@ -99,7 +99,7 @@ void appl::Windows::init() {
|
||||
ememory::SharedPtr<ege::resource::Mesh> myMesh;
|
||||
// Create an external box: (no physics)
|
||||
myMesh = createViewBoxStar();
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// 1st Position component:
|
||||
etk::Transform3D transform(vec3(0,0,0), etk::Quaternion::identity());
|
||||
@ -113,7 +113,7 @@ void appl::Windows::init() {
|
||||
}
|
||||
// create basic gird: (no physics)
|
||||
myMesh = ege::resource::Mesh::createGrid(10, vec3(0,0,0), 5);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// 1st Position component:
|
||||
etk::Transform3D transform(vec3(0,0,0), etk::Quaternion::identity());
|
||||
@ -129,7 +129,7 @@ void appl::Windows::init() {
|
||||
|
||||
// create cubes ...
|
||||
myMesh = ege::resource::Mesh::createCube(vec3(200,200,0.2), "basics", etk::color::green);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// add all component:
|
||||
// 1st Position component:
|
||||
@ -154,7 +154,7 @@ void appl::Windows::init() {
|
||||
|
||||
// create cubes ...
|
||||
myMesh = ege::resource::Mesh::createCube(vec3(5,0.2,5), "basics", etk::color::green);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// add all component:
|
||||
// 1st Position component:
|
||||
@ -174,7 +174,7 @@ void appl::Windows::init() {
|
||||
m_env->addEntity(entity);
|
||||
}
|
||||
myMesh = ege::resource::Mesh::createCube(3, "basics", etk::color::orange);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// add all component:
|
||||
// 1st Position component:
|
||||
@ -196,7 +196,7 @@ void appl::Windows::init() {
|
||||
m_env->addEntity(entity);
|
||||
}
|
||||
myMesh = ege::resource::Mesh::createSphere(4, "basics", etk::color::blue);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// add all component:
|
||||
// 1st Position component:
|
||||
@ -218,7 +218,7 @@ void appl::Windows::init() {
|
||||
m_env->addEntity(entity);
|
||||
}
|
||||
myMesh = ege::resource::Mesh::createCylinder(4, 15, "basics", etk::color::blue);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// add all component:
|
||||
// 1st Position component:
|
||||
@ -241,7 +241,7 @@ void appl::Windows::init() {
|
||||
m_env->addEntity(entity);
|
||||
}
|
||||
myMesh = ege::resource::Mesh::createCapsule(4, 15, "basics", etk::color::purple);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// add all component:
|
||||
// 1st Position component:
|
||||
@ -264,7 +264,7 @@ void appl::Windows::init() {
|
||||
m_env->addEntity(entity);
|
||||
}
|
||||
myMesh = ege::resource::Mesh::createCone(4, 15, "basics", etk::color::purple);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// add all component:
|
||||
// 1st Position component:
|
||||
@ -307,7 +307,7 @@ bool appl::Windows::onEventInput(const ewol::event::Input& _event) {
|
||||
|
||||
ememory::SharedPtr<ege::resource::Mesh> myMesh;
|
||||
myMesh = ege::resource::Mesh::createCube(1, "basics", etk::color::orange);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// add all component:
|
||||
// 1st Position component:
|
||||
|
@ -33,7 +33,7 @@ appl::Windows::Windows() {
|
||||
|
||||
static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
|
||||
ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog");
|
||||
if (out != nullptr) {
|
||||
if (out != null) {
|
||||
ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
|
||||
// set the entity material properties :
|
||||
material->setAmbientFactor(vec4(1,1,1,1));
|
||||
@ -49,7 +49,7 @@ static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
|
||||
out->addMaterial("basics", material);
|
||||
//material->setImageSize(ivec2(size,size));
|
||||
egami::Image* myImage = material->get();
|
||||
if (nullptr == myImage) {
|
||||
if (null == myImage) {
|
||||
return out;
|
||||
}
|
||||
myImage->clear(etk::color::black);
|
||||
@ -89,13 +89,13 @@ void appl::Windows::init() {
|
||||
m_env->addCamera("left", camera4);
|
||||
|
||||
ememory::SharedPtr<ewol::widget::Sizer> tmpSizerVert = ewol::widget::Sizer::create();
|
||||
if (tmpSizerVert == nullptr) {
|
||||
if (tmpSizerVert == null) {
|
||||
APPL_CRITICAL("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
tmpSizerVert->propertyMode.set(ewol::widget::Sizer::modeVert);
|
||||
setSubWidget(tmpSizerVert);
|
||||
ememory::SharedPtr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create();
|
||||
if (tmpWidget == nullptr) {
|
||||
if (tmpWidget == null) {
|
||||
APPL_CRITICAL("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
tmpWidget->setEnv(m_env);
|
||||
@ -105,13 +105,13 @@ void appl::Windows::init() {
|
||||
tmpSizerVert->subWidgetAdd(tmpWidget);
|
||||
}
|
||||
ememory::SharedPtr<ewol::widget::Sizer> tmpSizerHori = ewol::widget::Sizer::create();
|
||||
if (tmpSizerHori == nullptr) {
|
||||
if (tmpSizerHori == null) {
|
||||
APPL_CRITICAL("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
tmpSizerHori->propertyMode.set(ewol::widget::Sizer::modeHori);
|
||||
tmpSizerVert->subWidgetAdd(tmpSizerHori);
|
||||
tmpWidget = ege::widget::Scene::create();
|
||||
if (tmpWidget == nullptr) {
|
||||
if (tmpWidget == null) {
|
||||
APPL_CRITICAL("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
tmpWidget->setEnv(m_env);
|
||||
@ -121,7 +121,7 @@ void appl::Windows::init() {
|
||||
tmpSizerHori->subWidgetAdd(tmpWidget);
|
||||
}
|
||||
tmpWidget = ege::widget::Scene::create();
|
||||
if (tmpWidget == nullptr) {
|
||||
if (tmpWidget == null) {
|
||||
APPL_CRITICAL("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
tmpWidget->setEnv(m_env);
|
||||
@ -136,7 +136,7 @@ void appl::Windows::init() {
|
||||
ememory::SharedPtr<ege::resource::Mesh> myMesh;
|
||||
// Create an external box: (no physics)
|
||||
myMesh = createViewBoxStar();
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// 1st Position component:
|
||||
etk::Transform3D transform(vec3(0,0,0), etk::Quaternion::identity());
|
||||
@ -150,7 +150,7 @@ void appl::Windows::init() {
|
||||
}
|
||||
// create basic gird: (no physics)
|
||||
myMesh = ege::resource::Mesh::createGrid(10, vec3(0,0,0), 5);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// 1st Position component:
|
||||
etk::Transform3D transform(vec3(0,0,0), etk::Quaternion::identity());
|
||||
@ -163,7 +163,7 @@ void appl::Windows::init() {
|
||||
m_env->addEntity(entity);
|
||||
}
|
||||
myMesh = ege::resource::Mesh::createCube(3, "basics", etk::color::orange);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// add all component:
|
||||
// 1st Position component:
|
||||
@ -185,7 +185,7 @@ void appl::Windows::init() {
|
||||
m_env->addEntity(entity);
|
||||
}
|
||||
myMesh = ege::resource::Mesh::createSphere(4, "basics", etk::color::blue);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// add all component:
|
||||
// 1st Position component:
|
||||
|
@ -32,7 +32,7 @@ appl::Windows::Windows() {
|
||||
|
||||
static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
|
||||
ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog");
|
||||
if (out != nullptr) {
|
||||
if (out != null) {
|
||||
ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
|
||||
// set the entity material properties :
|
||||
material->setAmbientFactor(vec4(1,1,1,1));
|
||||
@ -48,7 +48,7 @@ static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
|
||||
out->addMaterial("basics", material);
|
||||
//material->setImageSize(ivec2(size,size));
|
||||
egami::Image* myImage = material->get();
|
||||
if (myImage == nullptr) {
|
||||
if (myImage == null) {
|
||||
return out;
|
||||
}
|
||||
myImage->clear(etk::color::black);
|
||||
@ -80,7 +80,7 @@ void appl::Windows::init() {
|
||||
m_cameraControler.setCamera(m_camera);
|
||||
|
||||
ememory::SharedPtr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create();
|
||||
if (tmpWidget == nullptr) {
|
||||
if (tmpWidget == null) {
|
||||
APPL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
tmpWidget->setEnv(m_env);
|
||||
@ -92,7 +92,7 @@ void appl::Windows::init() {
|
||||
ememory::SharedPtr<ege::resource::Mesh> myMesh;
|
||||
// Create an external box: (no physics)
|
||||
myMesh = createViewBoxStar();
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// 1st Position component:
|
||||
etk::Transform3D transform(vec3(0,0,0), etk::Quaternion::identity());
|
||||
@ -106,7 +106,7 @@ void appl::Windows::init() {
|
||||
}
|
||||
// create basic gird: (no physics)
|
||||
myMesh = ege::resource::Mesh::createGrid(10, vec3(0,0,0), 5);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// 1st Position component:
|
||||
etk::Transform3D transform(vec3(0,0,0), etk::Quaternion::identity());
|
||||
@ -119,7 +119,7 @@ void appl::Windows::init() {
|
||||
m_env->addEntity(entity);
|
||||
}
|
||||
myMesh = ege::resource::Mesh::create("DATA:tree_1.emf");
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// add all component:
|
||||
// 1st Position component:
|
||||
|
@ -32,7 +32,7 @@ appl::Windows::Windows() {
|
||||
|
||||
static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
|
||||
ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("---", "DATA:texturedNoMaterial.prog");
|
||||
if (out != nullptr) {
|
||||
if (out != null) {
|
||||
ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
|
||||
// set the entity material properties :
|
||||
material->setAmbientFactor(vec4(1,1,1,1));
|
||||
@ -47,7 +47,7 @@ static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
|
||||
int32_t size = 1<<11;
|
||||
material->setImageSize(ivec2(size,size));
|
||||
egami::Image* myImage = material->get();
|
||||
if (nullptr == myImage) {
|
||||
if (null == myImage) {
|
||||
return out;
|
||||
}
|
||||
myImage->clear(etk::color::black);
|
||||
@ -67,7 +67,7 @@ static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
|
||||
|
||||
static ememory::SharedPtr<ege::resource::Mesh> createMars() {
|
||||
ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("---");
|
||||
if (out != nullptr) {
|
||||
if (out != null) {
|
||||
ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
|
||||
material->setAmbientFactor(vec4(0.112f,0.112f,0.112f,1.0f));
|
||||
material->setDiffuseFactor(vec4(0.512f,0.512f,0.512f,1.0f));
|
||||
@ -94,7 +94,7 @@ void appl::Windows::init() {
|
||||
m_cameraControler.setCamera(m_camera);
|
||||
|
||||
ememory::SharedPtr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create();
|
||||
if (tmpWidget == nullptr) {
|
||||
if (tmpWidget == null) {
|
||||
APPL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
tmpWidget->setEnv(m_env);
|
||||
@ -106,7 +106,7 @@ void appl::Windows::init() {
|
||||
ememory::SharedPtr<ege::resource::Mesh> myMesh;
|
||||
// Create an external box: (no physics)
|
||||
myMesh = createViewBoxStar();
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// 1st Position component:
|
||||
etk::Transform3D transform(vec3(0,0,0), etk::Quaternion::identity());
|
||||
@ -120,7 +120,7 @@ void appl::Windows::init() {
|
||||
}
|
||||
// create basic gird: (no physics)
|
||||
myMesh = ege::resource::Mesh::createGrid(10, vec3(0,0,0), 5);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// 1st Position component:
|
||||
etk::Transform3D transform(vec3(0,0,0), etk::Quaternion::identity());
|
||||
@ -134,7 +134,7 @@ void appl::Windows::init() {
|
||||
}
|
||||
if (false) {
|
||||
myMesh = createMars();
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// 1st Position component:
|
||||
etk::Transform3D transform(vec3(5,0,0), etk::Quaternion::identity());
|
||||
@ -163,7 +163,7 @@ void appl::Windows::setDebugShape() {
|
||||
void appl::Windows::setMeshName(const etk::String& _fileName) {
|
||||
// Create an external box: (no physics)
|
||||
ememory::SharedPtr<ege::resource::Mesh> myMesh = ege::resource::Mesh::create(_fileName);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// 1st Position component:
|
||||
etk::Transform3D transform(vec3(0,0,0), etk::Quaternion::identity());
|
||||
@ -214,7 +214,7 @@ bool appl::Windows::onEventInput(const ewol::event::Input& _event) {
|
||||
|
||||
ememory::SharedPtr<ege::resource::Mesh> myMesh;
|
||||
myMesh = ege::resource::Mesh::createCube(1, "basics", etk::color::orange);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// add all component:
|
||||
// 1st Position component:
|
||||
|
@ -31,7 +31,7 @@ appl::Windows::Windows() {
|
||||
|
||||
static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
|
||||
ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog");
|
||||
if (out != nullptr) {
|
||||
if (out != null) {
|
||||
ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
|
||||
// set the entity material properties :
|
||||
material->setAmbientFactor(vec4(1,1,1,1));
|
||||
@ -47,7 +47,7 @@ static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
|
||||
out->addMaterial("basics", material);
|
||||
//material->setImageSize(ivec2(size,size));
|
||||
egami::Image* myImage = material->get();
|
||||
if (nullptr == myImage) {
|
||||
if (null == myImage) {
|
||||
return out;
|
||||
}
|
||||
myImage->clear(etk::color::black);
|
||||
@ -80,7 +80,7 @@ void appl::Windows::init() {
|
||||
m_cameraControler.setCamera(m_camera);
|
||||
|
||||
ememory::SharedPtr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create();
|
||||
if (tmpWidget == nullptr) {
|
||||
if (tmpWidget == null) {
|
||||
APPL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
tmpWidget->setEnv(m_env);
|
||||
@ -93,7 +93,7 @@ void appl::Windows::init() {
|
||||
ememory::SharedPtr<ege::resource::Mesh> myMesh;
|
||||
// Create an external box: (no physics)
|
||||
myMesh = createViewBoxStar();
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// 1st Position component:
|
||||
etk::Transform3D transform(vec3(0,0,0), etk::Quaternion::identity());
|
||||
@ -107,7 +107,7 @@ void appl::Windows::init() {
|
||||
}
|
||||
// create basic gird: (no physics)
|
||||
myMesh = ege::resource::Mesh::createGrid(10, vec3(0,0,0), 5);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// 1st Position component:
|
||||
etk::Transform3D transform(vec3(0,0,0), etk::Quaternion::identity());
|
||||
@ -120,7 +120,7 @@ void appl::Windows::init() {
|
||||
m_env->addEntity(entity);
|
||||
}
|
||||
myMesh = ege::resource::Mesh::createCube(3, "basics", etk::color::orange);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// add all component:
|
||||
// 1st Position component:
|
||||
@ -142,7 +142,7 @@ void appl::Windows::init() {
|
||||
m_env->addEntity(entity);
|
||||
}
|
||||
myMesh = ege::resource::Mesh::createSphere(4, "basics", etk::color::blue);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// add all component:
|
||||
// 1st Position component:
|
||||
@ -184,10 +184,10 @@ bool appl::Windows::onEventInput(const ewol::event::Input& _event) {
|
||||
m_ray = etk::makePair(ray.getOrigin(), ray.getOrigin()+ray.getDirection()*50000);
|
||||
APPL_DEBUG("pos=" << pos << " ray = " << ray);
|
||||
ememory::SharedPtr<ege::physics::Engine> engine = ememory::dynamicPointerCast<ege::physics::Engine>(m_env->getEngine("physics"));
|
||||
if (engine != nullptr) {
|
||||
if (engine != null) {
|
||||
/*
|
||||
etk::Pair<ememory::SharedPtr<ege::physic::Component>, etk::Pair<vec3,vec3>> result = engine->testRayObject(m_ray);
|
||||
if (result.first != nullptr) {
|
||||
if (result.first != null) {
|
||||
APPL_INFO("Select Object :" << result.first->getUID());
|
||||
}
|
||||
*/
|
||||
|
@ -34,7 +34,7 @@ appl::Windows::Windows() {
|
||||
|
||||
static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
|
||||
ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog");
|
||||
if (out == nullptr) {
|
||||
if (out == null) {
|
||||
return out;
|
||||
}
|
||||
ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
|
||||
@ -52,7 +52,7 @@ static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
|
||||
out->addMaterial("basics", material);
|
||||
//material->setImageSize(ivec2(size,size));
|
||||
egami::Image* myImage = material->get();
|
||||
if (myImage == nullptr) {
|
||||
if (myImage == null) {
|
||||
return out;
|
||||
}
|
||||
myImage->clear(etk::color::black);
|
||||
@ -96,7 +96,7 @@ void appl::Windows::init() {
|
||||
m_env->getEngine("physics")->properties.set("debug-shape", "true");
|
||||
|
||||
ememory::SharedPtr<ege::physics::Engine> tmpPhysics = ememory::dynamicPointerCast<ege::physics::Engine>(m_env->getEngine("physics"));
|
||||
if (tmpPhysics != nullptr) {
|
||||
if (tmpPhysics != null) {
|
||||
tmpPhysics->setGravity(vec3(0.0, 0.0, -9.81)); // generic earth gravity
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ void appl::Windows::init() {
|
||||
m_cameraControler.setCamera(m_camera);
|
||||
|
||||
ememory::SharedPtr<ege::widget::Scene> tmpWidget = ege::widget::Scene::create();
|
||||
if (tmpWidget == nullptr) {
|
||||
if (tmpWidget == null) {
|
||||
APPL_CRITICAL("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
tmpWidget->setEnv(m_env);
|
||||
@ -119,7 +119,7 @@ void appl::Windows::init() {
|
||||
ememory::SharedPtr<ege::resource::Mesh> myMesh;
|
||||
// Create an external box: (no physics)
|
||||
myMesh = createViewBoxStar();
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// 1st Position component:
|
||||
etk::Transform3D transform(vec3(0,0,0), etk::Quaternion::identity());
|
||||
@ -133,7 +133,7 @@ void appl::Windows::init() {
|
||||
}
|
||||
// create basic gird: (no physics)
|
||||
myMesh = ege::resource::Mesh::createGrid(10, vec3(0,0,0), 5);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// 1st Position component:
|
||||
etk::Transform3D transform(vec3(0,0,0), etk::Quaternion::identity());
|
||||
@ -148,7 +148,7 @@ void appl::Windows::init() {
|
||||
|
||||
// create cubes (surface) (the colision is bigger than the display)
|
||||
myMesh = ege::resource::Mesh::createCube(vec3(50,50,10), "basics", etk::color::green);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// add all component:
|
||||
// 1st Position component:
|
||||
@ -171,7 +171,7 @@ void appl::Windows::init() {
|
||||
|
||||
// create cubes that will move...
|
||||
myMesh = ege::resource::Mesh::createCube(vec3(5,5,5), "basics", etk::color::yellow);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// add all component:
|
||||
// 1st Position component:
|
||||
@ -201,7 +201,7 @@ bool appl::Windows::onEventEntry(const ewol::event::Entry& _event) {
|
||||
}
|
||||
if(_event.getType() == gale::key::keyboard::character ) {
|
||||
ememory::SharedPtr<ege::physics::Component> physic = ememory::dynamicPointerCast<ege::physics::Component>(m_entity->getComponent("physics"));
|
||||
if (physic == nullptr) {
|
||||
if (physic == null) {
|
||||
APPL_ERROR("Can not get the component");
|
||||
return false;
|
||||
}
|
||||
@ -264,14 +264,14 @@ bool appl::Windows::onEventInput(const ewol::event::Input& _event) {
|
||||
if (_event.getId() == 2) {
|
||||
if (_event.getStatus() == gale::key::status::down) {
|
||||
ememory::SharedPtr<ege::physics::Component> physic = ememory::dynamicPointerCast<ege::physics::Component>(m_entity->getComponent("physics"));
|
||||
if (physic == nullptr) {
|
||||
if (physic == null) {
|
||||
APPL_ERROR("Can not get the component");
|
||||
return false;
|
||||
}
|
||||
physic->applyForceToCenterOfMass(vec3(0,0,10000000), true);
|
||||
} else if (_event.getStatus() == gale::key::status::up) {
|
||||
ememory::SharedPtr<ege::physics::Component> physic = ememory::dynamicPointerCast<ege::physics::Component>(m_entity->getComponent("physics"));
|
||||
if (physic == nullptr) {
|
||||
if (physic == null) {
|
||||
APPL_ERROR("Can not get the component");
|
||||
return false;
|
||||
}
|
||||
@ -281,7 +281,7 @@ bool appl::Windows::onEventInput(const ewol::event::Input& _event) {
|
||||
if (_event.getId() == 1) {
|
||||
if (_event.getStatus() == gale::key::status::down) {
|
||||
ememory::SharedPtr<ege::physics::Component> physic = ememory::dynamicPointerCast<ege::physics::Component>(m_entity->getComponent("physics"));
|
||||
if (physic == nullptr) {
|
||||
if (physic == null) {
|
||||
APPL_ERROR("Can not get the component");
|
||||
return false;
|
||||
}
|
||||
@ -289,7 +289,7 @@ bool appl::Windows::onEventInput(const ewol::event::Input& _event) {
|
||||
physic->applyRelativeTorque(vec3(0,0,10000000), true);
|
||||
} else if (_event.getStatus() == gale::key::status::up) {
|
||||
ememory::SharedPtr<ege::physics::Component> physic = ememory::dynamicPointerCast<ege::physics::Component>(m_entity->getComponent("physics"));
|
||||
if (physic == nullptr) {
|
||||
if (physic == null) {
|
||||
APPL_ERROR("Can not get the component");
|
||||
return false;
|
||||
}
|
||||
@ -304,7 +304,7 @@ bool appl::Windows::onEventInput(const ewol::event::Input& _event) {
|
||||
|
||||
ememory::SharedPtr<ege::resource::Mesh> myMesh;
|
||||
myMesh = ege::resource::Mesh::createCube(1, "basics", etk::color::orange);
|
||||
if (myMesh != nullptr) {
|
||||
if (myMesh != null) {
|
||||
ememory::SharedPtr<ege::Entity> entity = ememory::makeShared<ege::Entity>(m_env);
|
||||
// add all component:
|
||||
// 1st Position component:
|
||||
|
Loading…
x
Reference in New Issue
Block a user