[DEV] correct sample
This commit is contained in:
parent
21c6ab2f80
commit
183a0020d7
@ -6,6 +6,8 @@
|
||||
|
||||
#include <ege/debug.hpp>
|
||||
#include <ege/widget/Scene.hpp>
|
||||
#include <echrono/Steady.hpp>
|
||||
#include <echrono/Duration.hpp>
|
||||
|
||||
#include <cmath>
|
||||
#include <ege/debug.hpp>
|
||||
@ -66,7 +68,7 @@ void ege::widget::Scene::onRegenerateDisplay() {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef SCENE_DISPLAY_SPEED
|
||||
static int64_t g_startTime = 0;
|
||||
static echrono::Steady g_startTime;
|
||||
static int32_t g_counterNbTimeDisplay = 0;
|
||||
#endif
|
||||
|
||||
@ -76,7 +78,7 @@ void ege::widget::Scene::onRegenerateDisplay() {
|
||||
void ege::widget::Scene::onDraw() {
|
||||
#ifdef SCENE_DISPLAY_SPEED
|
||||
g_counterNbTimeDisplay++;
|
||||
g_startTime = ewol::getTime();
|
||||
g_startTime = echrono::Steady::now();
|
||||
#endif
|
||||
|
||||
// draw constant object :
|
||||
@ -142,11 +144,11 @@ void ege::widget::Scene::onDraw() {
|
||||
m_env->getParticuleEngine().draw(*camera);
|
||||
}
|
||||
#ifdef SCENE_DISPLAY_SPEED
|
||||
float localTime = (float)(ewol::getTime() - g_startTime) / 1000.0f;
|
||||
echrono::Duration localTime = echrono::Steady::now() - g_startTime;
|
||||
if (localTime>1) {
|
||||
EWOL_ERROR(" scene : " << localTime << "ms " << g_counterNbTimeDisplay);
|
||||
EWOL_ERROR(" scene : " << localTime << " " << g_counterNbTimeDisplay);
|
||||
} else {
|
||||
EWOL_DEBUG(" scene : " << localTime << "ms " << g_counterNbTimeDisplay);
|
||||
EWOL_DEBUG(" scene : " << localTime << " " << g_counterNbTimeDisplay);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -168,6 +170,7 @@ void ege::widget::Scene::systemDraw(const ewol::DrawProperty& _displayProp) {
|
||||
#ifdef SCENE_BRUT_PERFO_TEST
|
||||
int64_t tmp___startTime0 = ewol::getTime();
|
||||
#endif
|
||||
//EGE_INFO("DRAW ...");
|
||||
gale::openGL::bindBuffer(0);
|
||||
gale::openGL::push();
|
||||
// here we invert the reference of the standard openGl view because the reference in the common display is Top left and not buttom left
|
||||
|
@ -64,7 +64,7 @@ def configure(target, my_module):
|
||||
'ege/Ray.cpp',
|
||||
])
|
||||
my_module.copy_path('data/ParticuleMesh.*')
|
||||
my_module.add_depend(['ewol', 'bullet-physics'])
|
||||
my_module.add_depend(['ewol', 'bullet-physics', 'echrono'])
|
||||
my_module.add_flag('c++', [
|
||||
'-Wno-write-strings',
|
||||
'-Wmissing-field-initializers',
|
||||
|
@ -92,6 +92,7 @@ void appl::Windows::init() {
|
||||
if (myMesh != nullptr) {
|
||||
m_env->addStaticMeshToDraw(myMesh);
|
||||
}
|
||||
m_env->propertyStatus.set(ege::gameStart);
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,43 +22,44 @@
|
||||
|
||||
appl::Windows::Windows() {
|
||||
addObjectType("appl::Windows");
|
||||
propertyTitle.setDirectCheck("example ege : DoubleView");
|
||||
propertyTitle.setDirectCheck("example ege : Collision");
|
||||
}
|
||||
|
||||
|
||||
static ememory::SharedPtr<ege::resource::Mesh> createViewBoxStar() {
|
||||
ememory::SharedPtr<ege::resource::Mesh> out = ege::resource::Mesh::create("viewBoxStar", "DATA:texturedNoMaterial.prog");
|
||||
if (out != nullptr) {
|
||||
ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
|
||||
// set the element material properties :
|
||||
material->setAmbientFactor(vec4(1,1,1,1));
|
||||
material->setDiffuseFactor(vec4(0,0,0,1));
|
||||
material->setSpecularFactor(vec4(0,0,0,1));
|
||||
material->setShininess(1);
|
||||
// 1024 == > 1<<9
|
||||
// 2048 == > 1<<10
|
||||
// 4096 == > 1<<11
|
||||
int32_t size = 1<<11;
|
||||
//material->setTexture0(""); //"
|
||||
material->setTexture0Magic(ivec2(size,size));
|
||||
out->addMaterial("basics", material);
|
||||
//material->setImageSize(ivec2(size,size));
|
||||
egami::Image* myImage = material->get();
|
||||
if (nullptr == myImage) {
|
||||
return out;
|
||||
}
|
||||
myImage->clear(etk::color::black);
|
||||
ivec2 tmpPos;
|
||||
for (int32_t iii=0; iii<6000; iii++) {
|
||||
tmpPos.setValue(etk::tool::frand(0,size), etk::tool::frand(0,size)) ;
|
||||
myImage->set(tmpPos, etk::color::white);
|
||||
}
|
||||
material->flush();
|
||||
// basis on cube :
|
||||
out->createViewBox("basics", 1000/* distance */);
|
||||
// generate the VBO
|
||||
out->generateVBO();
|
||||
if (out == nullptr) {
|
||||
return out;
|
||||
}
|
||||
ememory::SharedPtr<ege::Material> material = ememory::makeShared<ege::Material>();
|
||||
// set the element material properties :
|
||||
material->setAmbientFactor(vec4(1,1,1,1));
|
||||
material->setDiffuseFactor(vec4(0,0,0,1));
|
||||
material->setSpecularFactor(vec4(0,0,0,1));
|
||||
material->setShininess(1);
|
||||
// 1024 == > 1<<9
|
||||
// 2048 == > 1<<10
|
||||
// 4096 == > 1<<11
|
||||
int32_t size = 1<<11;
|
||||
//material->setTexture0(""); //"
|
||||
material->setTexture0Magic(ivec2(size,size));
|
||||
out->addMaterial("basics", material);
|
||||
//material->setImageSize(ivec2(size,size));
|
||||
egami::Image* myImage = material->get();
|
||||
if (myImage == nullptr) {
|
||||
return out;
|
||||
}
|
||||
myImage->clear(etk::color::black);
|
||||
ivec2 tmpPos;
|
||||
for (int32_t iii=0; iii<6000; iii++) {
|
||||
tmpPos.setValue(etk::tool::frand(0,size), etk::tool::frand(0,size)) ;
|
||||
myImage->set(tmpPos, etk::color::white);
|
||||
}
|
||||
material->flush();
|
||||
// basis on cube :
|
||||
out->createViewBox("basics", 1000/* distance */);
|
||||
// generate the VBO
|
||||
out->generateVBO();
|
||||
return out;
|
||||
}
|
||||
|
||||
@ -133,8 +134,8 @@ void appl::Windows::init() {
|
||||
element->iaEnable();
|
||||
|
||||
m_env->addElement(element);
|
||||
|
||||
}
|
||||
m_env->propertyStatus.set(ege::gameStart);
|
||||
}
|
||||
|
||||
namespace appl {
|
||||
@ -171,6 +172,7 @@ bool appl::Windows::onEventInput(const ewol::event::Input& _event) {
|
||||
element->setMass(20);
|
||||
element->setLinearVelocity(ray.getDirection()*100);
|
||||
m_env->addElement(element);
|
||||
APPL_INFO("Create cube at position " << ray.getOrigin() << " velocity: " << ray.getDirection()*100);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -174,6 +174,7 @@ void appl::Windows::init() {
|
||||
m_env->addElement(element);
|
||||
|
||||
}
|
||||
m_env->propertyStatus.set(ege::gameStart);
|
||||
}
|
||||
|
||||
bool appl::Windows::onEventInput(const ewol::event::Input& _event) {
|
||||
|
@ -113,6 +113,7 @@ void appl::Windows::init() {
|
||||
m_env->addElement(element);
|
||||
}
|
||||
}
|
||||
m_env->propertyStatus.set(ege::gameStart);
|
||||
}
|
||||
|
||||
|
||||
|
@ -130,6 +130,7 @@ void appl::Windows::init() {
|
||||
m_env->addElement(element);
|
||||
|
||||
}
|
||||
m_env->propertyStatus.set(ege::gameStart);
|
||||
}
|
||||
|
||||
bool appl::Windows::onEventInput(const ewol::event::Input& _event) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user