60 m_stride += spec.
bytes;
61 return m_attribs.getSize() - 1;
69 for (
int i = 0; i < num; i++)
80 for (
int i = prevAttrib + 1; i <
numAttribs(); i++)
120 m_stride = other.m_stride;
121 m_numVertices = other.m_numVertices;
122 m_attribs = other.m_attribs;
123 m_vertices = other.m_vertices;
126 for (
int i = 0; i < m_submeshes.
getSize(); i++)
128 *m_submeshes[i].indices = *other.m_submeshes[i].indices;
129 m_submeshes[i].material = other.m_submeshes[i].material;
143 dstAttribUsed[i] =
false;
153 if (src.
type != dst.
type || dstAttribUsed[j])
160 for (
int k = 0; k < src.
bytes; k++)
163 dstAttribUsed[j] =
true;
168 int oldNumVertices = m_numVertices;
170 for (
int i = 0; i < other.m_numVertices; i++)
174 const U8* src = &other.m_vertices[i * other.m_stride];
175 U8* dst = &m_vertices[(i + oldNumVertices) * m_stride];
176 for (
int j = 0; j < copy.
getSize(); j++)
177 dst[copy[j].
y] = src[copy[j].
x];
179 for (
int j = 0; j < convert.
getSize(); j++)
188 const Submesh& src = other.m_submeshes[i];
189 Submesh& dst = m_submeshes[i + oldNumSubmeshes];
191 dst.indices->
reset(src.indices->getSize());
192 for (
int j = 0; j < src.indices->getSize(); j++)
193 dst.indices->set(j, src.indices->get(j) + oldNumVertices);
194 dst.material = src.material;
206 for (
int i = 0; i < m_submeshes.
getSize(); i++)
208 m_submeshes[i].indices->
compact();
218 m_vertices.
reset(num * m_stride);
219 if (num > m_numVertices)
220 memset(m_vertices.
getPtr(m_numVertices * m_stride), 0, (num - m_numVertices) * m_stride);
232 m_vertices.
resize(num * m_stride);
233 if (num > m_numVertices)
234 memset(m_vertices.
getPtr(m_numVertices * m_stride), 0, (num - m_numVertices) * m_stride);
247 for (
int i = 0; i < spec.
length; i++)
267 for (
int i = 0; i < spec.
length; i++)
284 int old = m_submeshes.
getSize();
288 for (
int i = num; i < old; i++)
290 Submesh& sm = m_submeshes[i];
293 sm.material.textures[j].
clear();
299 for (
int i = old; i < num; i++)
301 Submesh& sm = m_submeshes[i];
316 int ofs = m_vertices.
getSize();
317 for (
int i = 0; i < m_submeshes.
getSize(); i++)
319 m_submeshes[i].ofsInVBO = ofs;
320 m_submeshes[i].sizeInVBO = m_submeshes[i].indices->
getSize() * 3;
326 for (
int i = 0; i < m_submeshes.
getSize(); i++)
330 m_submeshes[i].indices->
getPtr(),
370 const char* progId = (!gouraud) ?
"MeshBase::draw_generic" :
"MeshBase::draw_gouraud";
376 if (!prog && !gouraud)
381 uniform mat4 posToClip;
382 uniform mat4 posToCamera;
383 uniform mat3 normalToCamera;
384 attribute vec3 positionAttrib;
385 attribute vec3 normalAttrib;
386 attribute vec4 colorAttrib;
387 attribute vec2 texCoordAttrib;
388 centroid varying vec3 positionVarying;
389 centroid varying vec3 normalVarying;
390 centroid varying vec4 colorVarying;
391 varying vec2 texCoordVarying;
395 vec4 pos = vec4(positionAttrib, 1.0);
396 gl_Position = posToClip * pos;
397 positionVarying = (posToCamera * pos).xyz;
398 normalVarying = normalToCamera * normalAttrib;
399 colorVarying = colorAttrib;
400 texCoordVarying = texCoordAttrib;
405 uniform
bool hasNormals;
406 uniform
bool hasDiffuseTexture;
407 uniform
bool hasAlphaTexture;
408 uniform vec4 diffuseUniform;
409 uniform vec3 specularUniform;
410 uniform
float glossiness;
411 uniform sampler2D diffuseSampler;
412 uniform sampler2D alphaSampler;
413 centroid varying vec3 positionVarying;
414 centroid varying vec3 normalVarying;
415 centroid varying vec4 colorVarying;
416 varying vec2 texCoordVarying;
420 vec4 diffuseColor = diffuseUniform * colorVarying;
421 vec3 specularColor = specularUniform;
423 if (hasDiffuseTexture)
424 diffuseColor.rgb = texture2D(diffuseSampler, texCoordVarying).rgb;
427 diffuseColor.a = texture2D(alphaSampler, texCoordVarying).g;
429 if (diffuseColor.a <= 0.5)
434 float diffuseCoef = (hasNormals) ?
max(-
dot(I, N), 0.0) * 0.75 + 0.25 : 1.0;
435 float specularCoef = (hasNormals) ?
pow(
max(-
dot(I, reflect(I, N)), 0.0), glossiness) : 0.0;
436 gl_FragColor = vec4(diffuseColor.rgb * diffuseCoef + specularColor * specularCoef, diffuseColor.a);
443 if (!prog && gouraud)
448 uniform mat4 posToClip;
449 uniform mat4 posToCamera;
450 uniform mat3 normalToCamera;
451 uniform
bool hasNormals;
452 uniform vec4 diffuseUniform;
453 uniform vec3 specularUniform;
454 uniform
float glossiness;
455 attribute vec3 positionAttrib;
456 attribute vec3 normalAttrib;
457 attribute vec4 colorAttrib;
458 centroid varying vec4 colorVarying;
462 vec4 pos = vec4(positionAttrib, 1.0);
463 gl_Position = posToClip * pos;
464 vec3 I =
normalize((posToCamera * pos).xyz);
465 vec3
N =
normalize(normalToCamera * normalAttrib);
466 float diffuseCoef = (hasNormals) ?
max(-
dot(I, N), 0.0) * 0.75 + 0.25 : 1.0;
467 float specularCoef = (hasNormals) ?
pow(
max(-
dot(I, reflect(I, N)), 0.0), glossiness) : 0.0;
468 vec4 diffuseColor = diffuseUniform * colorAttrib;
469 colorVarying = vec4(diffuseColor.rgb * diffuseCoef + specularUniform * specularCoef, diffuseColor.a);
474 centroid varying vec4 colorVarying;
477 gl_FragColor = colorVarying;
505 if (normalAttrib != -1)
510 if (colorAttrib != -1)
513 glVertexAttrib4f(prog->
getAttribLoc(
"colorAttrib"), 1.0f, 1.0f, 1.01f, 1.0f);
515 if (texCoordAttrib != -1)
518 glVertexAttrib2f(prog->
getAttribLoc(
"texCoordAttrib"), 0.0f, 0.0f);
550 m_isInMemory =
false;
552 for (
int i = 0; i < m_submeshes.
getSize(); i++)
554 delete m_submeshes[i].indices;
555 m_submeshes[i].indices =
NULL;
582 if (normalAttrib == -1)
588 normal = mat * normal;
613 for (
int j = 0; j < 3; j++)
615 lo[j] =
min(lo[j], pos[j]);
616 hi[j] =
max(hi[j], pos[j]);
627 if (posAttrib == -1 || normalAttrib == -1)
638 for (
int j = 0; j < tris.
getSize(); j++)
640 const Vec3i& tri = tris[j];
641 for (
int k = 0; k < 3; k++)
644 Vec3f triNormal = (v[1] - v[0]).
cross(v[2] - v[0]);
645 for (
int k = 0; k < 3; k++)
649 *vertNormal += triNormal;
651 posToNormal.
add(v[k], triNormal);
674 for (
int j = 0; j < tris.
getSize(); j++)
675 swap(tris[j].
x, tris[j].
y);
686 for (
int submeshIn = 0; submeshIn <
numSubmeshes(); submeshIn++)
690 for (
int i = 0; i < inds.
getSize(); i++)
693 if (v.x != v.y && v.x != v.z && v.y != v.z)
700 if (submeshOut != submeshIn)
717 for (
int submeshIn = 0; submeshIn <
numSubmeshes(); submeshIn++)
720 for (
int i = 0; i < inds.
getSize(); i++)
721 for (
int j = 0; j < 3; j++)
722 vertUsed[inds[i][j]] = 1;
734 for (
int vertIn = 0; vertIn < vertUsed.
getSize(); vertIn++)
736 if (!vertUsed[vertIn])
739 vertRemap[vertIn] = vertOut;
740 if (vertOut != vertIn)
741 memcpy(vertPtr + vertOut * vertStride, vertPtr + vertIn * vertStride, vertStride);
748 for (
int submeshIdx = 0; submeshIdx <
numSubmeshes(); submeshIdx++)
751 for (
int i = 0; i < inds.
getSize(); i++)
752 for (
int j = 0; j < 3; j++)
753 inds[i][j] = vertRemap[inds[i][j]];
772 for (
int i = 0; i < num; i++)
781 hash.
add(key, remap[i]);
783 memcpy(vertPtr + remap[i] * vertStride, vertPtr + i * vertStride, vertStride);
791 for (
int submeshIdx = 0; submeshIdx <
numSubmeshes(); submeshIdx++)
794 for (
int i = 0; i < inds.
getSize(); i++)
795 for (
int j = 0; j < 3; j++)
796 inds[i][j] = remap[inds[i][j]];
812 for (
int submeshIdx = 0; submeshIdx <
numSubmeshes(); submeshIdx++)
815 for (
int i = 0; i < inds.
getSize(); i++)
816 for (
int j = 0; j < 3; j++)
819 if (remap[v].
x != submeshIdx)
821 remap[
v].x = submeshIdx;
822 if (remap[v].
y == -1)
830 inds[i][j] = remap[
v].y;
840 for (
int i = 0; i < dup.
getSize(); i++)
841 memcpy(vertPtr + (num + i) * vertStride, vertPtr + dup[i] * vertStride, vertStride);
848 for (
int submeshIdx = 0; submeshIdx <
numSubmeshes(); submeshIdx++)
896 for (
int i = 0; i < verts.
getSize(); i++)
898 Vertex&
v = verts[i];
908 posGroups.
unionSets(i, (group) ? *group : posHash.
add(v.pos, i));
911 group = outHash.
search(outKey);
912 outGroups.
unionSets(i, (group) ? *group : outHash.
add(outKey, i));
921 for (
int submeshIdx = 0; submeshIdx <
numSubmeshes(); submeshIdx++)
924 for (
int triIdx = 0; triIdx < tris.
getSize(); triIdx++)
926 const Vec3i& tri = tris[triIdx];
927 F32 area =
max(
length(
cross(verts[tri.y].pos - verts[tri.x].pos, verts[tri.z].pos - verts[tri.x].pos)), 1.0e-8
f);
928 for (
int i = 0; i < 3; i++)
930 Vec2i vi =
Vec2i(posGroups[tri[i]], posGroups[tri[(i == 2) ? 0 : (i + 1)]]);
931 verts[vi.x].posWeight += area;
932 verts[outGroups[tri[i]]].outWeight += area;
936 if (vi.x == vi.y || edgeSet.
contains(vi))
941 Edge& e = edges.
add();
944 for (
int j = 0; j < 2; j++)
946 S32* prevSlot = &verts[vi[j]].firstEdge;
951 prevSlot = &edges[*prevSlot].next[(edges[*prevSlot].verts.x == vi[j]) ? 0 : 1];
952 e.next[j] = *prevSlot;
964 for (
int i = 0; i < edges.
getSize(); i++)
966 const Vertex& va = verts[edges[i].verts.x];
967 const Vertex& vb = verts[edges[i].verts.y];
968 F32 error =
max(va.posWeight, vb.posWeight) *
length(va.pos - vb.pos) / (va.posWeight + vb.posWeight);
969 if (error <= maxError)
970 edgeHeap.
add(i, error);
975 for (
int timeStamp = 0; !edgeHeap.
isEmpty(); timeStamp++)
980 const Vec2i& removedVerts = edges[removedEdge].verts;
981 const Vertex& va = verts[removedVerts.x];
982 const Vertex& vb = verts[removedVerts.y];
984 int vi = posGroups.
unionSets(removedVerts.x, removedVerts.y);
985 Vertex&
v = verts[vi];
986 v.pos = (va.pos * va.posWeight + vb.pos * vb.posWeight) / (va.posWeight + vb.posWeight);
987 v.error = edgeHeap.
remove(removedEdge);
988 v.posWeight = va.posWeight + vb.posWeight;
993 for (
int i = 0; i < 2; i++)
995 int nextEdge = edges[removedEdge].next[i];
996 while (nextEdge != removedEdge)
998 int currEdge = nextEdge;
999 Edge& e = edges[currEdge];
1000 int c = (e.verts.x == removedVerts[i]) ? 0 : 1;
1001 nextEdge = e.next[c];
1002 edgeHeap.
remove(currEdge);
1006 int otherVertex = e.verts[1 - c];
1007 if (otherVertex == -1 || verts[otherVertex].timeStamp == timeStamp)
1015 Vertex& vo = verts[otherVertex];
1016 vo.timeStamp = timeStamp;
1019 S32* prevSlot = &v.firstEdge;
1020 if (*prevSlot == -1)
1021 e.next[c] = currEdge;
1024 prevSlot = &edges[*prevSlot].next[(edges[*prevSlot].verts.x == vi) ? 0 : 1];
1025 e.next[c] = *prevSlot;
1027 *prevSlot = currEdge;
1031 F32 coef =
length(v.pos - vo.pos) / (v.posWeight + vo.posWeight);
1032 F32 error =
max(v.error + vo.posWeight * coef, vo.error + v.posWeight * coef);
1033 if (error <= maxError)
1034 edgeHeap.
add(currEdge, error);
1041 for (
int submeshIdx = 0; submeshIdx <
numSubmeshes(); submeshIdx++)
1044 for (
int triIdx = tris.
getSize() - 1; triIdx >= 0; triIdx--)
1046 const Vec3i& tri = tris[triIdx];
1048 for (
int i = 0; i < 3; i++)
1050 int j = (i == 2) ? 0 : (i + 1);
1051 if (posGroups[tri[i]] != posGroups[tri[j]])
1064 int numOutVerts = 0;
1065 for (
int submeshIdx = 0; submeshIdx <
numSubmeshes(); submeshIdx++)
1068 for (
int triIdx = 0; triIdx < tris.
getSize(); triIdx++)
1070 Vec3i& tri = tris[triIdx];
1071 for (
int i = 0; i < 3; i++)
1073 S32& idx = verts[outGroups[tri[i]]].outIdx;
1075 idx = numOutVerts++;
1091 for (
int i = 0; i < verts.
getSize(); i++)
1093 const Vertex&
v = verts[outGroups[i]];
1094 if (v.outIdx == -1 || v.outWeight == 0.0f)
1098 for (
int j = 0; j < numAttrib; j++)
1100 ptr[j] =
Vec4f(verts[posGroups[i]].pos, 1.0
f);
1103 outDenom[v.outIdx] += v.outWeight;
1109 for (
int i = 0; i < numOutVerts; i++)
1112 F32 coef = 1.0f / outDenom[i];
1113 for (
int j = 0; j < numAttrib; j++)
1116 if (j == normalAttrib)
1118 else if (j != posAttrib)
1162 static const Vec3i indexArray[] =
1176 vertexPtr[i].
n = normal;
1180 indices.
add(indexArray[i] + base);
1189 #define STREAM(CALL) { File file(fileName, File::Read); BufferedInputStream stream(file); return CALL; }
1194 setError(
"importMesh(): Unsupported file extension '%s'!", fileName.
getPtr());
1205 #define STREAM(CALL) { File file(fileName, File::Create); BufferedOutputStream stream(file); CALL; stream.flush(); return; }
1210 setError(
"exportMesh(): Unsupported file extension '%s'!", fileName.
getPtr());
1218 "obj:Wavefront Mesh,"
1227 "obj:Wavefront Mesh,"
V * addVertices(const V *ptr, int num)
String getMeshExportFilter(void)
MeshBase * importMesh(const String &fileName)
void collapseVertices(void)
FW_CUDA_FUNC T length(const VectorBase< T, L, S > &v)
int vboIndexSize(int submesh)
bool endsWith(const String &str) const
const char * getPtr(void) const
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture glBindBuffer
void addCubeToMesh(Mesh< VertexPNC > &mesh, int submesh, const Vec3f &lo, const Vec3f &hi, const Vec4f &color, bool forceNormal=false, const Vec3f &normal=Vec3f(0.0f))
void append(const MeshBase &other)
void getBBox(Vec3f &lo, Vec3f &hi) const
void set(const MeshBase &other)
const Image * getImage(void) const
const AttribSpec & attribSpec(int attrib) const
void setError(const char *fmt,...)
void setUniform(int loc, S32 v)
const U8 * vertex(int idx) const
int numSubmeshes(void) const
FW_CUDA_FUNC F64 pow(F64 a, F64 b)
void xformNormals(const Mat3f &mat, bool normalize=true)
void recomputeNormals(void)
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N
void exportMesh(const String &fileName, const MeshBase *mesh)
FW_CUDA_FUNC Vec3f getXYZ(void) const
const Material & material(int submesh) const
void setProgram(const String &id, Program *prog)
void draw(GLContext *gl, const Mat4f &posToCamera, const Mat4f &projection, GLContext::Program *prog=NULL, bool gouraud=false)
GLuint getGLTexture(const ImageFormat::ID desiredFormat=ImageFormat::ID_Max, bool generateMipmaps=true) const
String toLower(void) const
#define GL_ELEMENT_ARRAY_BUFFER
void setOwner(Module module, bool modify, bool async=false, CUstream cudaStream=NULL, S64 validSize=-1)
S getNumBytes(void) const
FW_CUDA_FUNC T dot(const VectorBase< T, L, S > &a, const VectorBase< T, L, V > &b)
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat x
void exportWavefrontMesh(BufferedOutputStream &stream, const MeshBase *mesh, const String &fileName)
Mesh< VertexPNT > * importWavefrontMesh(BufferedInputStream &stream, const String &fileName)
void addAttribs(const MeshBase &other)
Texture getMipLevel(int level) const
GLint getUniformLoc(const String &name) const
int vboIndexOffset(int submesh)
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat GLfloat y
Program * getProgram(const String &id) const
void add(int idx, const T &value)
U8 * getMutableVertexPtr(int idx=0)
bool contains(const T &value) const
int main(int argc, char *argv[])
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v
GLint getAttribLoc(const String &name) const
void dupVertsPerSubmesh(void)
Array< Vec3i > & mutableIndices(int submesh)
void setAttrib(int loc, int size, GLenum type, int stride, Buffer *buffer, const void *pointer)
int addAttrib(AttribType type, AttribFormat format, int length)
void setVertexAttrib(int idx, int attrib, const Vec4f &v)
U8 * getMutablePtr(S64 ofs=0)
FW_CUDA_FUNC T min(const VectorBase< T, L, S > &v)
Vec4f getVec4f(const Vec2i &pos) const
void resetVertices(int num)
FW_CUDA_FUNC T max(const VectorBase< T, L, S > &v)
void simplify(F32 maxError)
void resizeSubmeshes(int num)
String getMeshImportFilter(void)
int numAttribs(void) const
int findAttrib(AttribType type) const
FW_CUDA_FUNC S inverted(void) const
void resizeVertices(int num)
void fixMaterialColors(void)
Vec4f getVertexAttrib(int idx, int attrib) const
V & add(const K &key, const V &value)
int numVertices(void) const
int vertexStride(void) const
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction f
FW_CUDA_FUNC F32 cross(const Vec2f &a, const Vec2f &b)
const Array< Vec3i > & indices(int submesh) const
void setGLAttrib(GLContext *gl, int attrib, int loc)
void exportBinaryMesh(OutputStream &stream, const MeshBase *mesh)
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei n
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program glVertexAttrib3f
int findNextAttrib(AttribType type, int prevAttrib) const
int vboAttribStride(int attrib)
Texture textures[TextureType_Max]
FW_CUDA_FUNC S normalize(const VectorBase< T, L, S > &v, T len=(T) 1)
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device glActiveTexture
int unionSets(int idxA, int idxB)
FW_CUDA_FUNC S normalized(T len=(T) 1) const
U8 * mutableVertex(int idx)
FW_CUDA_FUNC void swap(T &a, T &b)
const V * search(const K &key) const
#define FW_GL_SHADER_SOURCE(CODE)
void setCapacity(int numItems)
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type
int vboAttribOffset(int attrib)
const T * getPtr(S idx=0) const
void resizeDiscard(S64 size)
bool isInMemory(void) const
const U8 * getVertexPtr(int idx=0) const
void xformPositions(const Mat4f &mat)
MeshBase * importBinaryMesh(InputStream &stream)
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat GLfloat GLfloat z GLuint GLint GLenum GLboolean GLsizei const GLvoid pointer GLuint GLuint color
bool isCompatible(const MeshBase &other) const