Oolite 1.91.0.7645-241119-222d325
Loading...
Searching...
No Matches
OOLightParticleEntity Class Reference

#include <OOLightParticleEntity.h>

+ Inheritance diagram for OOLightParticleEntity:
+ Collaboration diagram for OOLightParticleEntity:

Instance Methods

(id) - initWithDiameter:
 
(float) - diameter
 
(void) - setDiameter:
 
(void) - setColor:
 
(void) - setColor:alpha:
 
(OOTexture *) - texture
 
(void) - drawSubEntityImmediate:translucent:
 
(void) - drawImmediate:translucent: [implementation]
 
(BOOL) - isEffect [implementation]
 
(BOOL) - canCollide [implementation]
 
(NSSet *) - allTextures [implementation]
 
- Instance Methods inherited from Entity
(NSUInteger) - sessionID
 
(BOOL) - isShip
 
(BOOL) - isDock
 
(BOOL) - isStation
 
(BOOL) - isSubEntity
 
(BOOL) - isPlayer
 
(BOOL) - isPlanet
 
(BOOL) - isSun
 
(BOOL) - isSunlit
 
(BOOL) - isStellarObject
 
(BOOL) - isSky
 
(BOOL) - isWormhole
 
(BOOL) - isVisualEffect
 
(BOOL) - isWaypoint
 
(BOOL) - validForAddToUniverse
 
(void) - addToLinkedLists
 
(void) - removeFromLinkedLists
 
(void) - updateLinkedLists
 
(void) - wasAddedToUniverse
 
(void) - wasRemovedFromUniverse
 
(void) - warnAboutHostiles
 
(CollisionRegion *) - collisionRegion
 
(void) - setCollisionRegion:
 
(void) - setUniversalID:
 
