1 /* NAME: 2 E3Set.h 3 4 DESCRIPTION: 5 Header file for E3Set.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 E3SET_HDR 44 #define E3SET_HDR 45 //============================================================================= 46 // Include files 47 //----------------------------------------------------------------------------- 48 // Include files go here 49 50 51 52 53 54 //============================================================================= 55 // C++ preamble 56 //----------------------------------------------------------------------------- 57 #ifdef __cplusplus 58 extern "C" { 59 #endif 60 61 62 63 64 //============================================================================= 65 // Internal types 66 //----------------------------------------------------------------------------- 67 68 69 70 class E3ElementInfo : public E3Root 71 { 72 const TQ3XElementCopyAddMethod elementCopyAddMethod ; 73 const TQ3XElementCopyReplaceMethod elementCopyReplaceMethod ; 74 const TQ3XElementCopyGetMethod elementCopyGetMethod ; 75 const TQ3XElementCopyDuplicateMethod elementCopyDuplicateMethod ; 76 const TQ3XElementDeleteMethod elementDeleteMethod ; 77 78 public : 79 80 E3ElementInfo ( 81 TQ3XMetaHandler newClassMetaHandler, 82 E3ClassInfo* newParent 83 ) ; // constructor 84 friend class E3Set ; 85 friend struct OpaqueTQ3Object ; 86 } ; 87 88 89 90 91 class E3Element : public OpaqueTQ3Object 92 { 93 Q3_CLASS_ENUMS ( kQ3ObjectTypeElement, E3Element, OpaqueTQ3Object ) 94 95 // There is no extra data for this class 96 97 public : 98 } ; 99 100 101 102 class E3Attribute : public E3Element 103 { 104 Q3_CLASS_ENUMS ( kQ3ElementTypeAttribute, E3Attribute, E3Element ) 105 106 // There is no extra data for this class 107 108 public : 109 } ; 110 111 112 113 // Set attribute data 114 typedef struct TQ3SetAttributes { 115 TQ3Vector3D normal; 116 TQ3Switch highlightState; 117 TQ3Tangent2D surfaceTangent; 118 TQ3Param2D surfaceUV; 119 TQ3ColorRGB diffuseColor; 120 float ambientCoeficient; 121 TQ3ColorRGB specularColor; 122 float specularControl; 123 TQ3Param2D shadingUV; 124 TQ3SurfaceShaderObject surfaceShader; 125 TQ3ColorRGB trasparencyColor; 126 } TQ3SetAttributes; 127 128 129 130 // Set instance data 131 typedef struct TQ3SetData { 132 TQ3SetAttributes attributes; // Data for built-in attributes 133 E3HashTablePtr theTable; // Elements in set, keyed by type 134 TQ3Uns32 scanEditIndex; // Set edit index while scanning 135 TQ3Uns32 scanCount; // Size of scanResults 136 TQ3Uns32 scanIndex; // Current index into scanResults 137 TQ3ElementType *scanResults; // Scan results 138 TQ3XAttributeMask theMask; // Attribute mask 139 } TQ3SetData; 140 141 142 143 class E3Set : public E3Shared 144 { 145 Q3_CLASS_ENUMS ( kQ3SharedTypeSet, E3Set, E3Shared ) 146 147 TQ3SetData setData ; 148 149 public : 150 151 static TQ3Boolean IsOfMyClass ( TQ3Object object ) ; 152 153 TQ3ElementObject FindElement ( TQ3ElementType theType ) ; 154 TQ3ObjectType GetType ( void ) ; 155 TQ3Status Add ( TQ3ElementType theType, const void *data ) ; 156 TQ3Status Get ( TQ3ElementType theType, void *data ) ; 157 TQ3Boolean Contains ( TQ3ElementType theType ) ; 158 TQ3Status Clear ( TQ3ElementType theType ) ; 159 TQ3Status Empty ( void ) ; 160 TQ3Status GetNextElementType ( TQ3ElementType *theType ) ; 161 TQ3Status CopyElement ( TQ3ElementType theType, TQ3SetObject destSet ) ; 162 TQ3Status SubmitElements ( TQ3ViewObject inView ) ; 163 164 165 friend TQ3Status E3AttributeSet_GetNextAttributeType ( TQ3AttributeSet theSet, TQ3AttributeType *theType ) ; 166 friend TQ3Status E3AttributeSet_Inherit ( TQ3AttributeSet parent, TQ3AttributeSet child, TQ3AttributeSet result ) ; 167 friend void * E3XAttributeSet_GetPointer ( TQ3AttributeSet attributeSet, TQ3AttributeType attributeType ) ; 168 friend TQ3XAttributeMask E3XAttributeSet_GetMask ( TQ3AttributeSet attributeSet ) ; 169 } ; 170 171 172 //============================================================================= 173 // Function prototypes 174 //----------------------------------------------------------------------------- 175 176 TQ3Status E3Set_RegisterClass(void); 177 TQ3Status E3Set_UnregisterClass(void); 178 179 TQ3SetObject E3Set_New(void); 180 181 TQ3Status E3AttributeSet_GetNextAttributeType(TQ3AttributeSet theSet, TQ3AttributeType *theType); 182 TQ3AttributeType E3Attribute_ClassToAttributeType(TQ3ObjectType theType); 183 TQ3ObjectType E3Attribute_AttributeToClassType(TQ3AttributeType theType); 184 TQ3Status E3Attribute_Submit(TQ3AttributeType attributeType, const void *attributeData, TQ3ViewObject theView); 185 TQ3Status E3AttributeSet_Submit(TQ3AttributeSet theSet, TQ3ViewObject theView); 186 TQ3AttributeSet E3AttributeSet_New(void); 187 TQ3Status E3AttributeSet_Inherit(TQ3AttributeSet parent, TQ3AttributeSet child, TQ3AttributeSet result); 188 189 TQ3XObjectClass E3XElementClass_Register(TQ3ElementType *elementType, const char *name, TQ3Uns32 sizeOfElement, TQ3XMetaHandler metaHandler); 190 TQ3Status E3XElementType_GetElementSize(TQ3ElementType elementType, TQ3Uns32 *sizeOfElement); 191 TQ3XObjectClass E3XAttributeClass_Register(TQ3AttributeType *attributeType, const char *creatorName, TQ3Uns32 sizeOfElement, TQ3XMetaHandler metaHandler); 192 void *E3XAttributeSet_GetPointer(TQ3AttributeSet attributeSet, TQ3AttributeType attributeType); 193 TQ3XAttributeMask E3XAttributeSet_GetMask(TQ3AttributeSet attributeSet); 194 195 196 197 198 199 //============================================================================= 200 // C++ postamble 201 //----------------------------------------------------------------------------- 202 #ifdef __cplusplus 203 } 204 #endif 205 206 #endif 207 208