[DEBUG] corect windws compilation and missed init in the shaper tool

This commit is contained in:
Edouard DUPIN 2013-03-03 20:59:47 +01:00
parent 2794b6e18f
commit 71af7fe7d2
8 changed files with 158 additions and 266 deletions

View File

@ -35,6 +35,10 @@ ewol::Shaper::Shaper(etk::UString shaperName) :
m_resourceTexture(NULL), m_resourceTexture(NULL),
m_nextStatusRequested(-1), m_nextStatusRequested(-1),
m_time(-1), m_time(-1),
m_propertyOrigin(0,0),
m_propertySize(0,0),
m_propertyInsidePosition(0,0),
m_propertyInsideSize(0,0),
m_stateOld(0), m_stateOld(0),
m_stateNew(0), m_stateNew(0),
m_stateTransition(1.0) m_stateTransition(1.0)
@ -250,7 +254,7 @@ void ewol::Shaper::SetInsidePos(vec2 newInsidePos)
vec2 ewol::Shaper::GetPadding(void) vec2 ewol::Shaper::GetPadding(void)
{ {
vec2 padding; vec2 padding(0,0);
if (m_config!=NULL) { if (m_config!=NULL) {
padding.setValue(m_config->GetFloat(m_confIdPaddingX), padding.setValue(m_config->GetFloat(m_confIdPaddingX),
m_config->GetFloat(m_confIdPaddingY)); m_config->GetFloat(m_confIdPaddingY));

View File

@ -46,16 +46,16 @@ namespace ewol
// For the Image : // For the Image :
ewol::TextureFile* m_resourceTexture; //!< texture resources (for the image) ewol::TextureFile* m_resourceTexture; //!< texture resources (for the image)
// internal needed data : // internal needed data :
int32_t m_nextStatusRequested; //!< when status is changing, this represent the next step of it int32_t m_nextStatusRequested; //!< when status is changing, this represent the next step of it
int64_t m_time; //!< The last time of the dispaly (-1 if nothing progressing) int64_t m_time; //!< The last time of the dispaly (-1 if nothing progressing)
vec2 m_propertyOrigin; //!< widget origin vec2 m_propertyOrigin; //!< widget origin
vec2 m_propertySize; //!< widget size vec2 m_propertySize; //!< widget size
vec2 m_propertyInsidePosition; //!< internal subwidget position vec2 m_propertyInsidePosition; //!< internal subwidget position
vec2 m_propertyInsideSize; //!< internal subwidget size vec2 m_propertyInsideSize; //!< internal subwidget size
int32_t m_stateOld; //!< previous state int32_t m_stateOld; //!< previous state
int32_t m_stateNew; //!< destination state int32_t m_stateNew; //!< destination state
float m_stateTransition; //!< working state between 2 states float m_stateTransition; //!< working state between 2 states
vec2 m_coord[6]; //!< the double triangle coordonates vec2 m_coord[6]; //!< the double triangle coordonates
private: private:
/** /**
* @brief Load the openGL program and get all the ID needed * @brief Load the openGL program and get all the ID needed

View File

@ -82,11 +82,11 @@ namespace ewol
int32_t m_selectionStartPos; //!< start position of the Selection (if == m_cursorPos ==> no selection) int32_t m_selectionStartPos; //!< start position of the Selection (if == m_cursorPos ==> no selection)
int32_t m_cursorPos; //!< Cursor position (default no cursor ==> -100) int32_t m_cursorPos; //!< Cursor position (default no cursor ==> -100)
private: private:
ewol::TexturedFont* m_font; //!< Font resources ewol::TexturedFont* m_font; //!< Font resources
private: // Text private: // Text
etk::Vector<vec2 > m_coord; //!< internal coord of the object etk::Vector<vec2 > m_coord; //!< internal coord of the object
etk::Vector<vec2 > m_coordTex; //!< internal texture coordinate for every point etk::Vector<vec2 > m_coordTex; //!< internal texture coordinate for every point
etk::Vector<draw::Colorf> m_coordColor; //!< internal color of the different point etk::Vector<draw::Colorf> m_coordColor; //!< internal color of the different point
private: private:
/** /**
* @brief Load the openGL program and get all the ID needed * @brief Load the openGL program and get all the ID needed

View File

@ -74,8 +74,8 @@ void guiInterface::ChangeSize(ivec2 size)
{ {
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
int title_size = GetSystemMetrics(SM_CYCAPTION); int title_size = GetSystemMetrics(SM_CYCAPTION);
size.x += border_thickness*2; size.setValue(size.x() + border_thickness*2,
size.y += border_thickness*2 + title_size; size.y() + border_thickness*2 + title_size);
//m_currentHeight = size.y; //m_currentHeight = size.y;
// TODO : Later // TODO : Later
} }
@ -88,8 +88,7 @@ void guiInterface::ChangePos(ivec2 pos)
void guiInterface::GetAbsPos(ivec2& size) void guiInterface::GetAbsPos(ivec2& size)
{ {
// TODO : Later // TODO : Later
size.x = 0; size.setValue(0,0);
size.y = 0;
} }
@ -433,30 +432,30 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
buttonIsDown = false; buttonIsDown = false;
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
mouseButtonId = 1; mouseButtonId = 1;
pos.x = GET_X_LPARAM(lParam); pos.setValue(GET_X_LPARAM(lParam),
pos.y = m_currentHeight-GET_Y_LPARAM(lParam); m_currentHeight-GET_Y_LPARAM(lParam));
inputIsPressed[mouseButtonId] = buttonIsDown; inputIsPressed[mouseButtonId] = buttonIsDown;
eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x, (float)pos.y); eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y());
return 0; return 0;
case WM_MBUTTONUP: case WM_MBUTTONUP:
buttonIsDown = false; buttonIsDown = false;
case WM_MBUTTONDOWN: case WM_MBUTTONDOWN:
mouseButtonId = 2; mouseButtonId = 2;
pos.x = GET_X_LPARAM(lParam); pos.setValue(GET_X_LPARAM(lParam),
pos.y = m_currentHeight-GET_Y_LPARAM(lParam); m_currentHeight-GET_Y_LPARAM(lParam));
inputIsPressed[mouseButtonId] = buttonIsDown; inputIsPressed[mouseButtonId] = buttonIsDown;
eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x, (float)pos.y); eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y());
return 0; return 0;
case WM_RBUTTONUP: case WM_RBUTTONUP:
buttonIsDown = false; buttonIsDown = false;
case WM_RBUTTONDOWN: case WM_RBUTTONDOWN:
mouseButtonId = 3; mouseButtonId = 3;
pos.x = GET_X_LPARAM(lParam); pos.setValue(GET_X_LPARAM(lParam),
pos.y = m_currentHeight-GET_Y_LPARAM(lParam); m_currentHeight-GET_Y_LPARAM(lParam));
inputIsPressed[mouseButtonId] = buttonIsDown; inputIsPressed[mouseButtonId] = buttonIsDown;
eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x, (float)pos.y); eSystem::SetMouseState(mouseButtonId, buttonIsDown, (float)pos.x(), (float)pos.y());
return 0; return 0;
case WM_MOUSEWHEEL: case WM_MOUSEWHEEL:
@ -467,25 +466,25 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
EWOL_DEBUG("event SCROOL DOWN"); EWOL_DEBUG("event SCROOL DOWN");
mouseButtonId = 5; mouseButtonId = 5;
} }
pos.x = GET_X_LPARAM(lParam); pos.setValue(GET_X_LPARAM(lParam),
pos.y = m_currentHeight-GET_Y_LPARAM(lParam); m_currentHeight-GET_Y_LPARAM(lParam));
eSystem::SetMouseState(mouseButtonId, true, (float)pos.x, (float)pos.y); eSystem::SetMouseState(mouseButtonId, true, (float)pos.x(), (float)pos.y());
eSystem::SetMouseState(mouseButtonId, false, (float)pos.x, (float)pos.y); eSystem::SetMouseState(mouseButtonId, false, (float)pos.x(), (float)pos.y());
return 0; return 0;
case WM_MOUSEHOVER: case WM_MOUSEHOVER:
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
pos.x = GET_X_LPARAM(lParam); pos.setValue(GET_X_LPARAM(lParam),
pos.y = m_currentHeight-GET_Y_LPARAM(lParam); m_currentHeight-GET_Y_LPARAM(lParam));
for (int32_t iii=0; iii<NB_MAX_INPUT ; iii++) { for (int32_t iii=0; iii<NB_MAX_INPUT ; iii++) {
if (true == inputIsPressed[iii]) { if (true == inputIsPressed[iii]) {
EWOL_VERBOSE("Windows event: bt=" << iii << " " << message << " = \"WM_MOUSEMOVE\" " << pos ); EWOL_VERBOSE("Windows event: bt=" << iii << " " << message << " = \"WM_MOUSEMOVE\" " << pos );
eSystem::SetMouseMotion(iii, (float)pos.x, (float)pos.y); eSystem::SetMouseMotion(iii, (float)pos.x(), (float)pos.y());
return 0; return 0;
} }
} }
EWOL_VERBOSE("Windows event: bt=" << 0 << " " << message << " = \"WM_MOUSEMOVE\" " << pos ); EWOL_VERBOSE("Windows event: bt=" << 0 << " " << message << " = \"WM_MOUSEMOVE\" " << pos );
eSystem::SetMouseMotion(0, (float)pos.x, (float)pos.y); eSystem::SetMouseMotion(0, (float)pos.x(), (float)pos.y());
return 0; return 0;
default: default:

View File

@ -285,18 +285,7 @@ void ewol::Mesh::Subdivide(int32_t numberOfTime, bool smooth)
} }
} }
int32_t CreateOrGetNewPointId(const vec3& point, etk::Vector<vec3>& list) int32_t CreateOrGetNewPointId(vertex_te type, const vec3& point, etk::Vector<VertexNode*>& list)
{
for (int32_t iii=0; iii<list.Size(); iii++) {
if (list[iii] == point) {
return iii;
}
}
list.PushBack(point);
return list.Size()-1;
}
int32_t CreateOrGetNewPointId2(vertex_te type, const vec3& point, etk::Vector<VertexNode*>& list)
{ {
for (int32_t iii=0; iii<list.Size(); iii++) { for (int32_t iii=0; iii<list.Size(); iii++) {
if (list[iii]->GetPos() == point) { if (list[iii]->GetPos() == point) {
@ -324,193 +313,91 @@ int32_t CreateOrGetNewTexId(const vec2& point, etk::Vector<vec2>& list)
void ewol::Mesh::InternalSubdivide(bool smooth) void ewol::Mesh::InternalSubdivide(bool smooth)
{ {
if (false==smooth) { //Copy the mesh for modify this one and not his parrent (that one is needed for smoothing)
//Copy the mesh for modify this one and not his parrent (that one is needed for smoothing) etk::Vector<VertexNode*> listVertex;
etk::Vector<vec3> listVertex(m_listVertex); for(int32_t iii=0; iii<m_listVertex.Size(); iii++) {
etk::Vector<vec2> listUV(m_listUV); VertexNode* tmpElement = new VertexNode(VERTEX_OLD, m_listVertex[iii]);
etk::Vector<Face> listFaces; // no face here ... listVertex.PushBack(tmpElement);
etk::Vector<int32_t> listElementHalfPoint(16);// preallocate at 16.. }
etk::Vector<int32_t> listElementHalfUV(16);// preallocate at 16.. etk::Vector<vec2> listUV(m_listUV);
etk::Vector<Face> listFaces; // no face here ...
etk::Vector<int32_t> listElementHalfPoint(16);// preallocate at 16..
etk::Vector<int32_t> listElementHalfUV(16);// preallocate at 16..
for (int32_t iii=0; iii<m_listFaces.Size() ; iii++) { for (int32_t iii=0; iii<m_listFaces.Size() ; iii++) {
vec3 centerPoint; vec3 centerPoint;
vec2 centerTex; vec2 centerTex;
if (3==m_listFaces[iii].m_nbElement) { if (3==m_listFaces[iii].m_nbElement) {
// create the center point: // create the center point:
centerPoint = ( m_listVertex[m_listFaces[iii].m_vertex[0]] centerPoint = ( m_listVertex[m_listFaces[iii].m_vertex[0]]
+ m_listVertex[m_listFaces[iii].m_vertex[1]] + m_listVertex[m_listFaces[iii].m_vertex[1]]
+ m_listVertex[m_listFaces[iii].m_vertex[2]] ) / vec3(3,3,3); + m_listVertex[m_listFaces[iii].m_vertex[2]] ) / vec3(3,3,3);
// create the center Texture coord: // create the center Texture coord:
centerTex = ( listUV[m_listFaces[iii].m_uv[0]] centerTex = ( listUV[m_listFaces[iii].m_uv[0]]
+ listUV[m_listFaces[iii].m_uv[1]] + listUV[m_listFaces[iii].m_uv[1]]
+ listUV[m_listFaces[iii].m_uv[2]] ) / vec2(3,3); + listUV[m_listFaces[iii].m_uv[2]] ) / vec2(3,3);
/* /*
o o o o
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ ==> o.. ..o / \ ==> o.. ..o
/ \ / ''o'' \ / \ / ''o'' \
/ \ / | \ / \ / | \
/ \ / | \ / \ / | \
/ \ / | \ / \ / | \
o-------------------o o---------o---------o o-------------------o o---------o---------o
*/ */
} else { } else {
// create the center point: // create the center point:
centerPoint = ( m_listVertex[m_listFaces[iii].m_vertex[0]] centerPoint = ( m_listVertex[m_listFaces[iii].m_vertex[0]]
+ m_listVertex[m_listFaces[iii].m_vertex[1]] + m_listVertex[m_listFaces[iii].m_vertex[1]]
+ m_listVertex[m_listFaces[iii].m_vertex[2]] + m_listVertex[m_listFaces[iii].m_vertex[2]]
+ m_listVertex[m_listFaces[iii].m_vertex[3]] ) / vec3(4,4,4); + m_listVertex[m_listFaces[iii].m_vertex[3]] ) / vec3(4,4,4);
// create the center Texture coord: // create the center Texture coord:
centerTex = ( listUV[m_listFaces[iii].m_uv[0]] centerTex = ( listUV[m_listFaces[iii].m_uv[0]]
+ listUV[m_listFaces[iii].m_uv[1]] + listUV[m_listFaces[iii].m_uv[1]]
+ listUV[m_listFaces[iii].m_uv[2]] + listUV[m_listFaces[iii].m_uv[2]]
+ listUV[m_listFaces[iii].m_uv[3]] ) / vec2(4,4); + listUV[m_listFaces[iii].m_uv[3]] ) / vec2(4,4);
/* /*
o---------------------o o----------o----------o o---------------------o o----------o----------o
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | ==> o----------o----------o | | ==> o----------o----------o
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
o---------------------o o----------o----------o o---------------------o o----------o----------o
*/ */
}
int32_t newCenterVertexID = CreateOrGetNewPointId(centerPoint, listVertex);
int32_t newCenterTexID = CreateOrGetNewTexId(centerTex, listUV);
listElementHalfPoint.Clear();
listElementHalfUV.Clear();
// generate list f the forder elements
for (int32_t jjj=0; jjj<m_listFaces[iii].m_nbElement ; jjj++) {
// for the last element finding at the good position...
int32_t cyclicID = (jjj+1) % m_listFaces[iii].m_nbElement;
listElementHalfPoint.PushBack(m_listFaces[iii].m_vertex[jjj]);
listElementHalfUV.PushBack(m_listFaces[iii].m_uv[jjj]);
// calculate and add middle point :
vec3 middlePoint = ( m_listVertex[m_listFaces[iii].m_vertex[jjj]]
+ m_listVertex[m_listFaces[iii].m_vertex[cyclicID]] ) / 2.0f;
int32_t newMiddleVertexID = CreateOrGetNewPointId(middlePoint, listVertex);
listElementHalfPoint.PushBack(newMiddleVertexID);
// create the center Texture coord:
vec2 middleTex = ( listUV[m_listFaces[iii].m_uv[jjj]]
+ listUV[m_listFaces[iii].m_uv[cyclicID]]) / 2.0f;
int32_t newMiddleTexID = CreateOrGetNewTexId(middleTex, listUV);
listElementHalfUV.PushBack(newMiddleTexID);
}
// generate faces:
for (int32_t jjj=0; jjj<listElementHalfPoint.Size() ; jjj+=2) {
int32_t cyclicID = (jjj-1 + listElementHalfPoint.Size()) % listElementHalfPoint.Size();
listFaces.PushBack(Face(listElementHalfPoint[jjj], listElementHalfUV[jjj],
listElementHalfPoint[jjj+1], listElementHalfUV[jjj+1],
newCenterVertexID, newCenterTexID,
listElementHalfPoint[cyclicID], listElementHalfUV[cyclicID]) );
}
} }
// copy all the element in the internal structure :
m_listVertex = listVertex;
m_listUV = listUV;
m_listFaces = listFaces;
} else {
// smooth mode
//Copy the mesh for modify this one and not his parrent (that one is needed for smoothing)
etk::Vector<VertexNode*> listVertex;
for(int32_t iii=0; iii<m_listVertex.Size(); iii++) {
VertexNode* tmpElement = new VertexNode(VERTEX_OLD, m_listVertex[iii]);
listVertex.PushBack(tmpElement);
}
etk::Vector<vec2> listUV(m_listUV);
etk::Vector<Face> listFaces; // no face here ...
etk::Vector<int32_t> listElementHalfPoint(16);// preallocate at 16..
etk::Vector<int32_t> listElementHalfUV(16);// preallocate at 16..
for (int32_t iii=0; iii<m_listFaces.Size() ; iii++) { int32_t newCenterVertexID = CreateOrGetNewPointId(VERTEX_CENTER_FACE, centerPoint, listVertex);
vec3 centerPoint; int32_t newCenterTexID = CreateOrGetNewTexId(centerTex, listUV);
vec2 centerTex;
if (3==m_listFaces[iii].m_nbElement) {
// create the center point:
centerPoint = ( m_listVertex[m_listFaces[iii].m_vertex[0]]
+ m_listVertex[m_listFaces[iii].m_vertex[1]]
+ m_listVertex[m_listFaces[iii].m_vertex[2]] ) / vec3(3,3,3);
// create the center Texture coord:
centerTex = ( listUV[m_listFaces[iii].m_uv[0]]
+ listUV[m_listFaces[iii].m_uv[1]]
+ listUV[m_listFaces[iii].m_uv[2]] ) / vec2(3,3);
/*
o o listElementHalfPoint.Clear();
/ \ / \ listElementHalfUV.Clear();
/ \ / \ // generate list f the forder elements
/ \ / \ for (int32_t jjj=0; jjj<m_listFaces[iii].m_nbElement ; jjj++) {
/ \ / \ // for the last element finding at the good position...
/ \ ==> o.. ..o int32_t cyclicID = (jjj+1) % m_listFaces[iii].m_nbElement;
/ \ / ''o'' \
/ \ / | \
/ \ / | \
/ \ / | \
o-------------------o o---------o---------o
*/ listElementHalfPoint.PushBack(m_listFaces[iii].m_vertex[jjj]);
} else { listElementHalfUV.PushBack(m_listFaces[iii].m_uv[jjj]);
// create the center point: // calculate and add middle point :
centerPoint = ( m_listVertex[m_listFaces[iii].m_vertex[0]] vec3 middlePoint = ( m_listVertex[m_listFaces[iii].m_vertex[jjj]]
+ m_listVertex[m_listFaces[iii].m_vertex[1]] + m_listVertex[m_listFaces[iii].m_vertex[cyclicID]] ) / 2.0f;
+ m_listVertex[m_listFaces[iii].m_vertex[2]] int32_t newMiddleVertexID = CreateOrGetNewPointId(VERTEX_CERTER_EDGE, middlePoint, listVertex);
+ m_listVertex[m_listFaces[iii].m_vertex[3]] ) / vec3(4,4,4); if (true==smooth) {
// create the center Texture coord:
centerTex = ( listUV[m_listFaces[iii].m_uv[0]]
+ listUV[m_listFaces[iii].m_uv[1]]
+ listUV[m_listFaces[iii].m_uv[2]]
+ listUV[m_listFaces[iii].m_uv[3]] ) / vec2(4,4);
/*
o---------------------o o----------o----------o
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | ==> o----------o----------o
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
o---------------------o o----------o----------o
*/
}
int32_t newCenterVertexID = CreateOrGetNewPointId2(VERTEX_CENTER_FACE, centerPoint, listVertex);
int32_t newCenterTexID = CreateOrGetNewTexId(centerTex, listUV);
listElementHalfPoint.Clear();
listElementHalfUV.Clear();
// generate list f the forder elements
for (int32_t jjj=0; jjj<m_listFaces[iii].m_nbElement ; jjj++) {
// for the last element finding at the good position...
int32_t cyclicID = (jjj+1) % m_listFaces[iii].m_nbElement;
listElementHalfPoint.PushBack(m_listFaces[iii].m_vertex[jjj]);
listElementHalfUV.PushBack(m_listFaces[iii].m_uv[jjj]);
// calculate and add middle point :
vec3 middlePoint = ( m_listVertex[m_listFaces[iii].m_vertex[jjj]]
+ m_listVertex[m_listFaces[iii].m_vertex[cyclicID]] ) / 2.0f;
int32_t newMiddleVertexID = CreateOrGetNewPointId2(VERTEX_CERTER_EDGE, middlePoint, listVertex);
// add center : at the middle point // add center : at the middle point
listVertex[newMiddleVertexID]->AddLink(newCenterVertexID); listVertex[newMiddleVertexID]->AddLink(newCenterVertexID);
// add center of edge end face at the old element point : // add center of edge end face at the old element point :
@ -518,24 +405,26 @@ void ewol::Mesh::InternalSubdivide(bool smooth)
listVertex[m_listFaces[iii].m_vertex[jjj]]->AddLink(newMiddleVertexID); listVertex[m_listFaces[iii].m_vertex[jjj]]->AddLink(newMiddleVertexID);
listVertex[m_listFaces[iii].m_vertex[cyclicID]]->AddLink(newCenterVertexID); listVertex[m_listFaces[iii].m_vertex[cyclicID]]->AddLink(newCenterVertexID);
listVertex[m_listFaces[iii].m_vertex[cyclicID]]->AddLink(newMiddleVertexID); listVertex[m_listFaces[iii].m_vertex[cyclicID]]->AddLink(newMiddleVertexID);
// list of all middle point to recontitute the faces
listElementHalfPoint.PushBack(newMiddleVertexID);
// create the center Texture coord:
vec2 middleTex = ( listUV[m_listFaces[iii].m_uv[jjj]]
+ listUV[m_listFaces[iii].m_uv[cyclicID]]) / 2.0f;
int32_t newMiddleTexID = CreateOrGetNewTexId(middleTex, listUV);
listElementHalfUV.PushBack(newMiddleTexID);
}
// generate faces:
//EWOL_DEBUG(" ==> Generatedd faces");
for (int32_t jjj=0; jjj<listElementHalfPoint.Size() ; jjj+=2) {
int32_t cyclicID = (jjj-1 + listElementHalfPoint.Size()) % listElementHalfPoint.Size();
listFaces.PushBack(Face(listElementHalfPoint[jjj], listElementHalfUV[jjj],
listElementHalfPoint[jjj+1], listElementHalfUV[jjj+1],
newCenterVertexID, newCenterTexID,
listElementHalfPoint[cyclicID], listElementHalfUV[cyclicID]) );
} }
// list of all middle point to recontitute the faces
listElementHalfPoint.PushBack(newMiddleVertexID);
// create the center Texture coord:
vec2 middleTex = ( listUV[m_listFaces[iii].m_uv[jjj]]
+ listUV[m_listFaces[iii].m_uv[cyclicID]]) / 2.0f;
int32_t newMiddleTexID = CreateOrGetNewTexId(middleTex, listUV);
listElementHalfUV.PushBack(newMiddleTexID);
} }
// generate faces:
//EWOL_DEBUG(" ==> Generatedd faces");
for (int32_t jjj=0; jjj<listElementHalfPoint.Size() ; jjj+=2) {
int32_t cyclicID = (jjj-1 + listElementHalfPoint.Size()) % listElementHalfPoint.Size();
listFaces.PushBack(Face(listElementHalfPoint[jjj], listElementHalfUV[jjj],
listElementHalfPoint[jjj+1], listElementHalfUV[jjj+1],
newCenterVertexID, newCenterTexID,
listElementHalfPoint[cyclicID], listElementHalfUV[cyclicID]) );
}
}
if (true==smooth) {
EWOL_DEBUG(" ==> Update middle edge points position"); EWOL_DEBUG(" ==> Update middle edge points position");
// reposition the Middle point of the edge // reposition the Middle point of the edge
for(int32_t iii=0; iii<listVertex.Size(); iii++) { for(int32_t iii=0; iii<listVertex.Size(); iii++) {
@ -623,18 +512,18 @@ void ewol::Mesh::InternalSubdivide(bool smooth)
} }
} }
} }
EWOL_DEBUG(" ==> Back to the normal list of element:");
// copy all the element in the internal structure :
m_listUV = listUV;
m_listFaces = listFaces;
m_listVertex.Clear();
for(int32_t iii=0; iii<listVertex.Size(); iii++) {
if (NULL != listVertex[iii]) {
m_listVertex.PushBack(listVertex[iii]->GetPos());
delete(listVertex[iii]);
listVertex[iii] = NULL;
}
}
listVertex.Clear();
} }
//EWOL_DEBUG(" ==> Back to the normal list of element:");
// copy all the element in the internal structure :
m_listUV = listUV;
m_listFaces = listFaces;
m_listVertex.Clear();
for(int32_t iii=0; iii<listVertex.Size(); iii++) {
if (NULL != listVertex[iii]) {
m_listVertex.PushBack(listVertex[iii]->GetPos());
delete(listVertex[iii]);
listVertex[iii] = NULL;
}
}
listVertex.Clear();
} }

