34@interface OOBreakPatternEntity (Private)
36- (void) setInnerColorComponents:(GLfloat[4])color1 outerColorComponents:(GLfloat[4])color2;
43- (id) initWithPolygonSides:(NSUInteger)sides startAngle:(
float)startAngleDegrees aspectRatio:(
float)aspectRatio
47 if ((
self = [super
init]))
50 float angle = startAngleDegrees *
M_PI / 180.0f;
51 float deltaAngle =
M_PI * 2.0f / sides;
52 float xAspect = fmin(1.0f, aspectRatio);
53 float yAspect = fmin(1.0f, 1.0f / aspectRatio);
56 for (NSUInteger i = 0; i < sides; i++)
58 float s = sin(angle) * xAspect;
59 float c = cos(angle) * yAspect;
43- (id) initWithPolygonSides:(NSUInteger)sides startAngle:(
float)startAngleDegrees aspectRatio:(
float)aspectRatio {
…}
83+ (instancetype) breakPatternWithPolygonSides:(NSUInteger)sides startAngle:(
float)startAngleDegrees aspectRatio:(
float)aspectRatio
85 return [[[
self alloc] initWithPolygonSides:sides startAngle:startAngleDegrees aspectRatio:aspectRatio] autorelease];
83+ (instancetype) breakPatternWithPolygonSides:(NSUInteger)sides startAngle:(
float)startAngleDegrees aspectRatio:(
float)aspectRatio {
…}
91 GLfloat inner[4], outer[4];
98- (void) setInnerColorComponents:(GLfloat[4])color1 outerColorComponents:(GLfloat[4])color2
100 GLfloat *colors[2] = { color1, color2 };
102 for (NSUInteger i = 0; i < _vertexCount; i++)
104 GLfloat *color = colors[
i & 1];
105 memcpy(&_vertexColor[i], color,
sizeof (GLfloat) * 4);
98- (void) setInnerColorComponents:(GLfloat[4])color1 outerColorComponents:(GLfloat[4])color2 {
…}
110- (void) setLifetime:(
double)lifetime
110- (void) setLifetime:(
double)lifetime {
…}
123 [UNIVERSE removeEntity:
self];
128- (void) drawImmediate:(
bool)immediate translucent:(
bool)translucent
133 if (translucent || immediate)
138 OOGL(glDisable(GL_LIGHTING));
139 OOGL(glDisable(GL_TEXTURE_2D));
140 OOGL(glEnable(GL_BLEND));
141 OOGL(glDepthMask(GL_FALSE));
142 OOGL(glDisableClientState(GL_NORMAL_ARRAY));
145 OOGL(glEnableClientState(GL_COLOR_ARRAY));
150 OOGL(glEnable(GL_LIGHTING));
151 OOGL(glEnable(GL_TEXTURE_2D));
152 OOGL(glDisable(GL_BLEND));
153 OOGL(glDepthMask(GL_TRUE));
154 OOGL(glEnableClientState(GL_NORMAL_ARRAY));
155 OOGL(glDisableClientState(GL_COLOR_ARRAY));
128- (void) drawImmediate:(
bool)immediate translucent:(
bool)translucent {
…}
177@implementation Entity (OOBreakPatternEntity)
#define BREAK_PATTERN_RING_SPEED
@ kOOBreakPatternMaxSides
#define OO_ENTER_OPENGL()
#define OOVerifyOpenGLState()
BOOL OOCheckOpenGLErrors(NSString *format,...)
#define OOSetOpenGLState(STATE)
unsigned isImmuneToBreakPatternHide
void update:(OOTimeDelta delta_t)
void setScanClass:(OOScanClass sClass)
void setStatus:(OOEntityStatus stat)
void setInnerColorComponents:outerColorComponents:(GLfloat[4] color1, [outerColorComponents] GLfloat[4] color2)
GLfloat _vertexColor[kOOBreakPatternMaxVertices][4]
Vector _vertexPosition[kOOBreakPatternMaxVertices]
void getRed:green:blue:alpha:(float *red,[green] float *green,[blue] float *blue,[alpha] float *alpha)