(OOUniversalID- universalID
 
(BOOL) - throwingSparks
 
(void) - setThrowSparks:
 
(void) - throwSparks
 
(void) - setOwner:
 
(id) - owner
 
(ShipEntity *) - parentEntity
 
(ShipEntity *) - rootShipEntity
 
(void) - setPosition:
 
(void) - setPositionX:y:z:
 
(HPVector) - position
 
(Vector) - cameraRelativePosition
 
(GLfloat) - cameraRangeFront
 
(GLfloat) - cameraRangeBack
 
(void) - updateCameraRelativePosition
 
(Vector) - vectorTo:
 
(HPVector) - absolutePositionForSubentity
 
(HPVector) - absolutePositionForSubentityOffset:
 
(double) - zeroDistance
 
(double) - camZeroDistance
 
(NSComparisonResult) - compareZeroDistance:
 
(BoundingBox) - boundingBox
 
(GLfloat) - mass
 
(Quaternion) - orientation
 
(void) - setOrientation:
 
(Quaternion) - normalOrientation
 
(void) - setNormalOrientation:
 
(void) - orientationChanged
 
(void) - setVelocity:
 
(Vector) - velocity
 
(double) - speed
 
(GLfloat) - distanceTravelled
 
(void) - setDistanceTravelled:
 
(void) - setStatus:
 
(OOEntityStatus- status
 
(void) - setScanClass:
 
(OOScanClass- scanClass
 
(void) - setEnergy:
 
(GLfloat) - energy
 
(void) - setMaxEnergy:
 
(GLfloat) - maxEnergy
 
(void) - applyRoll:andClimb:
 
(void) - applyRoll:climb:andYaw:
 
(void) - moveForward:
 
(OOMatrix) - rotationMatrix
 
(OOMatrix) - drawRotationMatrix
 
(OOMatrix) - transformationMatrix
 
(OOMatrix) - drawTransformationMatrix
 
(GLfloat) - collisionRadius
 
(GLfloat) - frustumRadius
 
(void) - setCollisionRadius:
 
(NSMutableArray *) - collisionArray
 
(void) - update:
 
(void) - applyVelocity:
 
(BOOL) - checkCloseCollisionWith:
 
(void) - takeEnergyDamage:from:becauseOf:weaponIdentifier:
 
(void) - dumpState
 
(void) - dumpSelfState
 
(double) - findCollisionRadius
 
(BOOL) - isVisible
 
(BOOL) - isInSpace
 
(BOOL) - isImmuneToBreakPatternHide
 
(GLfloat) - universalTime
 
(GLfloat) - spawnTime
 
(GLfloat) - timeElapsedSinceSpawn
 
(void) - setAtmosphereFogging:
 
(OOColor *) - fogUniform
 
(NSString *) - descriptionForObjDumpBasic
 
(NSString *) - descriptionForObjDump
 
(id) - init [implementation]
 
(void) - dealloc [implementation]
 
(NSString *) - descriptionComponents [implementation]
 
(BOOL) - checkLinkedLists [implementation]
 
(id< OOWeakReferenceSupport >) - superShaderBindingTarget [implementation]
 
(Vector) - relativePosition [implementation]
 
(void) - subEntityReallyDied: [implementation]
 
(BOOL) - isBreakPattern
 
(void) - inspect [implementation]
 
(BOOL) - isECMBlast
 
(NSArray *) - debugInspectorModules [implementation]
 
(NSString *) - inspScanClassLine
 
(NSString *) - inspStatusLine
 
(NSString *) - inspRetainCountLine
 
(NSString *) - inspPositionLine
 
(NSString *) - inspVelocityLine
 
(NSString *) - inspOrientationLine
 
(NSString *) - inspEnergyLine
 
(NSString *) - inspOwnerLine
 
(NSString *) - inspTargetLine
 
(NSString *) - inspDescription [implementation]
 
(NSString *) - inspBasicIdentityLine [implementation]
 
(BOOL) - isExhaust
 
(BOOL) - isFlasher
 
(BOOL) - isVisibleToScripts
 
(NSString *) - oo_jsClassName
 
(void) - getJSClass:andPrototype:
 
(void) - deleteJSSelf
 
(jsval) - oo_jsValueInContext: [implementation]
 
(BOOL) - isCascadeWeapon
 
(BOOL) - isPlayerLikeShip
 
(GLfloat) - clock [implementation]
 
(unsigned) - pseudoFixedD100 [implementation]
 
(unsigned) - pseudoFixedD256 [implementation]
 
(unsigned) - systemGovernment [implementation]
 
(unsigned) - systemEconomy [implementation]
 
(unsigned) - systemTechLevel [implementation]
 
(unsigned) - systemPopulation [implementation]
 
(unsigned) - systemProductivity [implementation]
 
(BOOL) - isShipWithSubEntityShip:
 
- Instance Methods inherited from OOWeakRefObject
(id) - weakSelf
 
(id) - weakRetain [implementation]
 
(void) - weakRefDied: [implementation]
 
- Instance Methods inherited from <OOWeakReferenceSupport>
(id) - OO_RETURNS_RETAINED
 

Class Methods

(void) + setUpTexture
 
(OOTexture *) + defaultParticleTexture
 
(void) + resetGraphicsState [implementation]
 

Protected Attributes

GLfloat _colorComponents [4]
 
float _diameter
 
- Protected Attributes inherited from Entity
HPVector lastPosition
 
Quaternion lastOrientation
 
GLfloat distanceTravelled
 
OOMatrix rotMatrix
 
Vector velocity
 
GLfloat energy
 
GLfloat maxEnergy
 
BoundingBox boundingBox
 
GLfloat mass
 
NSMutableArray * collidingEntities
 
OOTimeAbsolute spawnTime
 
struct JSObject * _jsSelf
 
- Protected Attributes inherited from OOWeakRefObject
OOWeakReferenceweakSelf
 

Additional Inherited Members

- Public Attributes inherited from Entity
OOUniversalID universalID
 
unsigned isShip: 1
 
unsigned isStation: 1
 
unsigned isPlayer: 1
 
unsigned isWormhole: 1
 
unsigned isSubEntity: 1
 
unsigned hasMoved: 1
 
unsigned hasRotated: 1
 
unsigned hasCollided: 1
 
unsigned isSunlit: 1
 
unsigned collisionTestFilter: 2
 
unsigned throw_sparks: 1
 
unsigned isImmuneToBreakPatternHide: 1
 
unsigned isExplicitlyNotMainStation: 1
 
unsigned isVisualEffect: 1
 
OOScanClass scanClass
 
GLfloat zero_distance
 
GLfloat cam_zero_distance
 
GLfloat no_draw_distance
 
GLfloat collision_radius
 
HPVector position
 
Vector cameraRelativePosition
 
Quaternion orientation
 
OOColoratmosphereFogging
 
int zero_index
 
Entityx_previous
 
Entityx_next
 
Entityy_previous
 
Entityy_next
 
Entityz_previous
 
Entityz_next
 
Entitycollision_chain
 
OOUniversalID shadingEntityID
 
Entitycollider
 
CollisionRegioncollisionRegion
 

Detailed Description

Definition at line 33 of file OOLightParticleEntity.h.

Method Documentation

◆ allTextures

- (NSSet *) allTextures
implementation

Reimplemented from Entity.

Definition at line 42 of file OOLightParticleEntity.m.

334{
335 return [NSSet setWithObject:[self texture]];
336}

◆ canCollide

- (BOOL) canCollide
implementation

Reimplemented from Entity.

Reimplemented in OOPlasmaShotEntity.

Definition at line 42 of file OOLightParticleEntity.m.

326{
327 return NO;
328}

◆ defaultParticleTexture

+ (OOTexture *) defaultParticleTexture

Definition at line 42 of file OOLightParticleEntity.m.

306{
307 if (sBlobTexture == nil) [self setUpTexture];
308 return sBlobTexture;
309}
static OOTexture * sBlobTexture
return nil

◆ diameter

- (float) diameter

Definition at line 42 of file OOLightParticleEntity.m.

76{
77 return _diameter;
78}

◆ drawImmediate:translucent:

- (void) drawImmediate: (bool) immediate
translucent: (bool) translucent 
implementation

Reimplemented from Entity.

Reimplemented in OOFlasherEntity.

Definition at line 42 of file OOLightParticleEntity.m.

138 :(bool)immediate translucent:(bool)translucent
139{
140 if (!translucent) return;
141 if ([UNIVERSE breakPatternHide] && ![self isImmuneToBreakPatternHide])
142 {
143 Entity *father = [self owner];
144 while (father != nil && father != NO_TARGET)
145 {
146 if (![father isSubEntity]) break;
147 father = [father owner];
148 }
149 if (![father isImmuneToBreakPatternHide])
150 {
151 return;
152 }
153 }
154 if (no_draw_distance <= cam_zero_distance) return;
155
158
159 OOGL(glPushAttrib(GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT));
160 OOGL(glEnable(GL_BLEND));
161 OOGL(glBlendFunc(GL_SRC_ALPHA, GL_ONE));
162
163 OOGL(glEnable(GL_TEXTURE_2D));
164 OOGL(glDepthMask(GL_FALSE));
165
166 GLfloat distanceAttenuation = cam_zero_distance / no_draw_distance;
167 distanceAttenuation = 1.0 - distanceAttenuation;
168 GLfloat components[4] = { _colorComponents[0], _colorComponents[1], _colorComponents[2], _colorComponents[3] * distanceAttenuation };
169 OOGL(glColor4fv(components));
170
171 OOGL(glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, components));
172 OOGL(glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_BLEND));
173
174 OOViewID viewDir = [UNIVERSE viewDirection];
175 if (viewDir != VIEW_GUI_DISPLAY) OOGLMultModelView([PLAYER drawRotationMatrix]);
176 [[self texture] apply];
177
178 /* NOTE: nominal diameter is actual radius, because of the black border
179 in the texture. However, the offset along the view axis is not
180 affected by the border and needs to be scaled.
181 -- Ahruman 2009-12-20
182 */
183 float viewOffset = _diameter * 0.5f;
184
185 OOGLBEGIN(GL_QUADS);
186 switch (viewDir)
187 {
188 case VIEW_FORWARD:
189 case VIEW_GUI_DISPLAY:
190 glTexCoord2f(0.0, 1.0);
191 glVertex3f(-_diameter, -_diameter, -viewOffset);
192
193 glTexCoord2f(1.0, 1.0);
194 glVertex3f(_diameter, -_diameter, -viewOffset);
195
196 glTexCoord2f(1.0, 0.0);
197 glVertex3f(_diameter, _diameter, -viewOffset);
198
199 glTexCoord2f(0.0, 0.0);
200 glVertex3f(-_diameter, _diameter, -viewOffset);
201 break;
202
203 case VIEW_AFT:
204 glTexCoord2f(0.0, 1.0);
205 glVertex3f(_diameter, -_diameter, viewOffset);
206
207 glTexCoord2f(1.0, 1.0);
208 glVertex3f(-_diameter, -_diameter, viewOffset);
209
210 glTexCoord2f(1.0, 0.0);
211 glVertex3f(-_diameter, _diameter, viewOffset);
212
213 glTexCoord2f(0.0, 0.0);
214 glVertex3f(_diameter, _diameter, viewOffset);
215 break;
216
217 case VIEW_STARBOARD:
218 glTexCoord2f(0.0, 1.0);
219 glVertex3f(-viewOffset, -_diameter, _diameter);
220
221 glTexCoord2f(1.0, 1.0);
222 glVertex3f(-viewOffset, -_diameter, -_diameter);
223
224 glTexCoord2f(1.0, 0.0);
225 glVertex3f(-viewOffset, _diameter, -_diameter);
226
227 glTexCoord2f(0.0, 0.0);
228 glVertex3f(-viewOffset, _diameter, _diameter);
229 break;
230
231 case VIEW_PORT:
232 glTexCoord2f(0.0, 1.0);
233 glVertex3f(viewOffset, -_diameter, -_diameter);
234
235 glTexCoord2f(1.0, 1.0);
236 glVertex3f(viewOffset, -_diameter, _diameter);
237
238 glTexCoord2f(1.0, 0.0);
239 glVertex3f(viewOffset, _diameter, _diameter);
240
241 glTexCoord2f(0.0, 0.0);
242 glVertex3f(viewOffset, _diameter, -_diameter);
243 break;
244
245 case VIEW_CUSTOM:
246 {
247 PlayerEntity *player = PLAYER;
248 Vector vi = [player customViewRightVector]; vi.x *= _diameter; vi.y *= _diameter; vi.z *= _diameter;
249 Vector vj = [player customViewUpVector]; vj.x *= _diameter; vj.y *= _diameter; vj.z *= _diameter;
250 Vector vk = [player customViewForwardVector]; vk.x *= viewOffset; vk.y *= viewOffset; vk.z *= viewOffset;
251 glTexCoord2f(0.0, 1.0);
252 glVertex3f(-vi.x -vj.x -vk.x, -vi.y -vj.y -vk.y, -vi.z -vj.z -vk.z);
253 glTexCoord2f(1.0, 1.0);
254 glVertex3f(+vi.x -vj.x -vk.x, +vi.y -vj.y -vk.y, +vi.z -vj.z -vk.z);
255 glTexCoord2f(1.0, 0.0);
256 glVertex3f(+vi.x +vj.x -vk.x, +vi.y +vj.y -vk.y, +vi.z +vj.z -vk.z);
257 glTexCoord2f(0.0, 0.0);
258 glVertex3f(-vi.x +vj.x -vk.x, -vi.y +vj.y -vk.y, -vi.z +vj.z -vk.z);
259 }
260 break;
261
262 default:
263 glTexCoord2f(0.0, 1.0);
264 glVertex3f(-_diameter, -_diameter, -_diameter);
265
266 glTexCoord2f(1.0, 1.0);
267 glVertex3f(_diameter, -_diameter, -_diameter);
268
269 glTexCoord2f(1.0, 0.0);
270 glVertex3f(_diameter, _diameter, -_diameter);
271
272 glTexCoord2f(0.0, 0.0);
273 glVertex3f(-_diameter, _diameter, -_diameter);
274 break;
275 }
276 OOGLEND();
277
278 OOGL(glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE));
279 OOGL(glPopAttrib());
280
282}
#define OO_ENTER_OPENGL()
void OOGLMultModelView(OOMatrix matrix)
#define OOGLBEGIN
Definition OOOpenGL.h:253
@ OPENGL_STATE_ADDITIVE_BLENDING
Definition OOOpenGL.h:125
#define OOVerifyOpenGLState()
Definition OOOpenGL.h:136
#define OOSetOpenGLState(STATE)
Definition OOOpenGL.h:135
#define OOGL(statement)
Definition OOOpenGL.h:251
#define OOGLEND
Definition OOOpenGL.h:254
OOViewID
Definition OOTypes.h:43
@ NO_TARGET
Definition OOTypes.h:194
#define PLAYER
#define UNIVERSE
Definition Universe.h:833
unsigned isImmuneToBreakPatternHide
Definition Entity.h:102
unsigned isSubEntity
Definition Entity.h:95
GLfloat cam_zero_distance
Definition Entity.h:109
GLfloat no_draw_distance
Definition Entity.h:110
id owner()
Definition Entity.m:583
OOMatrix drawRotationMatrix()
Definition Entity.m:879
Vector customViewRightVector
Vector customViewUpVector
Vector customViewForwardVector