View File

@ -88,14 +88,14 @@ bool widget::SizerHori::CalculateMinSize(void)
m_userExpend.setY(true); m_userExpend.setY(true);
} }
vec2 tmpSize = m_subWidget[iii]->GetMinSize(); vec2 tmpSize = m_subWidget[iii]->GetMinSize();
//EWOL_DEBUG("HORI : NewMinSize=" << tmpSize);
m_minSize.setX(m_minSize.x() + tmpSize.x()); m_minSize.setX(m_minSize.x() + tmpSize.x());
if (tmpSize.y()>m_minSize.y()) { if (tmpSize.y()>m_minSize.y()) {
m_minSize.setY(tmpSize.y()); m_minSize.setY(tmpSize.y());
} }
} }
} }
//EWOL_DEBUG("Result : expend X="<< m_userExpend.x << " Y=" << m_userExpend.y); //EWOL_DEBUG("Hori Result : expend="<< m_userExpend << " minSize="<< m_minSize);
//EWOL_DEBUG(" minSize ("<< m_minSize.x << "," << m_minSize.y << ")");
return true; return true;
} }

View File

@ -91,6 +91,7 @@ bool widget::SizerVert::CalculateMinSize(void)
m_userExpend.setY(true); m_userExpend.setY(true);
} }
vec2 tmpSize = m_subWidget[iii]->GetMinSize(); vec2 tmpSize = m_subWidget[iii]->GetMinSize();
//EWOL_DEBUG("VERT : NewMinSize=" << tmpSize);
//EWOL_DEBUG(" Get minSize[" << iii << "] ("<< tmpSize.x << "," << tmpSize.y << ")"); //EWOL_DEBUG(" Get minSize[" << iii << "] ("<< tmpSize.x << "," << tmpSize.y << ")");
m_minSize.setY(m_minSize.y() + tmpSize.y()); m_minSize.setY(m_minSize.y() + tmpSize.y());
if (tmpSize.x()>m_minSize.x()) { if (tmpSize.x()>m_minSize.x()) {
@ -98,8 +99,7 @@ bool widget::SizerVert::CalculateMinSize(void)
} }
} }
} }
//EWOL_DEBUG("Result : expend X="<< m_userExpend.x << " Y=" << m_userExpend.y); //EWOL_DEBUG("Vert Result : expend="<< m_userExpend << " minSize="<< m_minSize);
//EWOL_DEBUG(" minSize ("<< m_minSize.x << "," << m_minSize.y << ")");
return true; return true;
} }

View File

@ -21,7 +21,7 @@ namespace widget {
virtual ~SizerVert(void); virtual ~SizerVert(void);
void LockExpendContamination(bool lockExpend=false); void LockExpendContamination(bool lockExpend=false);
private: private:
bool m_lockExpendContamination; bool m_lockExpendContamination;
etk::Vector<ewol::Widget*> m_subWidget; etk::Vector<ewol::Widget*> m_subWidget;
public: public:
virtual void SubWidgetRemoveAll(void); virtual void SubWidgetRemoveAll(void);