void CoreGeometryObject2D_Imp::Draw(Renderer2D* renderer) { if (!GetAbsoluteBeingDrawn() || !GetIsAlive() || m_shape == nullptr) { return; } auto shape_Imp = CoreShape2DToImp(m_shape); auto& triangles = shape_Imp->GetDividedTriangles(); if (triangles.size() == 0) { auto layer = GetLayer(); auto g = (Graphics_Imp*)layer->GetGraphicsImp(); g->GetLog()->Write("無効な形状を描画しました。正しく表示されない場合があります。", LogLevel::Warning); } for (auto triangle : triangles) { std::array<Vector2DF, 4> position; std::array<Vector2DF, 4> uvs; for (int i = 0; i < 3; ++i) { position[i] = triangle->GetPointByIndex(i); uvs[i] = triangle->GetUVByIndex(i); } position[3] = position[2]; uvs[3] = uvs[2]; auto matrix = GetAbsoluteMatrixToTransform(); for (auto& pos : position) { pos -= centerPosition; auto v3 = Vector3DF(pos.X, pos.Y, 1); auto result = matrix * v3; pos = Vector2DF(result.X, result.Y); } Color color[4]; auto col = GetAbsoluteColor(); color[0] = col; color[1] = col; color[2] = col; color[3] = col; renderer->AddSprite( position.data(), color, uvs.data(), (m_shape->GetShapeType() == ShapeType::LineShape) ? nullptr : m_texture, alphaBlendMode, GetAbsoluteDrawingPriority(), m_textureFilterType); } }
void Object2D::Update() { if (!m_isUpdated || !GetIsAlive()) { return; } OnUpdate(); m_componentManager.Update(); }