◆ drawSubEntityImmediate:translucent:

- (void) drawSubEntityImmediate: (bool) immediate
translucent: (bool) translucent 

Reimplemented from Entity.

Reimplemented in OOFlasherEntity.

Definition at line 42 of file OOLightParticleEntity.m.

100 :(bool)immediate translucent:(bool)translucent
101{
102 if (!translucent) return;
103
104 /* TODO: someone will inevitably build a ship so big that individual
105 zero_distances are necessary for flashers, if they haven't already.
106 -- Ahruman 2009-09-20
107 */
108 cam_zero_distance = [[self owner] camZeroDistance];
109 if (no_draw_distance <= cam_zero_distance) return;
110
111 Entity *father = [self owner];
112 Entity *last = nil;
113 HPVector abspos = position;
114
115 while (father != nil && father != last && father != NO_TARGET)
116 {
117 OOMatrix rM = [father drawRotationMatrix];
118 abspos = HPvector_add(OOHPVectorMultiplyMatrix(abspos, rM), [father position]);
119 last = father;
120
121 if (![father isSubEntity]) break;
122 father = [father owner];
123 }
124
125 OOMatrix temp_matrix = OOGLPopModelView();
127
128 /* Flashers are drawn using the absolute view matrix */
129 OOGLLoadModelView([UNIVERSE viewMatrix]);
130 /* ...modified by the aggregate translation calculated above */
131 OOGLTranslateModelView(HPVectorToVector(HPvector_subtract(abspos,[PLAYER viewpointPosition]))); // move to camera-relative position
132 [self drawImmediate:immediate translucent:translucent];
133
134 OOGLLoadModelView(temp_matrix);
135}
HPVector OOHPVectorMultiplyMatrix(HPVector v, OOMatrix m)
Definition OOMatrix.m:145
void OOGLLoadModelView(OOMatrix matrix)
void OOGLPushModelView(void)
void OOGLTranslateModelView(Vector vector)
OOMatrix OOGLPopModelView(void)
HPVector position
Definition Entity.h:112

