NTrace
GPU ray tracing framework
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
MeshBinaryIO.hpp
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009-2011, NVIDIA Corporation
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions are met:
7
* * Redistributions of source code must retain the above copyright
8
* notice, this list of conditions and the following disclaimer.
9
* * Redistributions in binary form must reproduce the above copyright
10
* notice, this list of conditions and the following disclaimer in the
11
* documentation and/or other materials provided with the distribution.
12
* * Neither the name of NVIDIA Corporation nor the
13
* names of its contributors may be used to endorse or promote products
14
* derived from this software without specific prior written permission.
15
*
16
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
* DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
20
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
*/
27
28
#pragma once
29
#include "
base/Defs.hpp
"
30
31
namespace
FW
32
{
33
//------------------------------------------------------------------------
34
35
class
MeshBase;
36
class
InputStream;
37
class
OutputStream;
38
39
//------------------------------------------------------------------------
40
41
MeshBase*
importBinaryMesh
(InputStream& stream);
42
void
exportBinaryMesh
(OutputStream& stream,
const
MeshBase* mesh);
43
44
//------------------------------------------------------------------------
45
/*
46
47
Binary mesh file format v4
48
--------------------------
49
50
- the basic units of data are 32-bit little-endian ints and floats
51
52
BinaryMesh
53
0 6 struct v1 MeshHeader
54
6 n*3 struct v1 array of AttribSpec (MeshHeader.numAttribs)
55
? n*? struct v1 array of Vertex (MeshHeader.numVertices)
56
? n*? struct v2 array of Texture (MeshHeader.numTextures)
57
? n*? struct v1 array of Submesh (MeshHeader.numSubmeshes)
58
?
59
60
MeshHeader
61
0 2 bytes v1 formatID (must be "BinMesh ")
62
2 1 int v1 formatVersion (must be 4)
63
3 1 int v1 numAttribs
64
4 1 int v1 numVertices
65
5 1 int v2 numTextures
66
6 1 int v1 numSubmeshes
67
7
68
69
AttribSpec
70
0 1 int v1 type (see MeshBase::AttribType)
71
1 1 int v1 format (see MeshBase::AttribFormat)
72
2 1 int v1 length
73
3
74
75
Vertex
76
0 ? bytes v1 array of values (dictated by the set of AttribSpecs)
77
?
78
79
Texture
80
0 1 int v2 idLength
81
1 ? bytes v2 idString
82
? ? struct v2 BinaryImage (see Image.hpp)
83
?
84
85
Submesh
86
0 3 float v1 ambient (ignored)
87
3 4 float v1 diffuse
88
7 3 float v1 specular
89
10 1 float v1 glossiness
90
11 1 float v3 displacementCoef
91
12 1 float v3 displacementBias
92
13 1 int v2 diffuseTexture (-1 if none)
93
14 1 int v2 alphaTexture (-1 if none)
94
15 1 int v3 displacementTexture (-1 if none)
95
16 1 int v4 normalTexture (-1 if none)
96
17 1 int v4 environmentTexture (-1 if none)
97
18 1 int v1 numTriangles
98
19 n*3 int v1 indices
99
?
100
101
*/
102
//------------------------------------------------------------------------
103
}
FW::exportBinaryMesh
void exportBinaryMesh(OutputStream &stream, const MeshBase *mesh)
Definition:
MeshBinaryIO.cpp:149
Defs.hpp
FW::importBinaryMesh
MeshBase * importBinaryMesh(InputStream &stream)
Definition:
MeshBinaryIO.cpp:37
src
framework
io
MeshBinaryIO.hpp
Generated on Wed Dec 10 2014 14:36:50 for NTrace by
1.8.6