// Send our values to the shader void LineMaterial::SendValuesToShader() { SetVec4("LineColor", _lineColor); SetMatrix("World", _world); SetMatrix("Projection", _projection); }
void GamePad::DebugDraw() { for(u32 i=0; i<numJoysticks; ++i) { GamePadJoystick* pJoystick = &joysticks[i]; const vec3 topLeft = {pJoystick->boundingBox.X0,pJoystick->boundingBox.Y0,0.0f}; const vec3 botRight = {pJoystick->boundingBox.X1,pJoystick->boundingBox.Y1,0.0f}; const vec3 topRight = {botRight.x,topLeft.y,0.0f}; const vec3 botLeft = {topLeft.x,botRight.y,0.0f}; const vec4 boxColor = {1.0f,0.0f,1.0f,1.0f}; GLRENDERER->DEBUGDRAW_DrawLineSegment(DebugDrawMode_Screen2D,&topLeft,&topRight,&boxColor); GLRENDERER->DEBUGDRAW_DrawLineSegment(DebugDrawMode_Screen2D,&topRight,&botRight,&boxColor); GLRENDERER->DEBUGDRAW_DrawLineSegment(DebugDrawMode_Screen2D,&botRight,&botLeft,&boxColor); GLRENDERER->DEBUGDRAW_DrawLineSegment(DebugDrawMode_Screen2D,&botLeft,&topLeft,&boxColor); const vec4 circleColor = {1.0f,1.0f,0.0f,1.0f}; const vec3 circlePos = {pJoystick->stickCenter.x,pJoystick->stickCenter.y,0.0f}; GLRENDERER->DEBUGDRAW_DrawCircleXY(DebugDrawMode_Screen2D, &circlePos, pJoystick->stickRadius, &circleColor); const vec4 circleColorStick = {1.0f,0.0f,0.0f,1.0f}; const vec3 circlePosStick = {pJoystick->stickJoystickPos.x,pJoystick->stickJoystickPos.y,0.0f}; GLRENDERER->DEBUGDRAW_DrawCircleXY(DebugDrawMode_Screen2D,&circlePosStick,pJoystick->stickRadius/4.0f,&circleColorStick); } for(u32 i=0; i<numButtons; ++i) { GamePadButton* pButton = &buttons[i]; const vec3 topLeft = {pButton->boundingBox.X0,pButton->boundingBox.Y0,0.0f}; const vec3 botRight = {pButton->boundingBox.X1,pButton->boundingBox.Y1,0.0f}; const vec3 topRight = {botRight.x,topLeft.y,0.0f}; const vec3 botLeft = {topLeft.x,botRight.y,0.0f}; const vec4 boxColor = {1.0f,0.6f,1.0f,1.0f}; GLRENDERER->DEBUGDRAW_DrawLineSegment(DebugDrawMode_Screen2D,&topLeft,&topRight,&boxColor); GLRENDERER->DEBUGDRAW_DrawLineSegment(DebugDrawMode_Screen2D,&topRight,&botRight,&boxColor); GLRENDERER->DEBUGDRAW_DrawLineSegment(DebugDrawMode_Screen2D,&botRight,&botLeft,&boxColor); GLRENDERER->DEBUGDRAW_DrawLineSegment(DebugDrawMode_Screen2D,&botLeft,&topLeft,&boxColor); vec4 circleColor; f32 circleRadius; if(pButton->value & (1<<GamePadButtonState_On)) { SetVec4(&circleColor,0,1,0,1); circleRadius = pButton->buttonRadius*1.5f; } else if(pButton->value & (1<<GamePadButtonState_Released)) { SetVec4(&circleColor,1,1,0,1); circleRadius = pButton->buttonRadius*2.5f; } else { circleRadius = pButton->buttonRadius; SetVec4(&circleColor,1,0,0,1); } const vec3 circlePosStick = {pButton->buttonCenter.x,pButton->buttonCenter.y,0.0f}; GLRENDERER->DEBUGDRAW_DrawCircleXY(DebugDrawMode_Screen2D,&circlePosStick, circleRadius, &circleColor); } }
void Shader::SetVec4(std::string n_name,glm::vec4 n_vec) { SetVec4(n_name,n_vec.x,n_vec.y,n_vec.z,n_vec.w); }