◆ initWithDiameter:

- (id) initWithDiameter: (float) diameter

Definition at line 42 of file OOLightParticleEntity.m.

54 :(float)diameter
55{
56 if ((self = [super init]))
57 {
61
62 _colorComponents[0] = 1.0f;
63 _colorComponents[1] = 1.0f;
64 _colorComponents[2] = 1.0f;
65 _colorComponents[3] = 1.0f;
66
67 [self setScanClass:CLASS_NO_DRAW];
68 [self setStatus:STATUS_EFFECT];
69 }
70
71 return self;
72}
#define NO_DRAW_DISTANCE_FACTOR
Definition Entity.h:46
#define PARTICLE_DISTANCE_SCALE_HIGH
#define PARTICLE_DISTANCE_SCALE_LOW
#define M_SQRT2
Definition OOMaths.h:91
id init()
Definition Entity.m:68

◆ isEffect

- (BOOL) isEffect
implementation

Reimplemented from Entity.

Definition at line 42 of file OOLightParticleEntity.m.

320{
321 return YES;
322}

◆ resetGraphicsState

+ (void) resetGraphicsState
implementation

Reimplemented in OOFlashEffectEntity.

Provided by category OOLightParticleEntity(Private).

Definition at line 42 of file OOLightParticleEntity.m.

