void CRenderTools::RenderQuads(CQuad *pQuads, int NumQuads, int RenderFlags, void (*pfnEval)(float TimeOffset, int Env, float *pChannels, void *pUser), void *pUser) { if(g_Config.m_ClShowEntities && g_Config.m_ClDDRaceCheats) return; Graphics()->QuadsBegin(); float Conv = 1/255.0f; for(int i = 0; i < NumQuads; i++) { CQuad *q = &pQuads[i]; float r=1, g=1, b=1, a=1; if(q->m_ColorEnv >= 0) { float aChannels[4]; pfnEval(q->m_ColorEnvOffset/1000.0f, q->m_ColorEnv, aChannels, pUser); r = aChannels[0]; g = aChannels[1]; b = aChannels[2]; a = aChannels[3]; } bool Opaque = false; if(a < 0.01f || (q->m_aColors[0].a < 0.01f && q->m_aColors[1].a < 0.01f && q->m_aColors[2].a < 0.01f && q->m_aColors[3].a < 0.01f)) Opaque = true; if(Opaque && !(RenderFlags&LAYERRENDERFLAG_OPAQUE)) continue; if(!Opaque && !(RenderFlags&LAYERRENDERFLAG_TRANSPARENT)) continue; Graphics()->QuadsSetSubsetFree( fx2f(q->m_aTexcoords[0].x), fx2f(q->m_aTexcoords[0].y), fx2f(q->m_aTexcoords[1].x), fx2f(q->m_aTexcoords[1].y), fx2f(q->m_aTexcoords[2].x), fx2f(q->m_aTexcoords[2].y), fx2f(q->m_aTexcoords[3].x), fx2f(q->m_aTexcoords[3].y) ); float OffsetX = 0; float OffsetY = 0; float Rot = 0; // TODO: fix this if(q->m_PosEnv >= 0) { float aChannels[4]; pfnEval(q->m_PosEnvOffset/1000.0f, q->m_PosEnv, aChannels, pUser); OffsetX = aChannels[0]; OffsetY = aChannels[1]; Rot = aChannels[2]/360.0f*pi*2; } IGraphics::CColorVertex Array[4] = { IGraphics::CColorVertex(0, q->m_aColors[0].r*Conv*r, q->m_aColors[0].g*Conv*g, q->m_aColors[0].b*Conv*b, q->m_aColors[0].a*Conv*a), IGraphics::CColorVertex(1, q->m_aColors[1].r*Conv*r, q->m_aColors[1].g*Conv*g, q->m_aColors[1].b*Conv*b, q->m_aColors[1].a*Conv*a), IGraphics::CColorVertex(2, q->m_aColors[2].r*Conv*r, q->m_aColors[2].g*Conv*g, q->m_aColors[2].b*Conv*b, q->m_aColors[2].a*Conv*a), IGraphics::CColorVertex(3, q->m_aColors[3].r*Conv*r, q->m_aColors[3].g*Conv*g, q->m_aColors[3].b*Conv*b, q->m_aColors[3].a*Conv*a)}; Graphics()->SetColorVertex(Array, 4); CPoint *pPoints = q->m_aPoints; if(Rot != 0) { static CPoint aRotated[4]; aRotated[0] = q->m_aPoints[0]; aRotated[1] = q->m_aPoints[1]; aRotated[2] = q->m_aPoints[2]; aRotated[3] = q->m_aPoints[3]; pPoints = aRotated; Rotate(&q->m_aPoints[4], &aRotated[0], Rot); Rotate(&q->m_aPoints[4], &aRotated[1], Rot); Rotate(&q->m_aPoints[4], &aRotated[2], Rot); Rotate(&q->m_aPoints[4], &aRotated[3], Rot); } IGraphics::CFreeformItem Freeform( fx2f(pPoints[0].x)+OffsetX, fx2f(pPoints[0].y)+OffsetY, fx2f(pPoints[1].x)+OffsetX, fx2f(pPoints[1].y)+OffsetY, fx2f(pPoints[2].x)+OffsetX, fx2f(pPoints[2].y)+OffsetY, fx2f(pPoints[3].x)+OffsetX, fx2f(pPoints[3].y)+OffsetY); Graphics()->QuadsDrawFreeform(&Freeform, 1); } Graphics()->QuadsEnd(); }
void CItems::RenderLaser(const struct CNetObj_Laser *pCurrent) { vec2 Pos = vec2(pCurrent->m_X, pCurrent->m_Y); vec2 From = vec2(pCurrent->m_FromX, pCurrent->m_FromY); vec2 Dir = normalize(Pos-From); float Ticks = Client()->GameTick() + Client()->IntraGameTick() - pCurrent->m_StartTick; float Ms = (Ticks/50.0f) * 1000.0f; float a = Ms / m_pClient->m_Tuning.m_LaserBounceDelay; a = clamp(a, 0.0f, 1.0f); float Ia = 1-a; vec2 Out, Border; Graphics()->BlendNormal(); Graphics()->TextureSet(-1); Graphics()->QuadsBegin(); //vec4 inner_color(0.15f,0.35f,0.75f,1.0f); //vec4 outer_color(0.65f,0.85f,1.0f,1.0f); // do outline vec4 OuterColor(0.075f, 0.075f, 0.25f, 1.0f); Graphics()->SetColor(OuterColor.r, OuterColor.g, OuterColor.b, 1.0f); Out = vec2(Dir.y, -Dir.x) * (7.0f*Ia); IGraphics::CFreeformItem Freeform( From.x-Out.x, From.y-Out.y, From.x+Out.x, From.y+Out.y, Pos.x-Out.x, Pos.y-Out.y, Pos.x+Out.x, Pos.y+Out.y); Graphics()->QuadsDrawFreeform(&Freeform, 1); // do inner vec4 InnerColor(0.5f, 0.5f, 1.0f, 1.0f); Out = vec2(Dir.y, -Dir.x) * (5.0f*Ia); Graphics()->SetColor(InnerColor.r, InnerColor.g, InnerColor.b, 1.0f); // center Freeform = IGraphics::CFreeformItem( From.x-Out.x, From.y-Out.y, From.x+Out.x, From.y+Out.y, Pos.x-Out.x, Pos.y-Out.y, Pos.x+Out.x, Pos.y+Out.y); Graphics()->QuadsDrawFreeform(&Freeform, 1); Graphics()->QuadsEnd(); // render head { Graphics()->BlendNormal(); Graphics()->TextureSet(g_pData->m_aImages[IMAGE_PARTICLES].m_Id); Graphics()->QuadsBegin(); int Sprites[] = {SPRITE_PART_SPLAT01, SPRITE_PART_SPLAT02, SPRITE_PART_SPLAT03}; RenderTools()->SelectSprite(Sprites[Client()->GameTick()%3]); Graphics()->QuadsSetRotation(Client()->GameTick()); Graphics()->SetColor(OuterColor.r, OuterColor.g, OuterColor.b, 1.0f); IGraphics::CQuadItem QuadItem(Pos.x, Pos.y, 24, 24); Graphics()->QuadsDraw(&QuadItem, 1); Graphics()->SetColor(InnerColor.r, InnerColor.g, InnerColor.b, 1.0f); QuadItem = IGraphics::CQuadItem(Pos.x, Pos.y, 20, 20); Graphics()->QuadsDraw(&QuadItem, 1); Graphics()->QuadsEnd(); } Graphics()->BlendNormal(); }
void CItems::RenderLaser(const struct CNetObj_Laser *pCurrent) { vec3 RGB; vec2 Pos = vec2(pCurrent->m_X, pCurrent->m_Y); vec2 From = vec2(pCurrent->m_FromX, pCurrent->m_FromY); vec2 Dir = normalize(Pos-From); float Ticks = Client()->GameTick() + Client()->IntraGameTick() - pCurrent->m_StartTick; float Ms = (Ticks/50.0f) * 1000.0f; float a = Ms / m_pClient->m_Tuning[g_Config.m_ClDummy].m_LaserBounceDelay; a = clamp(a, 0.0f, 1.0f); float Ia = 1-a; vec2 Out, Border; Graphics()->BlendNormal(); Graphics()->TextureSet(-1); Graphics()->QuadsBegin(); //vec4 inner_color(0.15f,0.35f,0.75f,1.0f); //vec4 outer_color(0.65f,0.85f,1.0f,1.0f); // do outline RGB = HslToRgb(vec3(g_Config.m_ClLaserOutlineHue / 255.0f, g_Config.m_ClLaserOutlineSat / 255.0f, g_Config.m_ClLaserOutlineLht / 255.0f)); vec4 OuterColor(RGB.r, RGB.g, RGB.b, 1.0f); Graphics()->SetColor(OuterColor.r, OuterColor.g, OuterColor.b, 1.0f); Out = vec2(Dir.y, -Dir.x) * (7.0f*Ia); IGraphics::CFreeformItem Freeform( From.x-Out.x, From.y-Out.y, From.x+Out.x, From.y+Out.y, Pos.x-Out.x, Pos.y-Out.y, Pos.x+Out.x, Pos.y+Out.y); Graphics()->QuadsDrawFreeform(&Freeform, 1); // do inner RGB = HslToRgb(vec3(g_Config.m_ClLaserInnerHue / 255.0f, g_Config.m_ClLaserInnerSat / 255.0f, g_Config.m_ClLaserInnerLht / 255.0f)); vec4 InnerColor(RGB.r, RGB.g, RGB.b, 1.0f); Out = vec2(Dir.y, -Dir.x) * (5.0f*Ia); Graphics()->SetColor(InnerColor.r, InnerColor.g, InnerColor.b, 1.0f); // center Freeform = IGraphics::CFreeformItem( From.x-Out.x, From.y-Out.y, From.x+Out.x, From.y+Out.y, Pos.x-Out.x, Pos.y-Out.y, Pos.x+Out.x, Pos.y+Out.y); Graphics()->QuadsDrawFreeform(&Freeform, 1); Graphics()->QuadsEnd(); //H-Client CServerInfo Info; Client()->GetServerInfo(&Info); if(!str_find_nocase(Info.m_aGameType, "race") && !str_find_nocase(Info.m_aGameType, "ddnet") && length(Pos-From) != 0 && Pos != From) { vec2 cPos = From; for (int i=0; i<length(From-Pos); i++) { m_pClient->m_pEffects->LaserTrail(cPos, Dir, InnerColor); cPos += Dir; } } // // render head { Graphics()->BlendNormal(); Graphics()->TextureSet(g_pData->m_aImages[IMAGE_PARTICLES].m_Id); Graphics()->QuadsBegin(); int Sprites[] = {SPRITE_PART_SPLAT01, SPRITE_PART_SPLAT02, SPRITE_PART_SPLAT03}; RenderTools()->SelectSprite(Sprites[Client()->GameTick()%3]); Graphics()->QuadsSetRotation(Client()->GameTick()); Graphics()->SetColor(OuterColor.r, OuterColor.g, OuterColor.b, 1.0f); IGraphics::CQuadItem QuadItem(Pos.x, Pos.y, 24, 24); Graphics()->QuadsDraw(&QuadItem, 1); Graphics()->SetColor(InnerColor.r, InnerColor.g, InnerColor.b, 1.0f); QuadItem = IGraphics::CQuadItem(Pos.x, Pos.y, 20, 20); Graphics()->QuadsDraw(&QuadItem, 1); Graphics()->QuadsEnd(); } Graphics()->BlendNormal(); }
void CItems::RenderLaser(const struct CNetObj_Laser *pCurrent) { vec2 Pos = vec2(pCurrent->m_X, pCurrent->m_Y); vec2 From = vec2(pCurrent->m_FromX, pCurrent->m_FromY); vec2 Dir = normalize(Pos-From); float Ticks = Client()->GameTick() + Client()->IntraGameTick() - pCurrent->m_StartTick; float Ms = (Ticks/50.0f) * 1000.0f; float a = Ms / m_pClient->m_Tuning.m_LaserBounceDelay; a = clamp(a, 0.0f, 1.0f); float Ia = 1-a; vec2 Out, Border; Graphics()->BlendNormal(); Graphics()->TextureSet(-1); //vec4 inner_color(0.15f,0.35f,0.75f,1.0f); //vec4 outer_color(0.65f,0.85f,1.0f,1.0f); vec4 OuterColor(0.075f, 0.075f, 0.25f, 1.0f); vec4 InnerColor(0.5f, 0.5f, 1.0f, 1.0f); int EventID = m_pClient->m_pLua->m_pEventListener->CreateEventStack(); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(From.x); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(From.y); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(Pos.x); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(Pos.y); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(a); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(OuterColor.r); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(OuterColor.g); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(OuterColor.b); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(OuterColor.a); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(InnerColor.r); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(InnerColor.g); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(InnerColor.b); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(InnerColor.a); m_pClient->m_pLua->m_pEventListener->OnEvent("OnRenderLaser"); if (m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[0].IsNumeric() == false || m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[0].GetInteger() == 0) { if (m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[1].IsNumeric()) OuterColor.r = m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[1].GetFloat(); if (m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[2].IsNumeric()) OuterColor.g = m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[2].GetFloat(); if (m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[3].IsNumeric()) OuterColor.b = m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[3].GetFloat(); if (m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[4].IsNumeric()) OuterColor.a = m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[4].GetFloat(); if (m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[5].IsNumeric()) InnerColor.r = m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[5].GetFloat(); if (m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[6].IsNumeric()) InnerColor.g = m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[6].GetFloat(); if (m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[7].IsNumeric()) InnerColor.b = m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[7].GetFloat(); if (m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[8].IsNumeric()) InnerColor.a = m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[8].GetFloat(); if (m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[9].IsNumeric()) a = clamp(m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[9].GetFloat(), 0.0f, 1.0f); Ia = 1-a; //re-evalute if (m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[10].IsNumeric()) From.x = m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[10].GetFloat(); if (m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[11].IsNumeric()) From.y = m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[11].GetFloat(); if (m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[12].IsNumeric()) Pos.x = m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[12].GetFloat(); if (m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[13].IsNumeric()) Pos.y = m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[13].GetFloat(); Dir = normalize(Pos-From); Graphics()->QuadsBegin(); // do outline Graphics()->SetColor(OuterColor.r, OuterColor.g, OuterColor.b, OuterColor.a); Out = vec2(Dir.y, -Dir.x) * (7.0f*Ia); IGraphics::CFreeformItem Freeform( From.x-Out.x, From.y-Out.y, From.x+Out.x, From.y+Out.y, Pos.x-Out.x, Pos.y-Out.y, Pos.x+Out.x, Pos.y+Out.y); Graphics()->QuadsDrawFreeform(&Freeform, 1); // do inner Out = vec2(Dir.y, -Dir.x) * (5.0f*Ia); Graphics()->SetColor(InnerColor.r, InnerColor.g, InnerColor.b, InnerColor.a); // center Freeform = IGraphics::CFreeformItem( From.x-Out.x, From.y-Out.y, From.x+Out.x, From.y+Out.y, Pos.x-Out.x, Pos.y-Out.y, Pos.x+Out.x, Pos.y+Out.y); Graphics()->QuadsDrawFreeform(&Freeform, 1); Graphics()->QuadsEnd(); } // render head Graphics()->BlendNormal(); Graphics()->TextureSet(g_pData->m_aImages[IMAGE_PARTICLES].m_Id); EventID = m_pClient->m_pLua->m_pEventListener->CreateEventStack(); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(From.x); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(From.y); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(Pos.x); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(Pos.y); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(a); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(OuterColor.r); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(OuterColor.g); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(OuterColor.b); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(OuterColor.a); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(InnerColor.r); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(InnerColor.g); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(InnerColor.b); m_pClient->m_pLua->m_pEventListener->GetParameters(EventID)->FindFree()->Set(InnerColor.a); m_pClient->m_pLua->m_pEventListener->OnEvent("OnRenderLaserHead"); if (m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[0].IsNumeric() == false || m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[0].GetInteger() == 0) { if (m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[1].IsNumeric()) OuterColor.r = m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[1].GetFloat(); if (m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[2].IsNumeric()) OuterColor.g = m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[2].GetFloat(); if (m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[3].IsNumeric()) OuterColor.b = m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[3].GetFloat(); if (m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[4].IsNumeric()) OuterColor.a = m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[4].GetFloat(); if (m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[5].IsNumeric()) InnerColor.r = m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[5].GetFloat(); if (m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[6].IsNumeric()) InnerColor.g = m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[6].GetFloat(); if (m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[7].IsNumeric()) InnerColor.b = m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[7].GetFloat(); if (m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[8].IsNumeric()) InnerColor.a = m_pClient->m_pLua->m_pEventListener->GetReturns(EventID)->m_aVars[8].GetFloat(); Graphics()->QuadsBegin(); int Sprites[] = {SPRITE_PART_SPLAT01, SPRITE_PART_SPLAT02, SPRITE_PART_SPLAT03}; RenderTools()->SelectSprite(Sprites[Client()->GameTick()%3]); Graphics()->QuadsSetRotation(Client()->GameTick()); Graphics()->SetColor(OuterColor.r, OuterColor.g, OuterColor.b, OuterColor.a); IGraphics::CQuadItem QuadItem(Pos.x, Pos.y, 24, 24); Graphics()->QuadsDraw(&QuadItem, 1); Graphics()->SetColor(InnerColor.r, InnerColor.g, InnerColor.b, InnerColor.a); QuadItem = IGraphics::CQuadItem(Pos.x, Pos.y, 20, 20); Graphics()->QuadsDraw(&QuadItem, 1); Graphics()->QuadsEnd(); } Graphics()->BlendNormal(); }
void CRenderTools::RenderQuads(CQuad *pQuads, int NumQuads, int RenderFlags, ENVELOPE_EVAL pfnEval, void *pUser) { Graphics()->QuadsBegin(); float Conv = 1/255.0f; for(int i = 0; i < NumQuads; i++) { CQuad *q = &pQuads[i]; float r=1, g=1, b=1, a=1; if(q->m_ColorEnv >= 0) { float aChannels[4]; pfnEval(q->m_ColorEnvOffset/1000.0f, q->m_ColorEnv, aChannels, pUser); r = aChannels[0]; g = aChannels[1]; b = aChannels[2]; a = aChannels[3]; } /*bool Opaque = false; TODO: Analyze quadtexture if(a < 0.01f || (q->m_aColors[0].a < 0.01f && q->m_aColors[1].a < 0.01f && q->m_aColors[2].a < 0.01f && q->m_aColors[3].a < 0.01f)) Opaque = true; if(Opaque && !(RenderFlags&LAYERRENDERFLAG_OPAQUE)) continue; if(!Opaque && !(RenderFlags&LAYERRENDERFLAG_TRANSPARENT)) continue; */ vec2 aTexCoords[4]; for(int k = 0; k < 4; k++) { aTexCoords[k].x = fx2f(q->m_aTexcoords[k].x); aTexCoords[k].y = fx2f(q->m_aTexcoords[k].y); } // Check if we want to repeat the texture // Otherwise clamp to the edge to prevent texture bleeding bool RepeatU = false, RepeatV = false; for(int k = 0; k < 4; k++) { if(aTexCoords[k].x < 0.0f || aTexCoords[k].x > 1.0f) RepeatU = true; if(aTexCoords[k].y < 0.0f || aTexCoords[k].y > 1.0f) RepeatV = true; } Graphics()->WrapMode( RepeatU ? IGraphics::WRAP_REPEAT : IGraphics::WRAP_CLAMP, RepeatV ? IGraphics::WRAP_REPEAT : IGraphics::WRAP_CLAMP); Graphics()->QuadsSetSubsetFree( aTexCoords[0].x, aTexCoords[0].y, aTexCoords[1].x, aTexCoords[1].y, aTexCoords[2].x, aTexCoords[2].y, aTexCoords[3].x, aTexCoords[3].y); float OffsetX = 0; float OffsetY = 0; float Rot = 0; // TODO: fix this if(q->m_PosEnv >= 0) { float aChannels[4]; pfnEval(q->m_PosEnvOffset/1000.0f, q->m_PosEnv, aChannels, pUser); OffsetX = aChannels[0]; OffsetY = aChannels[1]; Rot = aChannels[2]/360.0f*pi*2; } IGraphics::CColorVertex Array[4] = { IGraphics::CColorVertex(0, q->m_aColors[0].r*Conv*r*q->m_aColors[0].a*Conv*a, q->m_aColors[0].g*Conv*g*q->m_aColors[0].a*Conv*a, q->m_aColors[0].b*Conv*b*q->m_aColors[0].a*Conv*a, q->m_aColors[0].a*Conv*a), IGraphics::CColorVertex(1, q->m_aColors[1].r*Conv*r*q->m_aColors[1].a*Conv*a, q->m_aColors[1].g*Conv*g*q->m_aColors[1].a*Conv*a, q->m_aColors[1].b*Conv*b*q->m_aColors[1].a*Conv*a, q->m_aColors[1].a*Conv*a), IGraphics::CColorVertex(2, q->m_aColors[2].r*Conv*r*q->m_aColors[2].a*Conv*a, q->m_aColors[2].g*Conv*g*q->m_aColors[2].a*Conv*a, q->m_aColors[2].b*Conv*b*q->m_aColors[2].a*Conv*a, q->m_aColors[2].a*Conv*a), IGraphics::CColorVertex(3, q->m_aColors[3].r*Conv*r*q->m_aColors[3].a*Conv*a, q->m_aColors[3].g*Conv*g*q->m_aColors[3].a*Conv*a, q->m_aColors[3].b*Conv*b*q->m_aColors[3].a*Conv*a, q->m_aColors[3].a*Conv*a)}; Graphics()->SetColorVertex(Array, 4); CPoint *pPoints = q->m_aPoints; if(Rot != 0) { static CPoint aRotated[4]; aRotated[0] = q->m_aPoints[0]; aRotated[1] = q->m_aPoints[1]; aRotated[2] = q->m_aPoints[2]; aRotated[3] = q->m_aPoints[3]; pPoints = aRotated; Rotate(&q->m_aPoints[4], &aRotated[0], Rot); Rotate(&q->m_aPoints[4], &aRotated[1], Rot); Rotate(&q->m_aPoints[4], &aRotated[2], Rot); Rotate(&q->m_aPoints[4], &aRotated[3], Rot); } IGraphics::CFreeformItem Freeform( fx2f(pPoints[0].x)+OffsetX, fx2f(pPoints[0].y)+OffsetY, fx2f(pPoints[1].x)+OffsetX, fx2f(pPoints[1].y)+OffsetY, fx2f(pPoints[2].x)+OffsetX, fx2f(pPoints[2].y)+OffsetY, fx2f(pPoints[3].x)+OffsetX, fx2f(pPoints[3].y)+OffsetY); Graphics()->QuadsDrawFreeform(&Freeform, 1); } Graphics()->QuadsEnd(); Graphics()->WrapNormal(); }