[DEV] multiple texture availlable and better mesh
This commit is contained in:
parent
c56289dbfd
commit
a602665e10
@ -5,6 +5,7 @@ precision mediump int;
|
||||
// Input :
|
||||
attribute vec3 EW_coord3d;
|
||||
attribute vec2 EW_texture2d;
|
||||
attribute vec3 EW_normal;
|
||||
uniform mat4 EW_MatrixTransformation;
|
||||
|
||||
// output :
|
||||
|
2
external/etk
vendored
2
external/etk
vendored
@ -1 +1 @@
|
||||
Subproject commit 79fdf1119cf3edf34d842ff26a840c2677adbdfa
|
||||
Subproject commit b99cabc6932dd7a00d3a17a286ef8b62a0d9e57e
|
@ -149,7 +149,7 @@ void ewol::resource::ContextHasBeenDestroyed(void)
|
||||
|
||||
|
||||
// internal generic keeper ...
|
||||
static ewol::Resource* LocalKeep(const etk::UString& filename)
|
||||
ewol::Resource* ewol::resource::LocalKeep(const etk::UString& filename)
|
||||
{
|
||||
EWOL_VERBOSE("KEEP (DEFAULT) : file : \"" << filename << "\"");
|
||||
for (int32_t iii=0; iii<l_resourceList.Size(); iii++) {
|
||||
@ -165,7 +165,7 @@ static ewol::Resource* LocalKeep(const etk::UString& filename)
|
||||
}
|
||||
|
||||
// internal generic keeper ...
|
||||
static void LocalAdd(ewol::Resource* object)
|
||||
void ewol::resource::LocalAdd(ewol::Resource* object)
|
||||
{
|
||||
//Add ... find empty slot
|
||||
for (int32_t iii=0; iii<l_resourceList.Size(); iii++) {
|
||||
|
@ -57,6 +57,10 @@ namespace ewol
|
||||
*/
|
||||
void ContextHasBeenDestroyed(void);
|
||||
|
||||
// internal API to extent eResources in extern Soft
|
||||
ewol::Resource* LocalKeep(const etk::UString& filename);
|
||||
void LocalAdd(ewol::Resource* object);
|
||||
|
||||
/**
|
||||
* @brief Load the specify resources type
|
||||
* @param[in] filename The filename of the resources
|
||||
|
@ -57,31 +57,22 @@ class VertexNode {
|
||||
};
|
||||
|
||||
|
||||
// 3 "float" elements
|
||||
#define MESH_VBO_VERTICES (0)
|
||||
// 2 "float" elements
|
||||
#define MESH_VBO_TEXTURE (1)
|
||||
// 4 "float" elements
|
||||
#define MESH_VBO_COLOR (2)
|
||||
// 3 "float" elements
|
||||
#define MESH_VBO_NORMAL (3)
|
||||
|
||||
|
||||
ewol::Mesh::Mesh(etk::UString genName) :
|
||||
ewol::Mesh::Mesh(etk::UString genName, etk::UString shaderName) :
|
||||
ewol::Resource(genName),
|
||||
m_enableFaceNormal(false),
|
||||
m_enableVertexNormal(false),
|
||||
m_enableVertexNormal(true),
|
||||
m_numberOfElments(0),
|
||||
m_texture1(NULL)
|
||||
m_texture0(NULL)
|
||||
{
|
||||
etk::UString tmpString("DATA:textured3D2.prog");
|
||||
// get the shader resource :
|
||||
m_GLPosition = 0;
|
||||
if (true == ewol::resource::Keep(tmpString, m_GLprogram) ) {
|
||||
if (true == ewol::resource::Keep(shaderName, m_GLprogram) ) {
|
||||
m_GLPosition = m_GLprogram->GetAttribute("EW_coord3d");
|
||||
m_GLtexture = m_GLprogram->GetAttribute("EW_texture2d");
|
||||
m_GLNormal = m_GLprogram->GetAttribute("EW_normal");
|
||||
m_GLMatrix = m_GLprogram->GetUniform("EW_MatrixTransformation");
|
||||
m_GLtexID = m_GLprogram->GetUniform("EW_texID");
|
||||
m_GLtexID0 = m_GLprogram->GetUniform("EW_texID");
|
||||
}
|
||||
// this is the properties of the buffer requested : "r"/"w" + "-" + buffer type "f"=flaot "i"=integer
|
||||
ewol::resource::Keep("w-fff", m_verticesVBO);
|
||||
@ -90,8 +81,8 @@ ewol::Mesh::Mesh(etk::UString genName) :
|
||||
ewol::Mesh::~Mesh(void)
|
||||
{
|
||||
// remove dynamics dependencies :
|
||||
if(NULL!=m_texture1) {
|
||||
ewol::resource::Release(m_texture1);
|
||||
if(NULL!=m_texture0) {
|
||||
ewol::resource::Release(m_texture0);
|
||||
}
|
||||
ewol::resource::Release(m_GLprogram);
|
||||
ewol::resource::Release(m_verticesVBO);
|
||||
@ -104,7 +95,7 @@ void ewol::Mesh::Draw(mat4& positionMatrix)
|
||||
if (m_numberOfElments<=0) {
|
||||
return;
|
||||
}
|
||||
if (NULL == m_texture1) {
|
||||
if (NULL == m_texture0) {
|
||||
EWOL_WARNING("Texture does not exist ...");
|
||||
return;
|
||||
}
|
||||
@ -121,17 +112,20 @@ void ewol::Mesh::Draw(mat4& positionMatrix)
|
||||
mat4 tmpMatrix = projMatrix * camMatrix * positionMatrix;
|
||||
m_GLprogram->UniformMatrix4fv(m_GLMatrix, 1, tmpMatrix.m_mat);
|
||||
// TextureID
|
||||
m_GLprogram->SetTexture0(m_GLtexID, m_texture1->GetId());
|
||||
m_GLprogram->SetTexture0(m_GLtexID0, m_texture0->GetId());
|
||||
// position :
|
||||
m_GLprogram->SendAttributePointer(m_GLPosition, 3/*x,y,z*/, m_verticesVBO, MESH_VBO_VERTICES);
|
||||
// Texture :
|
||||
m_GLprogram->SendAttributePointer(m_GLtexture, 2/*u,v*/, m_verticesVBO, MESH_VBO_TEXTURE);
|
||||
// position :
|
||||
m_GLprogram->SendAttributePointer(m_GLNormal, 3/*x,y,z*/, m_verticesVBO, MESH_VBO_VERTICES_NORMAL);
|
||||
// Request the draw od the elements :
|
||||
glDrawArrays(GL_TRIANGLES, 0, m_numberOfElments);
|
||||
m_GLprogram->UnUse();
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glBindBuffer(GL_ARRAY_BUFFER,0);
|
||||
}
|
||||
|
||||
// normal calculation of the normal face is really easy :
|
||||
void ewol::Mesh::CalculateNormaleFace(void)
|
||||
{
|
||||
@ -194,59 +188,53 @@ void ewol::Mesh::GenerateVBO(void)
|
||||
#endif
|
||||
// 2 possibilities : triangle or quad :
|
||||
int32_t indice = 0;
|
||||
vec3 tmpPos = m_listVertex[m_listFaces[iii].m_vertex[indice]];
|
||||
vec2 tmpUV = m_listUV[m_listFaces[iii].m_uv[indice]];
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_VERTICES).PushBack(tmpPos.x());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_VERTICES).PushBack(tmpPos.y());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_VERTICES).PushBack(tmpPos.z());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_TEXTURE).PushBack(tmpUV.x());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_TEXTURE).PushBack(1.0f-tmpUV.y());
|
||||
m_verticesVBO->PushOnBuffer(MESH_VBO_VERTICES,m_listVertex[m_listFaces[iii].m_vertex[indice]]);
|
||||
m_verticesVBO->PushOnBuffer(MESH_VBO_TEXTURE, vec2(tmpUV.x(),1.0f-tmpUV.y()));
|
||||
if(true==m_enableVertexNormal) {
|
||||
m_verticesVBO->PushOnBuffer(MESH_VBO_VERTICES_NORMAL,m_listVertexNormal[m_listFaces[iii].m_vertex[indice]]);
|
||||
}
|
||||
|
||||
indice = 1;
|
||||
tmpPos = m_listVertex[m_listFaces[iii].m_vertex[indice]];
|
||||
tmpUV = m_listUV[m_listFaces[iii].m_uv[indice]];
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_VERTICES).PushBack(tmpPos.x());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_VERTICES).PushBack(tmpPos.y());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_VERTICES).PushBack(tmpPos.z());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_TEXTURE).PushBack(tmpUV.x());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_TEXTURE).PushBack(1.0f-tmpUV.y());
|
||||
m_verticesVBO->PushOnBuffer(MESH_VBO_VERTICES,m_listVertex[m_listFaces[iii].m_vertex[indice]]);
|
||||
m_verticesVBO->PushOnBuffer(MESH_VBO_TEXTURE, vec2(tmpUV.x(),1.0f-tmpUV.y()));
|
||||
if(true==m_enableVertexNormal) {
|
||||
m_verticesVBO->PushOnBuffer(MESH_VBO_VERTICES_NORMAL,m_listVertexNormal[m_listFaces[iii].m_vertex[indice]]);
|
||||
}
|
||||
|
||||
indice = 2;
|
||||
tmpPos = m_listVertex[m_listFaces[iii].m_vertex[indice]];
|
||||
tmpUV = m_listUV[m_listFaces[iii].m_uv[indice]];
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_VERTICES).PushBack(tmpPos.x());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_VERTICES).PushBack(tmpPos.y());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_VERTICES).PushBack(tmpPos.z());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_TEXTURE).PushBack(tmpUV.x());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_TEXTURE).PushBack(1.0f-tmpUV.y());
|
||||
m_verticesVBO->PushOnBuffer(MESH_VBO_VERTICES,m_listVertex[m_listFaces[iii].m_vertex[indice]]);
|
||||
m_verticesVBO->PushOnBuffer(MESH_VBO_TEXTURE, vec2(tmpUV.x(),1.0f-tmpUV.y()));
|
||||
if(true==m_enableVertexNormal) {
|
||||
m_verticesVBO->PushOnBuffer(MESH_VBO_VERTICES_NORMAL,m_listVertexNormal[m_listFaces[iii].m_vertex[indice]]);
|
||||
}
|
||||
#ifndef PRINT_HALF
|
||||
if (m_listFaces[iii].m_nbElement==4) {
|
||||
indice = 0;
|
||||
tmpPos = m_listVertex[m_listFaces[iii].m_vertex[indice]];
|
||||
tmpUV = m_listUV[m_listFaces[iii].m_uv[indice]];
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_VERTICES).PushBack(tmpPos.x());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_VERTICES).PushBack(tmpPos.y());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_VERTICES).PushBack(tmpPos.z());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_TEXTURE).PushBack(tmpUV.x());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_TEXTURE).PushBack(1.0f-tmpUV.y());
|
||||
m_verticesVBO->PushOnBuffer(MESH_VBO_VERTICES,m_listVertex[m_listFaces[iii].m_vertex[indice]]);
|
||||
m_verticesVBO->PushOnBuffer(MESH_VBO_TEXTURE, vec2(tmpUV.x(),1.0f-tmpUV.y()));
|
||||
if(true==m_enableVertexNormal) {
|
||||
m_verticesVBO->PushOnBuffer(MESH_VBO_VERTICES_NORMAL,m_listVertexNormal[m_listFaces[iii].m_vertex[indice]]);
|
||||
}
|
||||
|
||||
indice = 2;
|
||||
tmpPos = m_listVertex[m_listFaces[iii].m_vertex[indice]];
|
||||
tmpUV = m_listUV[m_listFaces[iii].m_uv[indice]];
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_VERTICES).PushBack(tmpPos.x());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_VERTICES).PushBack(tmpPos.y());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_VERTICES).PushBack(tmpPos.z());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_TEXTURE).PushBack(tmpUV.x());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_TEXTURE).PushBack(1.0f-tmpUV.y());
|
||||
m_verticesVBO->PushOnBuffer(MESH_VBO_VERTICES,m_listVertex[m_listFaces[iii].m_vertex[indice]]);
|
||||
m_verticesVBO->PushOnBuffer(MESH_VBO_TEXTURE, vec2(tmpUV.x(),1.0f-tmpUV.y()));
|
||||
if(true==m_enableVertexNormal) {
|
||||
m_verticesVBO->PushOnBuffer(MESH_VBO_VERTICES_NORMAL,m_listVertexNormal[m_listFaces[iii].m_vertex[indice]]);
|
||||
}
|
||||
|
||||
indice = 3;
|
||||
tmpPos = m_listVertex[m_listFaces[iii].m_vertex[indice]];
|
||||
tmpUV = m_listUV[m_listFaces[iii].m_uv[indice]];
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_VERTICES).PushBack(tmpPos.x());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_VERTICES).PushBack(tmpPos.y());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_VERTICES).PushBack(tmpPos.z());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_TEXTURE).PushBack(tmpUV.x());
|
||||
m_verticesVBO->GetRefBuffer(MESH_VBO_TEXTURE).PushBack(1.0f-tmpUV.y());
|
||||
m_verticesVBO->PushOnBuffer(MESH_VBO_VERTICES,m_listVertex[m_listFaces[iii].m_vertex[indice]]);
|
||||
m_verticesVBO->PushOnBuffer(MESH_VBO_TEXTURE, vec2(tmpUV.x(),1.0f-tmpUV.y()));
|
||||
if(true==m_enableVertexNormal) {
|
||||
m_verticesVBO->PushOnBuffer(MESH_VBO_VERTICES_NORMAL,m_listVertexNormal[m_listFaces[iii].m_vertex[indice]]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -313,12 +301,12 @@ void ewol::Mesh::SetTexture(const etk::UString& myTexture)
|
||||
{
|
||||
ivec2 tmpSize(256, 256);
|
||||
// prevent overloard error :
|
||||
ewol::TextureFile* tmpCopy = m_texture1;
|
||||
m_texture1 = NULL;
|
||||
if (false == ewol::resource::Keep(myTexture, m_texture1, tmpSize)) {
|
||||
ewol::TextureFile* tmpCopy = m_texture0;
|
||||
m_texture0 = NULL;
|
||||
if (false == ewol::resource::Keep(myTexture, m_texture0, tmpSize)) {
|
||||
EWOL_ERROR("Can not load specific texture : " << myTexture);
|
||||
// retreave previous texture:
|
||||
m_texture1 = tmpCopy;
|
||||
m_texture0 = tmpCopy;
|
||||
return;
|
||||
}
|
||||
if (NULL != tmpCopy) {
|
||||
|
@ -16,6 +16,15 @@
|
||||
#include <ewol/renderer/resources/Program.h>
|
||||
#include <ewol/renderer/resources/VirtualBufferObject.h>
|
||||
|
||||
// 3 "float" elements
|
||||
#define MESH_VBO_VERTICES (0)
|
||||
// 2 "float" elements
|
||||
#define MESH_VBO_TEXTURE (1)
|
||||
// 3 "float" elements
|
||||
#define MESH_VBO_VERTICES_NORMAL (2)
|
||||
// 4 "float" elements
|
||||
#define MESH_VBO_COLOR (3)
|
||||
|
||||
namespace ewol
|
||||
{
|
||||
class Face
|
||||
@ -63,8 +72,9 @@ namespace ewol
|
||||
ewol::Program* m_GLprogram;
|
||||
int32_t m_GLPosition;
|
||||
int32_t m_GLMatrix;
|
||||
int32_t m_GLNormal;
|
||||
int32_t m_GLtexture;
|
||||
int32_t m_GLtexID;
|
||||
int32_t m_GLtexID0;
|
||||
int32_t m_bufferOfset;
|
||||
int32_t m_numberOfElments;
|
||||
protected:
|
||||
@ -75,9 +85,9 @@ namespace ewol
|
||||
etk::Vector<vec3> m_listVertexNormal; //!< List of all Face normal, when calculated
|
||||
protected:
|
||||
ewol::VirtualBufferObject* m_verticesVBO;
|
||||
ewol::TextureFile* m_texture1;
|
||||
ewol::TextureFile* m_texture0;
|
||||
public:
|
||||
Mesh(etk::UString genName);
|
||||
Mesh(etk::UString genName, etk::UString shaderName="DATA:textured3D2.prog");
|
||||
virtual ~Mesh(void);
|
||||
virtual const char* GetType(void) { return "ewol::Mesh"; };
|
||||
virtual void Draw(mat4& positionMatrix);
|
||||
|
@ -62,22 +62,22 @@ ewol::MeshObj::MeshObj(etk::UString _fileName) :
|
||||
if (12 != matches){
|
||||
// no normal mode :
|
||||
matches = sscanf(&inputDataLine[2], "%d/%d %d/%d %d/%d %d/%d\n",
|
||||
&vertexIndex[0], &uvIndex[0],
|
||||
&vertexIndex[1], &uvIndex[1],
|
||||
&vertexIndex[2], &uvIndex[2],
|
||||
&vertexIndex[3], &uvIndex[3] );
|
||||
&vertexIndex[0], &uvIndex[0],
|
||||
&vertexIndex[1], &uvIndex[1],
|
||||
&vertexIndex[2], &uvIndex[2],
|
||||
&vertexIndex[3], &uvIndex[3] );
|
||||
if (8 != matches){
|
||||
quadMode = false;
|
||||
matches = sscanf(&inputDataLine[2], "%d/%d/%d %d/%d/%d %d/%d/%d\n",
|
||||
&vertexIndex[0], &uvIndex[0], &normalIndex[0],
|
||||
&vertexIndex[1], &uvIndex[1], &normalIndex[1],
|
||||
&vertexIndex[2], &uvIndex[2], &normalIndex[2] );
|
||||
&vertexIndex[0], &uvIndex[0], &normalIndex[0],
|
||||
&vertexIndex[1], &uvIndex[1], &normalIndex[1],
|
||||
&vertexIndex[2], &uvIndex[2], &normalIndex[2] );
|
||||
if (9 != matches){
|
||||
// no normal mode :
|
||||
matches = sscanf(&inputDataLine[2], "%d/%d %d/%d %d/%d\n",
|
||||
&vertexIndex[0], &uvIndex[0],
|
||||
&vertexIndex[1], &uvIndex[1],
|
||||
&vertexIndex[2], &uvIndex[2] );
|
||||
&vertexIndex[0], &uvIndex[0],
|
||||
&vertexIndex[1], &uvIndex[1],
|
||||
&vertexIndex[2], &uvIndex[2] );
|
||||
if (6 != matches){
|
||||
EWOL_ERROR("Parsing error in the .obj files : " << fileName << " (l=" << lineID << ") in 'f' section : \"" << &inputDataLine[2] << "\" expected : %d/%d(/%d) %d/%d(/%d) %d/%d(/%d) (%d/%d(/%d)) () for option");
|
||||
continue;
|
||||
|
@ -19,7 +19,8 @@ ewol::Program::Program(const etk::UString& filename) :
|
||||
ewol::Resource(filename),
|
||||
m_exist(false),
|
||||
m_program(0),
|
||||
m_hasTexture(false)
|
||||
m_hasTexture(false),
|
||||
m_hasTexture1(false)
|
||||
{
|
||||
m_resourceLevel = 1;
|
||||
EWOL_DEBUG("OGL : load PROGRAM \"" << filename << "\"");
|
||||
@ -84,6 +85,7 @@ ewol::Program::~Program(void)
|
||||
RemoveContext();
|
||||
m_elementList.Clear();
|
||||
m_hasTexture = false;
|
||||
m_hasTexture1 = false;
|
||||
}
|
||||
|
||||
static void checkGlError(const char* op, int32_t localLine)
|
||||
@ -703,6 +705,33 @@ void ewol::Program::SetTexture0(int32_t idElem, GLint textureOpenGlID)
|
||||
m_hasTexture = true;
|
||||
}
|
||||
|
||||
void ewol::Program::SetTexture1(int32_t idElem, GLint textureOpenGlID)
|
||||
{
|
||||
if (0==m_program) {
|
||||
return;
|
||||
}
|
||||
if (idElem<0 || idElem>m_elementList.Size()) {
|
||||
return;
|
||||
}
|
||||
if (false == m_elementList[idElem].m_isLinked) {
|
||||
return;
|
||||
}
|
||||
#if 0
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
checkGlError("glEnable", __LINE__);
|
||||
#endif
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
//checkGlError("glActiveTexture", __LINE__);
|
||||
// set the textureID
|
||||
glBindTexture(GL_TEXTURE_2D, textureOpenGlID);
|
||||
//checkGlError("glBindTexture", __LINE__);
|
||||
// Set the texture on the uniform attribute
|
||||
glUniform1i(m_elementList[idElem].m_elementId, /*GL_TEXTURE*/1);
|
||||
//checkGlError("glUniform1i", __LINE__);
|
||||
m_hasTexture1 = true;
|
||||
}
|
||||
|
||||
|
||||
void ewol::Program::UnUse(void)
|
||||
{
|
||||
if (0==m_program) {
|
||||
|
@ -52,6 +52,7 @@ namespace ewol
|
||||
etk::Vector<ewol::Shader*> m_shaderList; //!< List of all the shader loaded
|
||||
etk::Vector<ewol::progAttributeElement> m_elementList; //!< List of all the attribute requested by the user
|
||||
bool m_hasTexture; //!< A texture has been set to the current shader
|
||||
bool m_hasTexture1; //!< A texture has been set to the current shader
|
||||
public:
|
||||
/**
|
||||
* @brief Contructor of an opengl Program.
|
||||
@ -236,6 +237,7 @@ namespace ewol
|
||||
* @param[in] textureOpenGlID Real openGL texture ID
|
||||
*/
|
||||
void SetTexture0(int32_t idElem, GLint textureOpenGlID);
|
||||
void SetTexture1(int32_t idElem, GLint textureOpenGlID);
|
||||
/**
|
||||
* @brief Stop the processing of this program
|
||||
*/
|
||||
|
@ -97,3 +97,34 @@ void ewol::VirtualBufferObject::Flush(void)
|
||||
ewol::resource::Update(this);
|
||||
}
|
||||
|
||||
void ewol::VirtualBufferObject::PushOnBuffer(int32_t id, const ivec3& data)
|
||||
{
|
||||
EWOL_ERROR("Type does not supported yet...");
|
||||
/*
|
||||
m_buffer[id].PushBack(data.x());
|
||||
m_buffer[id].PushBack(data.y());
|
||||
m_buffer[id].PushBack(data.z());
|
||||
*/
|
||||
}
|
||||
|
||||
void ewol::VirtualBufferObject::PushOnBuffer(int32_t id, const vec3& data)
|
||||
{
|
||||
m_buffer[id].PushBack(data.x());
|
||||
m_buffer[id].PushBack(data.y());
|
||||
m_buffer[id].PushBack(data.z());
|
||||
}
|
||||
|
||||
void ewol::VirtualBufferObject::PushOnBuffer(int32_t id, const ivec2& data)
|
||||
{
|
||||
EWOL_ERROR("Type does not supported yet...");
|
||||
/*
|
||||
m_buffer[id].PushBack(data.x());
|
||||
m_buffer[id].PushBack(data.y());
|
||||
*/
|
||||
}
|
||||
|
||||
void ewol::VirtualBufferObject::PushOnBuffer(int32_t id, const vec2& data)
|
||||
{
|
||||
m_buffer[id].PushBack(data.x());
|
||||
m_buffer[id].PushBack(data.y());
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#define __OPEN_GL__VIRTUAL_BUFFER_OBJECT_H__
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <etk/math/Vector2D.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/renderer/resources/Resource.h>
|
||||
#include <ewol/renderer/openGL.h>
|
||||
@ -33,7 +34,7 @@ namespace ewol
|
||||
* @brief Constructor of this VBO.
|
||||
* @param[in] accesMode Acces mode : ???
|
||||
*/
|
||||
VirtualBufferObject(const etk::UString& accesMode, int32_t nbElement=2);
|
||||
VirtualBufferObject(const etk::UString& accesMode, int32_t nbElement=3);
|
||||
/**
|
||||
* @brief Destructor of this VBO.
|
||||
*/
|
||||
@ -50,9 +51,34 @@ namespace ewol
|
||||
GLuint GetGL_ID(int32_t id) { return m_vbo[id]; };
|
||||
/**
|
||||
* @brief Get a reference on hte buffer data for this VBO.
|
||||
* @param[in] id Id of the buffer requested
|
||||
* @return A reference on the data.
|
||||
*/
|
||||
etk::Vector<float>& GetRefBuffer(int32_t id) { return m_buffer[id]; };
|
||||
/**
|
||||
* @brief push data on a buffer with a custum type :
|
||||
* @param[in] id Id of the buffer requested.
|
||||
* @param[in] data Direct data that might be set.
|
||||
*/
|
||||
void PushOnBuffer(int32_t id, const ivec3& data);
|
||||
/**
|
||||
* @brief push data on a buffer with a custum type :
|
||||
* @param[in] id Id of the buffer requested.
|
||||
* @param[in] data Direct data that might be set.
|
||||
*/
|
||||
void PushOnBuffer(int32_t id, const vec3& data);
|
||||
/**
|
||||
* @brief push data on a buffer with a custum type :
|
||||
* @param[in] id Id of the buffer requested.
|
||||
* @param[in] data Direct data that might be set.
|
||||
*/
|
||||
void PushOnBuffer(int32_t id, const ivec2& data);
|
||||
/**
|
||||
* @brief push data on a buffer with a custum type :
|
||||
* @param[in] id Id of the buffer requested.
|
||||
* @param[in] data Direct data that might be set.
|
||||
*/
|
||||
void PushOnBuffer(int32_t id, const vec2& data);
|
||||
/**
|
||||
* @brief Get the data from the graphic card.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user