313{
314 [sBlobTexture release];
316}

◆ setColor:

- (void) setColor: (OOColor *) color

Definition at line 42 of file OOLightParticleEntity.m.

87 :(OOColor *)color
88{
89 [color getRed:&_colorComponents[0] green:&_colorComponents[1] blue:&_colorComponents[2] alpha:&_colorComponents[3]];
90}
void getRed:green:blue:alpha:(float *red,[green] float *green,[blue] float *blue,[alpha] float *alpha)
Definition OOColor.m:368

Referenced by FlasherSetProperty().

+ Here is the caller graph for this function:

◆ setColor:alpha:

- (void) setColor: (OOColor *) color
alpha: (GLfloat) alpha 

Definition at line 42 of file OOLightParticleEntity.m.

93 :(OOColor *)color alpha:(GLfloat)alpha
94{
95 [self setColor:color];
96 _colorComponents[3] = alpha;
97}

◆ setDiameter:

- (void) setDiameter: (float) diameter

Definition at line 42 of file OOLightParticleEntity.m.

81 :(float)diameter
82{
84}

Referenced by FlasherSetProperty().

+ Here is the caller graph for this function:

◆ setUpTexture

+ (void) setUpTexture

Reimplemented in OOFlashEffectEntity.

Definition at line 42 of file OOLightParticleEntity.m.

