1 #pragma once
2 /*  NAME:
3         E3GeometryTriMeshOptimize.h
4 
5     DESCRIPTION:
6         Header file for E3GeometryTriMeshOptimize.cp.
7 
8     COPYRIGHT:
9         Copyright (c) 2005, Quesa Developers. All rights reserved.
10 
11         For the current release of Quesa, please see:
12 
13             <http://www.quesa.org/>
14 
15         Redistribution and use in source and binary forms, with or without
16         modification, are permitted provided that the following conditions
17         are met:
18 
19             o Redistributions of source code must retain the above copyright
20               notice, this list of conditions and the following disclaimer.
21 
22             o Redistributions in binary form must reproduce the above
23               copyright notice, this list of conditions and the following
24               disclaimer in the documentation and/or other materials provided
25               with the distribution.
26 
27             o Neither the name of Quesa nor the names of its contributors
28               may be used to endorse or promote products derived from this
29               software without specific prior written permission.
30 
31         THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32         "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33         LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34         A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35         OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
36         SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
37         TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
38         PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
39         LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
40         NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
41         SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42     ___________________________________________________________________________
43 */
44 
45 
46 //=============================================================================
47 //      Include files
48 //-----------------------------------------------------------------------------
49 #include "E3Prefix.h"
50 
51 
52 
53 //=============================================================================
54 //      Function prototypes
55 //-----------------------------------------------------------------------------
56 
57 
58 /*!
59 	@function	E3TriMesh_OptimizeData
60 
61 	@abstract	Modify TriMesh data, if needed, for efficient use by the
62 				interactive renderer.
63 
64 	@discussion	This operation modifies TriMesh data so that:
65 				<ol>
66 					<li>Face normals exist.</li>
67 					<li>Vertex normals exist.</li>
68 					<li>If Face colors exist, then vertex colors exist.</li>
69 				</ol>
70 
71 				If face normals do not already exist, they will be computed
72 				by cross products of edges.  The orientation will be assumed
73 				to be counterclockwise.
74 
75 				If vertex normals do not already exist, they will be derived
76 				from face normals.  When a vertex belongs to faces with
77 				different normals, the vertex will be duplicated.
78 
79 				If a color attribute (diffuse, transparent, or specular) exists
80 				on faces but not vertices, it will be converted to a vertex
81 				attribute, duplicating vertices when needed.
82 
83 				If no optimization is needed, outDidChange will return kQ3False
84 				and outData will be cleared to zero.  If optimization was
85 				performed, indicated by outDidChange being kQ3True, then you
86 				are responsible for calling Q3TriMesh_EmptyData on the outData
87 				structure when you are done with it.
88 
89 	@param		inData			TriMesh data.
90 	@param		outData			Receives new TriMesh data, if outDidChange is true.
91 	@param		outDidChange	Receives a flag indicating whether new data
92 								was created.
93 	@result		Success or failure of the operation.
94 */
95 TQ3Status E3TriMesh_OptimizeData( const TQ3TriMeshData& inData,
96 								TQ3TriMeshData& outData,
97 								TQ3Boolean& outDidChange );
98 
99 
100 /*!
101 	@function	E3TriMesh_Optimize
102 
103 	@abstract	Modify a TriMesh, if needed, for efficient use by the
104 				interactive renderer.
105 
106 	@discussion	See discussion of E3TriMesh_OptimizeData for the optimizations
107 				that are performed.  If no optimizations are needed, NULL
108 				is returned.
109 
110 	@param		inTriMesh		A TriMesh geometry.
111 	@result		A TriMesh or NULL.
112 */
113 TQ3GeometryObject E3TriMesh_Optimize( TQ3GeometryObject inTriMesh );
114