Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public:
- __declspec(dllexport) static bool RenderFrame(Camera camera) {
- for (size_t y = 0; y < ScreenClass::SizeY; y++)
- {
- for (size_t x = 0; x < ScreenClass::SizeX; x++)
- {
- bool IsDraw = false;//Костыль
- Vector2 currentPos;
- currentPos.x = x;
- currentPos.y = y;
- ConsoleInfo::SetCursorPosition({ static_cast<SHORT>(currentPos.x), static_cast<SHORT>(currentPos.y) });
- for (size_t z = 0; z < SpriteObject::AllSpriteObjects.size(); z++)
- {
- vector<Vector2> triangles = SpriteObject::AllSpriteObjects[z]->Mesh.Triangles;
- for (size_t t = 0; t < triangles.size(); t += 3)
- {
- float x1 = ((triangles[t].x + SpriteObject::AllSpriteObjects[z]->Position->x) - currentPos.x) * ((triangles[t + 1].y + SpriteObject::AllSpriteObjects[z]->Position->y) - (triangles[t].y + SpriteObject::AllSpriteObjects[z]->Position->y)) - ((triangles[t + 1].x + SpriteObject::AllSpriteObjects[z]->Position->x) - (triangles[t].x + SpriteObject::AllSpriteObjects[z]->Position->x)) * ((triangles[t].y + SpriteObject::AllSpriteObjects[z]->Position->y) - currentPos.y);
- float x2 = ((triangles[t + 1].x + SpriteObject::AllSpriteObjects[z]->Position->x) - currentPos.x) * ((triangles[t + 2].y + SpriteObject::AllSpriteObjects[z]->Position->y) - (triangles[t + 1].y + SpriteObject::AllSpriteObjects[z]->Position->y)) - ((triangles[t + 2].x + SpriteObject::AllSpriteObjects[z]->Position->x) - (triangles[t + 1].x + SpriteObject::AllSpriteObjects[z]->Position->x)) * ((triangles[t + 1].y + SpriteObject::AllSpriteObjects[z]->Position->y) - currentPos.y);
- float x3 = ((triangles[t + 2].x + SpriteObject::AllSpriteObjects[z]->Position->x) - currentPos.x) * ((triangles[t].y + SpriteObject::AllSpriteObjects[z]->Position->y) - (triangles[t + 2].y + SpriteObject::AllSpriteObjects[z]->Position->y)) - ((triangles[t].x + SpriteObject::AllSpriteObjects[z]->Position->x) - (triangles[t + 2].x + SpriteObject::AllSpriteObjects[z]->Position->x)) * ((triangles[t + 2].y + SpriteObject::AllSpriteObjects[z]->Position->y) - currentPos.y);
- if (x1 >= 0 && x2 >= 0 && x3 >= 0)
- {
- ConsoleInfo::SetConsoleColour(SpriteObject::AllSpriteObjects[z]->Color);
- IsDraw = true;//Костыль
- printf(&SpriteObject::AllSpriteObjects[z]->Texture);
- break;
- }
- else if (x1 <= 0 && x2 <= 0 && x3 <= 0)
- {
- ConsoleInfo::SetConsoleColour(SpriteObject::AllSpriteObjects[z]->Color);
- IsDraw = true;//Костыль
- printf(&SpriteObject::AllSpriteObjects[z]->Texture);
- break;
- }
- }
- }
- if (IsDraw == false)
- {
- printf(" ");
- }
- }
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment