Index: src/MD2.h ================================================================== --- src/MD2.h +++ src/MD2.h @@ -10,11 +10,11 @@ @property (nonatomic) int mdlnum; @property (nonatomic) bool loaded; + (instancetype)md2; - (bool)loadWithIRI:(OFIRI *)IRI; -- (void)renderWithLight:(OFVector3D)light +- (void)renderWithLight:(OFColor *)light frame:(int)frame range:(int)range position:(OFVector3D)position yaw:(float)yaw pitch:(float)pitch Index: src/MD2.m ================================================================== --- src/MD2.m +++ src/MD2.m @@ -136,11 +136,11 @@ -(snap(sn, cv[1] * cf->scale[1]) + cf->translate[1]) / sc; v->z = (snap(sn, cv[2] * cf->scale[2]) + cf->translate[2]) / sc; } } -- (void)renderWithLight:(OFVector3D)light +- (void)renderWithLight:(OFColor *)light frame:(int)frame range:(int)range position:(OFVector3D)position yaw:(float)yaw pitch:(float)pitch @@ -156,11 +156,13 @@ glPushMatrix(); glTranslatef(position.x, position.y, position.z); glRotatef(yaw + 180, 0, -1, 0); glRotatef(pitch, 0, 0, 1); - glColor3fv((float *)&light); + float red, green, blue; + [light getRed:&red green:&green blue:&blue alpha:NULL]; + glColor3f(red, green, blue); if (_displaylist && frame == 0 && range == 1) { glCallList(_displaylist); xtraverts += _displaylistverts; } else { Index: src/rendermd2.m ================================================================== --- src/rendermd2.m +++ src/rendermd2.m @@ -103,25 +103,29 @@ glBindTexture(GL_TEXTURE_2D, tex ? lookuptexture(tex, &xs, &ys) : FIRSTMDL + m.mdlnum); int ix = (int)position.x; int iy = (int)position.z; - OFVector3D light = OFMakeVector3D(1, 1, 1); + OFColor *light = [OFColor colorWithRed:1 green:1 blue:1 alpha:1]; if (!OUTBORD(ix, iy)) { struct sqr *s = S(ix, iy); float ll = 256.0f; // 0.96f; float of = 0.0f; // 0.1f; - light.x = s->r / ll + of; - light.y = s->g / ll + of; - light.z = s->b / ll + of; + light = [OFColor colorWithRed:s->r / ll + of + green:s->g / ll + of + blue:s->b / ll + of + alpha:1]; } if (teammate) { - light.x *= 0.6f; - light.y *= 0.7f; - light.z *= 1.2f; + float red, green, blue; + [light getRed:&red green:&green blue:&blue alpha:NULL]; + light = [OFColor colorWithRed:red * 0.6f + green:green * 0.7f + blue:blue * 1.2f + alpha:1]; } [m renderWithLight:light frame:frame range:range