292{
293 if (sBlobTexture == nil)
294 {
295 sBlobTexture = [[OOTexture textureWithName:@"oolite-particle-blur.png"
296 inFolder:@"Textures"
297 options:kOOTextureMinFilterMipMap | kOOTextureMagFilterLinear | kOOTextureAlphaMask
298 anisotropy:kOOTextureDefaultAnisotropy / 2.0
299 lodBias:0.0] retain];
300 [[OOGraphicsResetManager sharedManager] registerClient:(id<OOGraphicsResetClient>)[OOLightParticleEntity class]];
301 }
302}
void registerClient:(id< OOGraphicsResetClient > client)
OOGraphicsResetManager * sharedManager()
id textureWithName:inFolder:options:anisotropy:lodBias:(NSString *name,[inFolder] NSString *directory,[options] OOTextureFlags options,[anisotropy] GLfloat anisotropy,[lodBias] GLfloat lodBias)
Definition OOTexture.m:134

◆ texture

- (OOTexture *) texture

Reimplemented in OOFlashEffectEntity.

Definition at line 42 of file OOLightParticleEntity.m.

Member Data Documentation

◆ _colorComponents

- (GLfloat _colorComponents[4])
protected

Definition at line 36 of file OOLightParticleEntity.h.

◆ _diameter

- (float) _diameter
protected

Definition at line 37 of file OOLightParticleEntity.h.


The documentation for this class was generated from the following files: