[DEBUG] corect windws compilation and missed init in the shaper tool
This commit is contained in:
parent
2794b6e18f
commit
71af7fe7d2
@ -35,6 +35,10 @@ ewol::Shaper::Shaper(etk::UString shaperName) :
|
||||
m_resourceTexture(NULL),
|
||||
m_nextStatusRequested(-1),
|
||||
m_time(-1),
|
||||
m_propertyOrigin(0,0),
|
||||
m_propertySize(0,0),
|
||||
m_propertyInsidePosition(0,0),
|
||||
m_propertyInsideSize(0,0),
|
||||
m_stateOld(0),
|
||||
m_stateNew(0),
|
||||
m_stateTransition(1.0)
|
||||
@ -250,7 +254,7 @@ void ewol::Shaper::SetInsidePos(vec2 newInsidePos)
|
||||
|
||||
vec2 ewol::Shaper::GetPadding(void)
|
||||
{
|
||||
vec2 padding;
|
||||
vec2 padding(0,0);
|
||||
if (m_config!=NULL) {
|
||||
padding.setValue(m_config->GetFloat(m_confIdPaddingX),
|
||||
m_config->GetFloat(m_confIdPaddingY));
|
||||
|
@ -46,16 +46,16 @@ namespace ewol
|
||||
// For the Image :
|
||||
ewol::TextureFile* m_resourceTexture; //!< texture resources (for the image)
|
||||
// internal needed data :
|
||||
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)
|
||||
vec2 m_propertyOrigin; //!< widget origin
|
||||
vec2 m_propertySize; //!< widget size
|
||||
vec2 m_propertyInsidePosition; //!< internal subwidget position
|
||||
vec2 m_propertyInsideSize; //!< internal subwidget size
|
||||
int32_t m_stateOld; //!< previous state
|
||||
int32_t m_stateNew; //!< destination state
|
||||
float m_stateTransition; //!< working state between 2 states
|
||||
vec2 m_coord[6]; //!< the double triangle coordonates
|
||||
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)
|
||||
vec2 m_propertyOrigin; //!< widget origin
|
||||
vec2 m_propertySize; //!< widget size
|
||||
vec2 m_propertyInsidePosition; //!< internal subwidget position
|
||||
vec2 m_propertyInsideSize; //!< internal subwidget size
|
||||
int32_t m_stateOld; //!< previous state
|
||||
int32_t m_stateNew; //!< destination state
|
||||
float m_stateTransition; //!< working state between 2 states
|
||||
vec2 m_coord[6]; //!< the double triangle coordonates
|
||||
private:
|
||||
/**
|
||||
* @brief Load the openGL program and get all the ID needed
|
||||
|
@ -82,11 +82,11 @@ namespace ewol
|
||||
int32_t m_selectionStartPos; //!< start position of the Selection (if == m_cursorPos ==> no selection)
|
||||
int32_t m_cursorPos; //!< Cursor position (default no cursor ==> -100)
|
||||
private:
|
||||
ewol::TexturedFont* m_font; //!< Font resources
|
||||
ewol::TexturedFont* m_font; //!< Font resources
|
||||
private: // Text
|
||||
etk::Vector<vec2 > m_coord; //!< internal coord of the object
|
||||
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<vec2 > m_coord; //!< internal coord of the object
|
||||
etk::Vector<vec2 > m_coordTex; //!< internal texture coordinate for every point
|
||||
etk::Vector<draw::Colorf> m_coordColor; //!< internal color of the different point
|
||||
private:
|
||||
/**
|
||||
* @brief Load the openGL program and get all the ID needed
|
||||
|
@ -74,8 +74,8 @@ void guiInterface::ChangeSize(ivec2 size)
|
||||
{
|
||||
int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME);
|
||||
int title_size = GetSystemMetrics(SM_CYCAPTION);
|
||||
size.x += border_thickness*2;
|
||||
size.y += border_thickness*2 + title_size;
|
||||
size.setValue(size.x() + border_thickness*2,
|
||||
size.y() + border_thickness*2 + title_size);
|
||||
//m_currentHeight = size.y;
|
||||
// TODO : Later
|
||||
}
|
||||
@ -88,8 +88,7 @@ void guiInterface::ChangePos(ivec2 pos)
|
||||
void guiInterface::GetAbsPos(ivec2& size)
|
||||
{
|
||||
// TODO : Later
|
||||
size.x = 0;
|
||||
size.y = 0;
|
||||
size.setValue(0,0);
|
||||
}
|
||||
|
||||
|
||||
@ -433,30 +432,30 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
buttonIsDown = false;
|
||||
case WM_LBUTTONDOWN:
|
||||
mouseButtonId = 1;
|
||||
pos.x = GET_X_LPARAM(lParam);
|
||||
pos.y = m_currentHeight-GET_Y_LPARAM(lParam);
|
||||
pos.setValue(GET_X_LPARAM(lParam),
|
||||
m_currentHeight-GET_Y_LPARAM(lParam));
|
||||
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;
|
||||
|
||||
case WM_MBUTTONUP:
|
||||
buttonIsDown = false;
|
||||
case WM_MBUTTONDOWN:
|
||||
mouseButtonId = 2;
|
||||
pos.x = GET_X_LPARAM(lParam);
|
||||
pos.y = m_currentHeight-GET_Y_LPARAM(lParam);
|
||||
pos.setValue(GET_X_LPARAM(lParam),
|
||||
m_currentHeight-GET_Y_LPARAM(lParam));
|
||||
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;
|
||||
|
||||
case WM_RBUTTONUP:
|
||||
buttonIsDown = false;
|
||||
case WM_RBUTTONDOWN:
|
||||
mouseButtonId = 3;
|
||||
pos.x = GET_X_LPARAM(lParam);
|
||||
pos.y = m_currentHeight-GET_Y_LPARAM(lParam);
|
||||
pos.setValue(GET_X_LPARAM(lParam),
|
||||
m_currentHeight-GET_Y_LPARAM(lParam));
|
||||
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;
|
||||
|
||||
case WM_MOUSEWHEEL:
|
||||
@ -467,25 +466,25 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
EWOL_DEBUG("event SCROOL DOWN");
|
||||
mouseButtonId = 5;
|
||||
}
|
||||
pos.x = GET_X_LPARAM(lParam);
|
||||
pos.y = m_currentHeight-GET_Y_LPARAM(lParam);
|
||||
eSystem::SetMouseState(mouseButtonId, true, (float)pos.x, (float)pos.y);
|
||||
eSystem::SetMouseState(mouseButtonId, false, (float)pos.x, (float)pos.y);
|
||||
pos.setValue(GET_X_LPARAM(lParam),
|
||||
m_currentHeight-GET_Y_LPARAM(lParam));
|
||||
eSystem::SetMouseState(mouseButtonId, true, (float)pos.x(), (float)pos.y());
|
||||
eSystem::SetMouseState(mouseButtonId, false, (float)pos.x(), (float)pos.y());
|
||||
return 0;
|
||||
|
||||
case WM_MOUSEHOVER:
|
||||
case WM_MOUSEMOVE:
|
||||
pos.x = GET_X_LPARAM(lParam);
|
||||
pos.y = m_currentHeight-GET_Y_LPARAM(lParam);
|
||||
pos.setValue(GET_X_LPARAM(lParam),
|
||||
m_currentHeight-GET_Y_LPARAM(lParam));
|
||||
for (int32_t iii=0; iii<NB_MAX_INPUT ; iii++) {
|
||||
if (true == inputIsPressed[iii]) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
default:
|
||||
|
@ -285,18 +285,7 @@ void ewol::Mesh::Subdivide(int32_t numberOfTime, bool smooth)
|
||||
}
|
||||
}
|
||||
|
||||
int32_t CreateOrGetNewPointId(const vec3& point, etk::Vector<vec3>& 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)
|
||||
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]->GetPos() == point) {
|
||||
@ -324,193 +313,91 @@ int32_t CreateOrGetNewTexId(const vec2& point, etk::Vector<vec2>& list)
|
||||
|
||||
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)
|
||||
etk::Vector<vec3> listVertex(m_listVertex);
|
||||
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++) {
|
||||
vec3 centerPoint;
|
||||
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
|
||||
/ \ / \
|
||||
/ \ / \
|
||||
/ \ / \
|
||||
/ \ / \
|
||||
/ \ ==> o.. ..o
|
||||
/ \ / ''o'' \
|
||||
/ \ / | \
|
||||
/ \ / | \
|
||||
/ \ / | \
|
||||
o-------------------o o---------o---------o
|
||||
|
||||
*/
|
||||
} else {
|
||||
// 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]]
|
||||
+ m_listVertex[m_listFaces[iii].m_vertex[3]] ) / vec3(4,4,4);
|
||||
// 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 = 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 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++) {
|
||||
vec3 centerPoint;
|
||||
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
|
||||
/ \ / \
|
||||
/ \ / \
|
||||
/ \ / \
|
||||
/ \ / \
|
||||
/ \ ==> o.. ..o
|
||||
/ \ / ''o'' \
|
||||
/ \ / | \
|
||||
/ \ / | \
|
||||
/ \ / | \
|
||||
o-------------------o o---------o---------o
|
||||
|
||||
*/
|
||||
} else {
|
||||
// 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]]
|
||||
+ m_listVertex[m_listFaces[iii].m_vertex[3]] ) / vec3(4,4,4);
|
||||
// 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
|
||||
|
||||
*/
|
||||
}
|
||||
// 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++) {
|
||||
vec3 centerPoint;
|
||||
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
|
||||
/ \ / \
|
||||
/ \ / \
|
||||
/ \ / \
|
||||
/ \ / \
|
||||
/ \ ==> o.. ..o
|
||||
/ \ / ''o'' \
|
||||
/ \ / | \
|
||||
/ \ / | \
|
||||
/ \ / | \
|
||||
o-------------------o o---------o---------o
|
||||
|
||||
*/
|
||||
} else {
|
||||
// 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]]
|
||||
+ m_listVertex[m_listFaces[iii].m_vertex[3]] ) / vec3(4,4,4);
|
||||
// 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 = CreateOrGetNewPointId(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;
|
||||
|
||||
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);
|
||||
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(VERTEX_CERTER_EDGE, middlePoint, listVertex);
|
||||
if (true==smooth) {
|
||||
// add center : at the middle point
|
||||
listVertex[newMiddleVertexID]->AddLink(newCenterVertexID);
|
||||
// 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[cyclicID]]->AddLink(newCenterVertexID);
|
||||
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");
|
||||
// reposition the Middle point of the edge
|
||||
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();
|
||||
}
|
||||
|
@ -88,14 +88,14 @@ bool widget::SizerHori::CalculateMinSize(void)
|
||||
m_userExpend.setY(true);
|
||||
}
|
||||
vec2 tmpSize = m_subWidget[iii]->GetMinSize();
|
||||
//EWOL_DEBUG("HORI : NewMinSize=" << tmpSize);
|
||||
m_minSize.setX(m_minSize.x() + tmpSize.x());
|
||||
if (tmpSize.y()>m_minSize.y()) {
|
||||
m_minSize.setY(tmpSize.y());
|
||||
}
|
||||
}
|
||||
}
|
||||
//EWOL_DEBUG("Result : expend X="<< m_userExpend.x << " Y=" << m_userExpend.y);
|
||||
//EWOL_DEBUG(" minSize ("<< m_minSize.x << "," << m_minSize.y << ")");
|
||||
//EWOL_DEBUG("Hori Result : expend="<< m_userExpend << " minSize="<< m_minSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -91,6 +91,7 @@ bool widget::SizerVert::CalculateMinSize(void)
|
||||
m_userExpend.setY(true);
|
||||
}
|
||||
vec2 tmpSize = m_subWidget[iii]->GetMinSize();
|
||||
//EWOL_DEBUG("VERT : NewMinSize=" << tmpSize);
|
||||
//EWOL_DEBUG(" Get minSize[" << iii << "] ("<< tmpSize.x << "," << tmpSize.y << ")");
|
||||
m_minSize.setY(m_minSize.y() + tmpSize.y());
|
||||
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(" minSize ("<< m_minSize.x << "," << m_minSize.y << ")");
|
||||
//EWOL_DEBUG("Vert Result : expend="<< m_userExpend << " minSize="<< m_minSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ namespace widget {
|
||||
virtual ~SizerVert(void);
|
||||
void LockExpendContamination(bool lockExpend=false);
|
||||
private:
|
||||
bool m_lockExpendContamination;
|
||||
bool m_lockExpendContamination;
|
||||
etk::Vector<ewol::Widget*> m_subWidget;
|
||||
public:
|
||||
virtual void SubWidgetRemoveAll(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user