46 if (
String(formatID) !=
"BinMesh ")
55 case 1: numTex = 0;
break;
59 default: numTex = 0;
setError(
"Unsupported binary mesh version!");
break;
62 S32 numAttribs, numVertices, numSubmeshes, numTextures = 0;
63 stream >> numAttribs >> numVertices >> numSubmeshes;
65 stream >> numTextures;
66 if (numAttribs < 0 || numVertices < 0 || numSubmeshes < 0 || numTextures < 0)
67 setError(
"Corrupt binary mesh data!");
71 for (
int i = 0; i < numAttribs && !
hasError(); i++)
74 stream >> type >> format >>
length;
76 setError(
"Corrupt binary mesh data!");
92 for (
int i = 0; i < numTextures && !
hasError(); i++)
98 if (textures[i].exists())
101 textures[i] =
Texture(image,
id);
106 for (
int i = 0; i < numSubmeshes && !
hasError(); i++)
115 for (
int j = 0; j < numTex; j++)
119 if (texIdx < -1 || texIdx >= numTextures)
120 setError(
"Corrupt binary mesh data!");
121 else if (texIdx != -1)
126 stream >> numTriangles;
127 if (numTriangles < 0)
128 setError(
"Corrupt binary mesh data!");
132 inds.
reset(numTriangles);
163 for (
int j = 0; j < numTex; j++)
176 stream.
write(
"BinMesh ", 8);
193 for (
int i = 0; i < textures.
getSize(); i++)
195 stream << textures[i].getID();
208 for (
int j = 0; j < numTex; j++)
static Texture find(const String &id)
FW_CUDA_FUNC T length(const VectorBase< T, L, S > &v)
bool contains(const K &key) const
const Image * getImage(void) const
const AttribSpec & attribSpec(int attrib) const
void setError(const char *fmt,...)
int numSubmeshes(void) const
const Material & material(int submesh) const
virtual void write(const void *ptr, int size)=0
S32 getNumBytes(void) const
Image * importBinaryImage(InputStream &stream)
U8 * getMutableVertexPtr(int idx=0)
Array< Vec3i > & mutableIndices(int submesh)
int addAttrib(AttribType type, AttribFormat format, int length)
void resetVertices(int num)
int numAttribs(void) 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
const Array< Vec3i > & indices(int submesh) const
void exportBinaryMesh(OutputStream &stream, const MeshBase *mesh)
Texture textures[TextureType_Max]
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 GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type
void exportBinaryImage(OutputStream &stream, const Image *image)
const T * getPtr(S32idx=0) const
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void * image
const U8 * getVertexPtr(int idx=0) const
MeshBase * importBinaryMesh(InputStream &stream)