1 /*  NAME:
2         E3View.h
3 
4     DESCRIPTION:
5         Header file for E3View.c.
6 
7     COPYRIGHT:
8         Copyright (c) 1999-2004, Quesa Developers. All rights reserved.
9 
10         For the current release of Quesa, please see:
11 
12             <http://www.quesa.org/>
13 
14         Redistribution and use in source and binary forms, with or without
15         modification, are permitted provided that the following conditions
16         are met:
17 
18             o Redistributions of source code must retain the above copyright
19               notice, this list of conditions and the following disclaimer.
20 
21             o Redistributions in binary form must reproduce the above
22               copyright notice, this list of conditions and the following
23               disclaimer in the documentation and/or other materials provided
24               with the distribution.
25 
26             o Neither the name of Quesa nor the names of its contributors
27               may be used to endorse or promote products derived from this
28               software without specific prior written permission.
29 
30         THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31         "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32         LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
33         A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
34         OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35         SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
36         TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
37         PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
38         LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
39         NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
40         SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41     ___________________________________________________________________________
42 */
43 #ifndef E3VIEW_HDR
44 #define E3VIEW_HDR
45 //=============================================================================
46 //      Include files
47 //-----------------------------------------------------------------------------
48 // Include files go here
49 
50 
51 
52 
53 //=============================================================================
54 //		C++ preamble
55 //-----------------------------------------------------------------------------
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 
60 
61 
62 
63 
64 //=============================================================================
65 //      Constants
66 //-----------------------------------------------------------------------------
67 // View mode (current behaviour)
68 typedef enum TQ3ViewMode {
69 	kQ3ViewModeInactive	             		= 0,		// View not doing anythig
70 	kQ3ViewModeDrawing		         		= 1,		// Performing drawing
71 	kQ3ViewModePicking		         		= 2,		// Performing picking
72 	kQ3ViewModeWriting		    			= 3,		// Performing I/O
73 	kQ3ViewModeCalcBounds			 		= 4			// Calculating bounds
74 } TQ3ViewMode;
75 
76 
77 // View state (activity within current behaviour)
78 typedef enum TQ3ViewState {
79 	kQ3ViewStateInactive   					= 0,		// View not doing anything
80 	kQ3ViewStateCancelled  					= 1,		// View cancelled
81 	kQ3ViewStateSubmitting 					= 2			// Inside submit loop
82 } TQ3ViewState;
83 
84 
85 // Bounding method (activity within current behaviour)
86 typedef enum TQ3BoundingMethod {
87 	kQ3BoxBoundsExact						= 0,		// Bounding box, slow
88 	kQ3BoxBoundsApprox						= 1,		// Bounding box, fast
89 	kQ3SphereBoundsExact					= 2,		// Bounding sphere, slow
90 	kQ3SphereBoundsApprox					= 3			// Bounding sphere, fast
91 } TQ3BoundingMethod;
92 
93 
94 // Matrix state
95 enum {
96 	kQ3MatrixStateNone						= 0,
97 	kQ3MatrixStateLocalToWorld				= (1 << 0),	// Local  to world   changed
98 	kQ3MatrixStateWorldToCamera				= (1 << 1),	// World  to camera  changed
99 	kQ3MatrixStateCameraToFrustum			= (1 << 2)	// Camera to frustum changed
100 };
101 
102 typedef TQ3Uns32	TQ3MatrixState;
103 
104 
105 
106 
107 //=============================================================================
108 //      Function prototypes
109 //-----------------------------------------------------------------------------
110 TQ3Status				E3View_RegisterClass(void);
111 TQ3Status				E3View_UnregisterClass(void);
112 TQ3Status				E3View_SubmitRetained(TQ3ViewObject theView, TQ3Object theObject);
113 TQ3Status				E3View_SubmitImmediate(TQ3ViewObject theView, TQ3ObjectType objectType, const void *objectData);
114 TQ3Status				E3View_CallIdleMethod(TQ3ViewObject theView, TQ3Uns32 current, TQ3Uns32 completed);
115 TQ3PickObject			E3View_AccessPick(TQ3ViewObject theView);
116 TQ3RendererObject		E3View_AccessRenderer(TQ3ViewObject theView);
117 TQ3DrawContextObject	E3View_AccessDrawContext(TQ3ViewObject theView);
118 TQ3FileObject			E3View_AccessFile(TQ3ViewObject theView);
119 TQ3FileFormatObject		E3View_AccessFileFormat(TQ3ViewObject theView);
120 TQ3CameraObject			E3View_AccessCamera(TQ3ViewObject theView);
121 void					E3View_EndFrame(TQ3ViewObject theView);
122 TQ3ViewMode				E3View_GetViewMode(TQ3ViewObject theView);
123 TQ3ViewState			E3View_GetViewState(TQ3ViewObject theView);
124 TQ3BoundingMethod		E3View_GetBoundingMethod(TQ3ViewObject theView);
125 void					E3View_GetRayThroughPickPoint(TQ3ViewObject theView, TQ3Ray3D *theRay);
126 void					E3View_UpdateBounds(TQ3ViewObject theView, TQ3Uns32 numPoints, TQ3Uns32 pointStride, const TQ3Point3D *thePoints);
127 TQ3Status				E3View_PickStack_PushGroup(TQ3ViewObject theView, TQ3GroupObject theGroup);
128 TQ3HitPath				*E3View_PickStack_GetPickedPath(TQ3ViewObject theView);
129 TQ3Object				E3View_PickStack_GetPickedObject(TQ3ViewObject theView);
130 void					E3View_PickStack_SavePosition(TQ3ViewObject theView, TQ3GroupPosition thePosition);
131 void					E3View_PickStack_SaveObject(TQ3ViewObject theView, TQ3Object theObject);
132 void					E3View_PickStack_BeginDecomposedObject(TQ3ViewObject theView);
133 void					E3View_PickStack_EndDecomposedObject(TQ3ViewObject theView);
134 void					E3View_PickStack_PopGroup(TQ3ViewObject theView);
135 
136 TQ3Status						E3View_State_AddMatrixLocalToWorld(TQ3ViewObject theView, const TQ3Matrix4x4 *theMatrix);
137 const TQ3Matrix4x4				*E3View_State_GetMatrixLocalToWorld(TQ3ViewObject theView);
138 const TQ3SubdivisionStyleData	*E3View_State_GetStyleSubdivision(TQ3ViewObject theView);
139 TQ3OrientationStyle				E3View_State_GetStyleOrientation(TQ3ViewObject theView);
140 TQ3Status						E3View_State_SetMatrix(TQ3ViewObject theView, TQ3MatrixState theState, const TQ3Matrix4x4 *localToWorld, const TQ3Matrix4x4 *worldToCamera, const TQ3Matrix4x4 *cameraToFrustum);
141 void							E3View_State_SetShaderIllumination(TQ3ViewObject theView, const TQ3IlluminationShaderObject theData);
142 void							E3View_State_SetShaderSurface(TQ3ViewObject theView, const TQ3SurfaceShaderObject theData);
143 void							E3View_State_SetStyleSubdivision(TQ3ViewObject theView, const TQ3SubdivisionStyleData *theData);
144 void							E3View_State_SetStylePickID(TQ3ViewObject theView, TQ3Uns32 pickID);
145 void							E3View_State_SetStylePickParts(TQ3ViewObject theView, TQ3PickParts pickParts);
146 void							E3View_State_SetStyleCastShadows(TQ3ViewObject theView, TQ3Boolean castShadows);
147 void							E3View_State_SetStyleReceiveShadows(TQ3ViewObject theView, TQ3Boolean receiveShadows);
148 void							E3View_State_SetStyleFill(TQ3ViewObject theView, TQ3FillStyle fillStyle);
149 void							E3View_State_SetStyleBackfacing(TQ3ViewObject theView, TQ3BackfacingStyle backfacingStyle);
150 void							E3View_State_SetStyleInterpolation(TQ3ViewObject theView, TQ3InterpolationStyle interpolationStyle);
151 void							E3View_State_SetStyleHighlight(TQ3ViewObject theView, TQ3AttributeSet interpolationStyle);
152 void							E3View_State_SetStyleOrientation(TQ3ViewObject theView, TQ3OrientationStyle frontFacingDirection);
153 void							E3View_State_SetStyleAntiAlias(TQ3ViewObject theView, const TQ3AntiAliasStyleData *theData);
154 void							E3View_State_SetStyleFog(TQ3ViewObject theView, const TQ3FogStyleData *theData);
155 void							E3View_State_SetAttributeSurfaceUV(TQ3ViewObject theView, const TQ3Param2D *theData);
156 void							E3View_State_SetAttributeShadingUV(TQ3ViewObject theView, const TQ3Param2D *theData);
157 void							E3View_State_SetAttributeNormal(TQ3ViewObject theView, const TQ3Vector3D *theData);
158 void							E3View_State_SetAttributeAmbientCoefficient(TQ3ViewObject theView, const float *theData);
159 void							E3View_State_SetAttributeDiffuseColor(TQ3ViewObject theView, const TQ3ColorRGB *theData);
160 void							E3View_State_SetAttributeSpecularColor(TQ3ViewObject theView, const TQ3ColorRGB *theData);
161 void							E3View_State_SetAttributeSpecularControl(TQ3ViewObject theView, const float *theData);
162 void							E3View_State_SetAttributeTransparencyColor(TQ3ViewObject theView, const TQ3ColorRGB *theData);
163 void							E3View_State_SetAttributeSurfaceTangent(TQ3ViewObject theView, const TQ3Tangent2D *theData);
164 void							E3View_State_SetAttributeHighlightState(TQ3ViewObject theView, const TQ3Switch *theData);
165 void							E3View_State_SetAttributeSurfaceShader(TQ3ViewObject theView, const TQ3SurfaceShaderObject *theData);
166 
167 TQ3ViewObject			E3View_New(void);
168 TQ3ViewObject			E3View_NewWithDefaults(TQ3ObjectType drawContextType, void *drawContextTarget);
169 TQ3Status				E3View_Cancel(TQ3ViewObject theView);
170 TQ3Status				E3View_SetRendererByType(TQ3ViewObject theView, TQ3ObjectType theType);
171 TQ3Status				E3View_SetRenderer(TQ3ViewObject theView, TQ3RendererObject theRenderer);
172 TQ3Status				E3View_GetRenderer(TQ3ViewObject theView, TQ3RendererObject *theRenderer);
173 TQ3Status				E3View_StartRendering(TQ3ViewObject theView);
174 TQ3ViewStatus			E3View_EndRendering(TQ3ViewObject theView);
175 TQ3Status				E3View_Flush(TQ3ViewObject theView);
176 TQ3Status				E3View_Sync(TQ3ViewObject theView);
177 TQ3Status				E3View_StartBoundingBox(TQ3ViewObject theView, TQ3ComputeBounds computeBounds);
178 TQ3ViewStatus			E3View_EndBoundingBox(TQ3ViewObject theView, TQ3BoundingBox *result);
179 TQ3Status				E3View_StartBoundingSphere(TQ3ViewObject theView, TQ3ComputeBounds computeBounds);
180 TQ3ViewStatus			E3View_EndBoundingSphere(TQ3ViewObject theView, TQ3BoundingSphere *result);
181 TQ3Status				E3View_StartPicking(TQ3ViewObject theView, TQ3PickObject pick);
182 TQ3ViewStatus			E3View_EndPicking(TQ3ViewObject theView);
183 TQ3Status				E3View_StartWriting(TQ3ViewObject view, TQ3FileObject theFile);
184 TQ3ViewStatus			E3View_EndWriting(TQ3ViewObject view);
185 TQ3Status				E3View_GetCamera(TQ3ViewObject theView, TQ3CameraObject *theCamera);
186 TQ3Status				E3View_SetCamera(TQ3ViewObject theView, TQ3CameraObject theCamera);
187 TQ3Status				E3View_SetLightGroup(TQ3ViewObject theView, TQ3GroupObject lightGroup);
188 TQ3Status				E3View_GetLightGroup(TQ3ViewObject theView, TQ3GroupObject *lightGroup);
189 TQ3Status				E3View_AddLight(TQ3ViewObject theView, TQ3ObjectType lightType, void *lightData);
190 TQ3Status				E3View_SetIdleMethod(TQ3ViewObject theView, TQ3ViewIdleMethod idleMethod, const void *idleData);
191 TQ3Status				E3View_SetIdleProgressMethod(TQ3ViewObject theView, TQ3ViewIdleProgressMethod idleMethod, const void *idleData);
192 TQ3Status				E3View_SetEndFrameMethod(TQ3ViewObject theView, TQ3ViewEndFrameMethod endFrame, void *endFrameData);
193 TQ3Boolean				E3View_IsBoundingBoxVisible(TQ3ViewObject theView, const TQ3BoundingBox *theBBox);
194 TQ3Status				E3View_AllowAllGroupCulling(TQ3ViewObject theView, TQ3Boolean allowCulling);
195 TQ3Status				E3View_TransformLocalToWorld(TQ3ViewObject theView, const TQ3Point3D *localPoint, TQ3Point3D *worldPoint);
196 TQ3Status				E3View_TransformLocalToWindow(TQ3ViewObject theView, const TQ3Point3D *localPoint, TQ3Point2D *windowPoint);
197 TQ3Status				E3View_TransformWorldToWindow(TQ3ViewObject theView, const TQ3Point3D *worldPoint, TQ3Point2D *windowPoint);
198 TQ3Status				E3View_SetDrawContext(TQ3ViewObject theView, TQ3DrawContextObject drawContext);
199 TQ3Status				E3View_GetDrawContext(TQ3ViewObject theView, TQ3DrawContextObject *drawContext);
200 TQ3Status				E3View_GetLocalToWorldMatrixState(TQ3ViewObject theView, TQ3Matrix4x4 *theMatrix);
201 TQ3Status				E3View_GetWorldToFrustumMatrixState(TQ3ViewObject theView, TQ3Matrix4x4 *theMatrix);
202 TQ3Status				E3View_GetFrustumToWindowMatrixState(TQ3ViewObject theView, TQ3Matrix4x4 *theMatrix);
203 TQ3Status				E3View_GetBackfacingStyleState(TQ3ViewObject theView, TQ3BackfacingStyle *backfacingStyle);
204 TQ3Status				E3View_GetInterpolationStyleState(TQ3ViewObject theView, TQ3InterpolationStyle *interpolationType);
205 TQ3Status				E3View_GetFillStyleState(TQ3ViewObject theView, TQ3FillStyle *fillStyle);
206 TQ3Status				E3View_GetHighlightStyleState(TQ3ViewObject theView, TQ3AttributeSet *highlightStyle);
207 TQ3Status				E3View_GetSubdivisionStyleState(TQ3ViewObject theView, TQ3SubdivisionStyleData *subdivisionStyle);
208 TQ3Status				E3View_GetOrientationStyleState(TQ3ViewObject theView, TQ3OrientationStyle *frontFacingDirectionStyle);
209 TQ3Status				E3View_GetCastShadowsStyleState(TQ3ViewObject theView, TQ3Boolean *castShadows);
210 TQ3Status				E3View_GetReceiveShadowsStyleState(TQ3ViewObject theView, TQ3Boolean *receiveShadows);
211 TQ3Status				E3View_GetPickIDStyleState(TQ3ViewObject theView, TQ3Uns32 *pickIDStyle);
212 TQ3Status				E3View_GetPickPartsStyleState(TQ3ViewObject theView, TQ3PickParts *pickPartsStyle);
213 TQ3Status				E3View_GetAntiAliasStyleState(TQ3ViewObject theView, TQ3AntiAliasStyleData *antiAliasData);
214 TQ3Status				E3View_GetFogStyleState(TQ3ViewObject theView, TQ3FogStyleData *fogData);
215 TQ3Status				E3View_GetDefaultAttributeSet(TQ3ViewObject theView, TQ3AttributeSet *attributeSet);
216 TQ3Status				E3View_SetDefaultAttributeSet(TQ3ViewObject theView, TQ3AttributeSet attributeSet);
217 TQ3Status				E3View_GetAttributeSetState(TQ3ViewObject theView, TQ3AttributeSet *attributeSet);
218 TQ3Status				E3View_GetAttributeState(TQ3ViewObject theView, TQ3AttributeType attributeType, void *data);
219 TQ3Boolean				E3View_IsOfMyClass ( TQ3Object object ) ;
220 
221 TQ3Status				E3Push_Submit(TQ3ViewObject theView);
222 TQ3Status				E3Pop_Submit(TQ3ViewObject theView);
223 TQ3StateOperatorObject	E3Push_New(void);
224 TQ3StateOperatorObject	E3Pop_New(void);
225 TQ3Status				E3StateOperator_Submit(TQ3StateOperatorObject stateOperator, TQ3ViewObject theView);
226 
227 
228 
229 
230 
231 //=============================================================================
232 //		C++ postamble
233 //-----------------------------------------------------------------------------
234 #ifdef __cplusplus
235 }
236 #endif
237 
238 #endif
239 
240