Oolite
Loading...
Searching...
No Matches
OOBreakPatternEntity Class Reference

#include <OOBreakPatternEntity.h>

Inheritance diagram for OOBreakPatternEntity:
Collaboration diagram for OOBreakPatternEntity:

Instance Methods

(void) - setInnerColor:outerColor:
(void) - setLifetime:
(id) - initWithPolygonSides:startAngle:aspectRatio: [implementation]
(void) - setInnerColorComponents:outerColorComponents: [implementation]
(void) - update: [implementation]
(void) - drawImmediate:translucent: [implementation]
(BOOL) - canCollide [implementation]
(BOOL) - isBreakPattern [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) - isEffect
(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) - applyVelocity:
(BOOL) - checkCloseCollisionWith:
(void) - takeEnergyDamage:from:becauseOf:weaponIdentifier:
(void) - dumpState
(void) - dumpSelfState
(NSUInteger) - lastDrawCounter
(void) - setLastDrawCounter:
(double) - findCollisionRadius
(BOOL) - isVisible
(BOOL) - isInSpace
(BOOL) - isImmuneToBreakPatternHide
(GLfloat) - universalTime
(GLfloat) - spawnTime
(GLfloat) - timeElapsedSinceSpawn
(void) - setAtmosphereFogging:
(OOColor *) - fogUniform
(id) - init [implementation]
(void) - dealloc [implementation]
(NSString *) - descriptionComponents [implementation]
(BOOL) - checkLinkedLists [implementation]
(id< OOWeakReferenceSupport >) - superShaderBindingTarget [implementation]
(Vector) - relativePosition [implementation]
(void) - subEntityReallyDied: [implementation]
(BOOL) - isECMBlast
(BOOL) - isExhaust
(BOOL) - isFlasher
(BOOL) - isVisibleToScripts
(BOOL) - isVisibleToScripts
(NSString *) - oo_jsClassName
(NSString *) - oo_jsClassName
(void) - getJSClass:andPrototype:
(void) - deleteJSSelf
(void) - deleteJSSelf
(JSClassID) - oo_jsClassID
(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:
(void) - drawSubEntityImmediate:translucent: [implementation]
Instance Methods inherited from OOWeakRefObject
(id) - weakSelf
(id) - weakRetain [implementation]
(void) - weakRefDied: [implementation]
Instance Methods inherited from <OOWeakReferenceSupport>
(id) - OO_RETURNS_RETAINED

Class Methods

(instancetype) + breakPatternWithPolygonSides:startAngle:aspectRatio:

Private Attributes

Vector _vertexPosition [kOOBreakPatternMaxVertices]
GLfloat _vertexColor [kOOBreakPatternMaxVertices][4]
NSUInteger _vertexCount
double _lifetime

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
OOColor * atmosphereFogging
int zero_index
Entity * x_previous
Entity * x_next
Entity * y_previous
Entity * y_next
Entity * z_previous
Entity * z_next
Entity * collision_chain
OOUniversalID shadingEntityID
Entity * collider
CollisionRegion * collisionRegion
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
NSUInteger lastDrawCounter
Protected Attributes inherited from OOWeakRefObject
OOWeakReference * weakSelf

Detailed Description

Definition at line 40 of file OOBreakPatternEntity.h.

Method Documentation

◆ breakPatternWithPolygonSides:startAngle:aspectRatio:

+ (instancetype) breakPatternWithPolygonSides: (NSUInteger) sides
startAngle: (float) startAngleDegrees
aspectRatio: (float) aspectRatio 

Definition at line 78 of file OOBreakPatternEntity.m.

78 :(NSUInteger)sides startAngle:(float)startAngleDegrees aspectRatio:(float)aspectRatio
79{
80 return [[[self alloc] initWithPolygonSides:sides startAngle:startAngleDegrees aspectRatio:aspectRatio] autorelease];
81}

Referenced by Universe::setUpBreakPattern:orientation:forDocking:.

Here is the caller graph for this function:

◆ canCollide

- (BOOL) canCollide
implementation

Reimplemented from Entity.

Definition at line 150 of file OOBreakPatternEntity.m.

151{
152 return NO;
153}

References canCollide.

Referenced by canCollide.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawImmediate:translucent:

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

Reimplemented from Entity.

Definition at line 116 of file OOBreakPatternEntity.m.

116 :(bool)immediate translucent:(bool)translucent
117{
118 // check if has been hidden.
120 return;
121
122 if (translucent || immediate) {
125
126 OOGL(glDisable(GL_LIGHTING));
127 OOGL(glDisable(GL_TEXTURE_2D));
128 OOGL(glEnable(GL_BLEND));
129 OOGL(glDepthMask(GL_FALSE));
130 OOGL(glDisableClientState(GL_NORMAL_ARRAY));
131
132 OOGL(glVertexPointer(3, GL_FLOAT, 0, _vertexPosition));
133 OOGL(glEnableClientState(GL_COLOR_ARRAY));
134 OOGL(glColorPointer(4, GL_FLOAT, 0, _vertexColor));
135
136 OOGL(glDrawArrays(GL_TRIANGLE_STRIP, 0, _vertexCount));
137
138 OOGL(glEnable(GL_LIGHTING));
139 OOGL(glEnable(GL_TEXTURE_2D));
140 OOGL(glDisable(GL_BLEND));
141 OOGL(glDepthMask(GL_TRUE));
142 OOGL(glEnableClientState(GL_NORMAL_ARRAY));
143 OOGL(glDisableClientState(GL_COLOR_ARRAY));
144
146 OOCheckOpenGLErrors(@"OOBreakPatternEntity after drawing %@", self);
147 }
148}
#define OO_ENTER_OPENGL()
@ OPENGL_STATE_OPAQUE
Definition OOOpenGL.h:121
#define OOVerifyOpenGLState()
Definition OOOpenGL.h:133
BOOL OOCheckOpenGLErrors(NSString *format,...)
Definition OOOpenGL.m:38
#define OOSetOpenGLState(STATE)
Definition OOOpenGL.h:132
#define OOGL(statement)
Definition OOOpenGL.h:262
unsigned isImmuneToBreakPatternHide
Definition Entity.m:1050
GLfloat _vertexColor[kOOBreakPatternMaxVertices][4]
Vector _vertexPosition[kOOBreakPatternMaxVertices]

References _vertexColor, _vertexCount, _vertexPosition, Entity::isImmuneToBreakPatternHide, OO_ENTER_OPENGL, OOCheckOpenGLErrors(), OOGL, OOSetOpenGLState, OOVerifyOpenGLState, and OPENGL_STATE_OPAQUE.

Here is the call graph for this function:

◆ initWithPolygonSides:startAngle:aspectRatio:

- (id) initWithPolygonSides: (NSUInteger) sides
startAngle: (float) startAngleDegrees
aspectRatio: (float) aspectRatio 
implementation

Definition at line 41 of file OOBreakPatternEntity.m.

41 :(NSUInteger)sides startAngle:(float)startAngleDegrees aspectRatio:(float)aspectRatio
42{
43 sides = MIN(MAX((NSUInteger)3, sides), (NSUInteger)kOOBreakPatternMaxSides);
44
45 if ((self = [super init])) {
46 _vertexCount = (sides + 1) * 2;
47 float angle = startAngleDegrees * M_PI / 180.0f;
48 float deltaAngle = M_PI * 2.0f / sides;
49 float xAspect = fmin(1.0f, aspectRatio);
50 float yAspect = fmin(1.0f, 1.0f / aspectRatio);
51
52 NSUInteger vi = 0;
53 for (NSUInteger i = 0; i < sides; i++) {
54 float s = sin(angle) * xAspect;
55 float c = cos(angle) * yAspect;
56
57 _vertexPosition[vi++] = (Vector) { s * 50, c * 50, -40 };
58 _vertexPosition[vi++] = (Vector) { s * 40, c * 40, 0 };
59
60 angle += deltaAngle;
61 }
62
65
66 [self setInnerColorComponents:(GLfloat[]) { 1.0f, 0.0f, 0.0f, 0.5f }
67 outerColorComponents:(GLfloat[]) { 0.0f, 0.0f, 1.0f, 0.25f }];
68
69 [self setStatus:STATUS_EFFECT];
70 [self setScanClass:CLASS_NO_DRAW];
71
73 }
74
75 return self;
76}
@ kOOBreakPatternMaxSides
#define MAX(A, B)
Definition OOMaths.h:94
#define MIN(A, B)
Definition OOMaths.h:91
#define M_PI
Definition OOMaths.h:54
struct Vector Vector
id init()
Definition Entity.m:64

References _vertexCount, _vertexPosition, Entity::init, Entity::isImmuneToBreakPatternHide, kOOBreakPatternMaxSides, M_PI, MAX, MIN, setInnerColorComponents:outerColorComponents:, Entity::setScanClass:, and Entity::setStatus:.

Here is the call graph for this function:

◆ isBreakPattern

- (BOOL) isBreakPattern
implementation

Reimplemented from Entity.

Definition at line 155 of file OOBreakPatternEntity.m.

156{
157 return YES;
158}

References isBreakPattern.

Referenced by isBreakPattern.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setInnerColor:outerColor:

- (void) setInnerColor: (OOColor*) color1
outerColor: (OOColor*) color2 

Definition at line 83 of file OOBreakPatternEntity.m.

83 :(OOColor*)color1 outerColor:(OOColor*)color2
84{
85 GLfloat inner[4], outer[4];
86 [color1 getRed:&inner[0] green:&inner[1] blue:&inner[2] alpha:&inner[3]];
87 [color2 getRed:&outer[0] green:&outer[1] blue:&outer[2] alpha:&outer[3]];
88 [self setInnerColorComponents:inner outerColorComponents:outer];
89}
void getRed:green:blue:alpha:(float *red,[green] float *green,[blue] float *blue,[alpha] float *alpha)
Definition OOColor.m:344

References OOColor::getRed:green:blue:alpha:, and setInnerColorComponents:outerColorComponents:.

Referenced by Universe::setUpBreakPattern:orientation:forDocking:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setInnerColorComponents:outerColorComponents:

- (void) setInnerColorComponents: (GLfloat[4]) color1
outerColorComponents: (GLfloat[4]) color2 
implementation

Provided by category OOBreakPatternEntity(Private).

Definition at line 91 of file OOBreakPatternEntity.m.

91 :(GLfloat[4])color1 outerColorComponents:(GLfloat[4])color2
92{
93 GLfloat* colors[2] = { color1, color2 };
94
95 for (NSUInteger i = 0; i < _vertexCount; i++) {
96 GLfloat* color = colors[i & 1];
97 memcpy(&_vertexColor[i], color, sizeof(GLfloat) * 4);
98 }
99}

Referenced by initWithPolygonSides:startAngle:aspectRatio:, and setInnerColor:outerColor:.

Here is the caller graph for this function:

◆ setLifetime:

- (void) setLifetime: (double) lifetime

Definition at line 101 of file OOBreakPatternEntity.m.

101 :(double)lifetime
102{
103 _lifetime = lifetime;
104}

References _lifetime.

Referenced by Universe::setUpBreakPattern:orientation:forDocking:.

Here is the caller graph for this function:

◆ update:

- (void) update: (OOTimeDelta) delta_t
implementation

Reimplemented from Entity.

Definition at line 106 of file OOBreakPatternEntity.m.

106 :(OOTimeDelta)delta_t
107{
108 [super update:delta_t];
109
111 if (_lifetime < 0.0) {
112 [UNIVERSE removeEntity:self];
113 }
114}
#define BREAK_PATTERN_RING_SPEED
double OOTimeDelta
Definition OOTypes.h:193

References _lifetime, BREAK_PATTERN_RING_SPEED, and Entity::update:.

Here is the call graph for this function:

Member Data Documentation

◆ _lifetime

- (double) _lifetime
private

Definition at line 45 of file OOBreakPatternEntity.h.

Referenced by setLifetime:, and update:.

◆ _vertexColor

- (GLfloat _vertexColor[kOOBreakPatternMaxVertices][4])
private

Definition at line 43 of file OOBreakPatternEntity.h.

Referenced by drawImmediate:translucent:.

◆ _vertexCount

- (NSUInteger) _vertexCount
private

◆ _vertexPosition

- (Vector _vertexPosition[kOOBreakPatternMaxVertices])
private

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