Line data Source code
1 0 : /* 2 : 3 : OOVisualEffectEntity.h 4 : 5 : Entity subclass representing a visual effect with a custom mesh 6 : 7 : Oolite 8 : Copyright (C) 2004-2013 Giles C Williams and contributors 9 : 10 : This program is free software; you can redistribute it and/or 11 : modify it under the terms of the GNU General Public License 12 : as published by the Free Software Foundation; either version 2 13 : of the License, or (at your option) any later version. 14 : 15 : This program is distributed in the hope that it will be useful, 16 : but WITHOUT ANY WARRANTY; without even the implied warranty of 17 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 : GNU General Public License for more details. 19 : 20 : You should have received a copy of the GNU General Public License 21 : along with this program; if not, write to the Free Software 22 : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 23 : MA 02110-1301, USA. 24 : 25 : */ 26 : 27 : #import "OOEntityWithDrawable.h" 28 : #import "OOPlanetEntity.h" 29 : #import "OOJSPropID.h" 30 : #import "HeadUpDisplay.h" 31 : #import "OOWeakReference.h" 32 : 33 : @class OOColor, OOMesh, OOScript, OOJSScript; 34 : 35 : 36 0 : @interface OOVisualEffectEntity: OOEntityWithDrawable <OOSubEntity,OOBeaconEntity> 37 : { 38 : @private 39 : NSMutableArray *subEntities; 40 0 : 41 : NSDictionary *effectinfoDictionary; 42 0 : 43 : GLfloat _profileRadius; // for frustum culling 44 0 : 45 : OOColor *scanner_display_color1; 46 0 : OOColor *scanner_display_color2; 47 0 : 48 : GLfloat _hullHeatLevel; 49 0 : GLfloat _shaderFloat1; 50 0 : GLfloat _shaderFloat2; 51 0 : int _shaderInt1; 52 0 : int _shaderInt2; 53 0 : Vector _shaderVector1; 54 0 : Vector _shaderVector2; 55 0 : 56 : Vector _v_forward; 57 0 : Vector _v_up; 58 0 : Vector _v_right; 59 0 : 60 : OOJSScript *script; 61 0 : NSDictionary *scriptInfo; 62 0 : 63 : NSString *_effectKey; 64 0 : 65 : BOOL _haveExecutedSpawnAction; 66 0 : 67 : // beacons 68 : NSString *_beaconCode; 69 0 : NSString *_beaconLabel; 70 0 : OOWeakReference *_prevBeacon; 71 0 : OOWeakReference *_nextBeacon; 72 0 : id <OOHUDBeaconIcon> _beaconDrawable; 73 0 : 74 : // scaling 75 : GLfloat scaleX; 76 0 : GLfloat scaleY; 77 0 : GLfloat scaleZ; 78 0 : 79 : } 80 : 81 : - (id)initWithKey:(NSString *)key definition:(NSDictionary *) dict; 82 0 : - (BOOL) setUpVisualEffectFromDictionary:(NSDictionary *) effectDict; 83 0 : 84 : - (OOMesh *)mesh; 85 0 : - (void)setMesh:(OOMesh *)mesh; 86 0 : 87 : - (NSString *)effectKey; 88 0 : 89 : - (GLfloat)frustumRadius; 90 0 : 91 : - (void) clearSubEntities; 92 0 : - (BOOL) setUpSubEntities; 93 0 : - (void) removeSubEntity:(Entity<OOSubEntity> *)sub; 94 0 : - (void) setNoDrawDistance; 95 0 : - (NSArray *)subEntities; 96 0 : - (NSUInteger) subEntityCount; 97 0 : - (NSEnumerator *) visualEffectSubEntityEnumerator; 98 0 : - (BOOL) hasSubEntity:(Entity<OOSubEntity> *)sub; 99 0 : 100 : - (NSEnumerator *)subEntityEnumerator; 101 0 : - (NSEnumerator *)effectSubEntityEnumerator; 102 0 : - (NSEnumerator *)flasherEnumerator; 103 0 : 104 : - (void) orientationChanged; 105 0 : - (Vector) forwardVector; 106 0 : - (Vector) rightVector; 107 0 : - (Vector) upVector; 108 0 : 109 : - (OOColor *)scannerDisplayColor1; 110 0 : - (OOColor *)scannerDisplayColor2; 111 0 : - (void)setScannerDisplayColor1:(OOColor *)color; 112 0 : - (void)setScannerDisplayColor2:(OOColor *)color; 113 0 : - (GLfloat *) scannerDisplayColorForShip:(BOOL)flash :(OOColor *)scannerDisplayColor1 :(OOColor *)scannerDisplayColor2; 114 0 : 115 : - (void) setScript:(NSString *)script_name; 116 0 : - (OOJSScript *)script; 117 0 : - (NSDictionary *)scriptInfo; 118 0 : - (void) doScriptEvent:(jsid)message; 119 0 : - (void) remove; 120 0 : 121 : - (GLfloat) scaleMax; // used for calculating frustum cull size 122 0 : - (GLfloat) scaleX; 123 0 : - (void) setScaleX:(GLfloat)factor; 124 0 : - (GLfloat) scaleY; 125 0 : - (void) setScaleY:(GLfloat)factor; 126 0 : - (GLfloat) scaleZ; 127 0 : - (void) setScaleZ:(GLfloat)factor; 128 0 : 129 : // convenience for shaders 130 : - (GLfloat)hullHeatLevel; 131 0 : - (void)setHullHeatLevel:(GLfloat)value; 132 0 : // shader properties 133 : - (GLfloat) shaderFloat1; 134 0 : - (void)setShaderFloat1:(GLfloat)value; 135 0 : - (GLfloat) shaderFloat2; 136 0 : - (void)setShaderFloat2:(GLfloat)value; 137 0 : - (int) shaderInt1; 138 0 : - (void)setShaderInt1:(int)value; 139 0 : - (int) shaderInt2; 140 0 : - (void)setShaderInt2:(int)value; 141 0 : - (Vector) shaderVector1; 142 0 : - (void)setShaderVector1:(Vector)value; 143 0 : - (Vector) shaderVector2; 144 0 : - (void)setShaderVector2:(Vector)value; 145 0 : 146 : 147 : - (BOOL) isBreakPattern; 148 0 : - (void) setIsBreakPattern:(BOOL)bp; 149 0 : 150 : - (NSDictionary *)effectInfoDictionary; 151 0 : 152 : 153 : @end