std::shared_ptr<Font> ProfilerViewer_Imp::CreateFont_()
	{
		auto tex0 = (Texture2D*)m_graphics->CreateTexture2D_Imp_Internal(m_graphics, (uint8_t*)g_internalFontTex0, sizeof(g_internalFontTex0));
		auto tex1 = (Texture2D*)m_graphics->CreateTexture2D_Imp_Internal(m_graphics, (uint8_t*)g_internalFontTex1, sizeof(g_internalFontTex1));
		auto tex2 = (Texture2D*) m_graphics->CreateTexture2D_Imp_Internal(m_graphics, (uint8_t*) g_internalFontTex2, sizeof(g_internalFontTex2));

		std::vector<std::shared_ptr<Texture2D>> textures;
		textures.push_back(CreateSharedPtrWithReleaseDLL(tex0));
		textures.push_back(CreateSharedPtrWithReleaseDLL(tex1));
		textures.push_back(CreateSharedPtrWithReleaseDLL(tex2));

		auto font = new Font_Imp(m_graphics, (void*)g_internalFont, sizeof(g_internalFont), textures);

		return CreateSharedPtrWithReleaseDLL((Font*)font);
	}
Beispiel #2
0
	Layer3D::Layer3D(RenderSettings settings)
		: m_coreLayer(nullptr)
		, m_objects(std::make_shared<ObjectManager<Object3D>>(this))
	{
		m_coreLayer = CreateSharedPtrWithReleaseDLL(g_objectSystemFactory->CreateLayer3D(settings));
		m_commonObject = m_coreLayer;
	}
	void CoreLayer2D_Imp::DrawRotatedRectangleAdditionally(RectF drawingArea, Color color, Vector2DF rotationCenter, float angle, RectF uv, Texture2D* texture, AlphaBlendMode alphaBlend, int32_t priority)
	{
		Sprite sprite;

		std::array<Color, 4> col = { color, color, color, color };

		SafeAddRef(texture);

		auto vertexes = drawingArea.GetVertexes();

		auto globalCenter = vertexes[0] + rotationCenter;

		for (auto& vert : vertexes)
		{
			vert -= globalCenter;
			auto deg = vert.GetDegree();
			deg += angle;
			vert.SetDegree(deg);
			vert += globalCenter;
		}


		sprite.pos = vertexes;
		sprite.col = col;
		sprite.uv = uv.GetVertexes();
		sprite.Texture_ = CreateSharedPtrWithReleaseDLL(texture);
		sprite.AlphaBlend_ = alphaBlend;
		sprite.Priority = priority;

		sprites.push_back(sprite);
	}
Beispiel #4
0
	std::shared_ptr<AnimationClip> ModelObject3D::GetAnimationClip(const achar* name)
	{
		auto anim = m_coreObject->GetAnimationClip(name);
		if (anim == nullptr) return nullptr;
		SafeAddRef(anim);
		return CreateSharedPtrWithReleaseDLL(anim);
	}
	void CoreLayer2D_Imp::DrawShapeAdditionally(CoreShape* shape, Color color, Texture2D* texture, AlphaBlendMode alphaBlend, int32_t priority)
	{
		auto shape_Imp = CoreShape2DToImp(shape);
		for (auto triangle : shape_Imp->GetDividedTriangles())
		{
			std::array<Vector2DF, 4> pos;
			std::array<Vector2DF, 4> uvs;

			for (int i = 0; i < 3; ++i)
			{
				pos[i] = triangle->GetPointByIndex(i);
				uvs[i] = triangle->GetUVByIndex(i);
			}
			pos[3] = pos[2];
			uvs[3] = uvs[2];

			std::array<Color,4> col;
			col[0] = color;
			col[1] = color;
			col[2] = color;
			col[3] = color;

			Sprite sprite;

			sprite.pos = pos;
			sprite.col = col;
			sprite.uv = uvs;
			sprite.Texture_ = (shape->GetShapeType() == ShapeType::LineShape) ? nullptr : CreateSharedPtrWithReleaseDLL(texture);
			sprite.AlphaBlend_ = alphaBlend;
			sprite.Priority = priority;

			sprites.push_back(sprite);
		}
	}
	GeometryObject2D::GeometryObject2D()
		: m_coreObject(nullptr)
		, texturePtr(nullptr)
		, shapePtr(nullptr)
	{
		m_coreObject = CreateSharedPtrWithReleaseDLL(g_objectSystemFactory->CreateGeometryObject2D());
	}
Beispiel #7
0
	Layer2D::Layer2D()
		: m_coreLayer(nullptr)
		, m_objects(std::make_shared<ObjectManager<Object2D>>(this))
		, m_components(std::make_shared<ComponentManager<Layer2DComponent>>(this))
	{
		m_coreLayer = CreateSharedPtrWithReleaseDLL(g_objectSystemFactory->CreateLayer2D());
		m_commonObject = m_coreLayer;
	}
	void Layer::EndDrawing()
	{
		m_commonObject->EndDrawing();

		if (m_postEffects.size() > 0)
		{
			for (auto& p : m_postEffects)
			{
				GetScene()->m_coreScene->BeginPostEffect(p->GetCoreObject());

				GetScene()->m_coreScene->GetSrcTarget()->AddRef();
				GetScene()->m_coreScene->GetDstTarget()->AddRef();

				auto src = CreateSharedPtrWithReleaseDLL(GetScene()->m_coreScene->GetSrcTarget());
				auto dst = CreateSharedPtrWithReleaseDLL(GetScene()->m_coreScene->GetDstTarget());
				
				p->OnDraw(dst, src);

				GetScene()->m_coreScene->EndPostEffect(p->GetCoreObject());
			}
		}
	}
	void CoreLayer2D_Imp::DrawTextAdditionally(Vector2DF pos, Color color, Font* font, const achar* text, WritingDirection writingDirection, AlphaBlendMode alphaBlend, int32_t priority)
	{
		SafeAddRef(font);

		Text text_;
		text_.Position_ = pos;
		text_.Color_ = color;
		text_.Font_ = CreateSharedPtrWithReleaseDLL(font);
		text_.Text_ = text;
		text_.WritingDirection_ = writingDirection;
		text_.AlphaBlend_ = alphaBlend;
		text_.Priority_ = priority;

		texts.push_back(text_);
	}
Beispiel #10
0
	void CoreLayer2D_Imp::DrawRectangleAdditionally(RectF drawingArea, Color color, RectF uv, Texture2D* texture, AlphaBlendMode alphaBlend, int32_t priority)
	{
		Sprite sprite;

		std::array<Color, 4> col = { color, color, color, color };

		SafeAddRef(texture);

		sprite.pos = drawingArea.GetVertexes();
		sprite.col = col;
		sprite.uv = uv.GetVertexes();
		sprite.Texture_ = CreateSharedPtrWithReleaseDLL(texture);
		sprite.AlphaBlend_ = alphaBlend;
		sprite.Priority = priority;

		sprites.push_back(sprite);
	}
Beispiel #11
0
	void CoreLayer2D_Imp::DrawTriangleAdditionally(Vector2DF position1, Vector2DF position2, Vector2DF position3, Color color, Vector2DF uv1, Vector2DF uv2, Vector2DF uv3, Texture2D* texture, AlphaBlendMode alphaBlend, int32_t priority)
	{
		Sprite sprite;

		std::array<Vector2DF, 4> vertexes = { position1, position2, position3, position3 };
		std::array<Vector2DF, 4> uvs = { uv1, uv2, uv3, uv3 };

		std::array<Color, 4> col = { color, color, color, color };

		SafeAddRef(texture);

		sprite.pos = vertexes;
		sprite.col = col;
		sprite.uv = uvs;
		sprite.Texture_ = CreateSharedPtrWithReleaseDLL(texture);
		sprite.AlphaBlend_ = alphaBlend;
		sprite.Priority = priority;

		sprites.push_back(sprite);
	}
Beispiel #12
0
	void CoreLayer2D_Imp::DrawSpriteAdditionally(Vector2DF upperLeftPos, Vector2DF upperRightPos, Vector2DF lowerRightPos, Vector2DF lowerLeftPos,
		Color upperLeftCol, Color upperRightCol, Color lowerRightCol, Color lowerLeftCol,
		Vector2DF upperLeftUV, Vector2DF upperRightUV, Vector2DF lowerRightUV, Vector2DF lowerLeftUV,
		Texture2D* texture, AlphaBlendMode alphaBlend, int32_t priority)
	{
		Sprite sprite;
		std::array<Vector2DF, 4> pos = { upperLeftPos, upperRightPos, lowerRightPos, lowerLeftPos };
		std::array<Color, 4> col = { upperLeftCol, upperRightCol, lowerRightCol, lowerLeftCol };
		std::array<Vector2DF, 4> uv = { upperLeftUV, upperRightUV, lowerRightUV, lowerLeftUV };

		SafeAddRef(texture);

		sprite.pos = pos;
		sprite.col = col;
		sprite.uv = uv;
		sprite.Texture_ = CreateSharedPtrWithReleaseDLL(texture);
		sprite.AlphaBlend_ = alphaBlend;
		sprite.Priority = priority;

		sprites.push_back(sprite);
	}
Beispiel #13
0
	MapObject2D::MapObject2D()
		: m_coreObject(nullptr)
	{
		m_coreObject = CreateSharedPtrWithReleaseDLL(g_objectSystemFactory->CreateMapObject2D());
	}
Beispiel #14
0
	TerrainObject3D::TerrainObject3D()
	{
		m_coreObject = CreateSharedPtrWithReleaseDLL(g_objectSystemFactory->CreateCoreTerrainObject3D());
		m_commonObject = m_coreObject.get();
	}
Beispiel #15
0
	CircleShape::CircleShape()
	{
		m_coreObject = CreateSharedPtrWithReleaseDLL(g_objectSystemFactory->CreateCircleShape());
	}
Beispiel #16
0
	PolygonShape::PolygonShape()
	{
		m_coreObject = CreateSharedPtrWithReleaseDLL(g_objectSystemFactory->CreatePolygonShape());
	}
Beispiel #17
0
	//----------------------------------------------------------------------------------
	//
	//----------------------------------------------------------------------------------
	Material_Imp::Material_Imp()
	{
		MaterialPropertyBlock* block_ = new MaterialPropertyBlock_Imp();
		block = CreateSharedPtrWithReleaseDLL(block_);
	}
Beispiel #18
0
	void CoreLayer2D_Imp::DrawArcAdditionally(asd::Vector2DF center, float outerDiameter, float innerDiameter, Color color, int numberOfCorners, int startingCorner, int endingCorner, float angle, Texture2D* texture, AlphaBlendMode alphaBlend, int32_t priority)
	{
		if (numberOfCorners < 3) return;

		const float radInc = 360.0 / numberOfCorners;

		const float outerRadius = outerDiameter / 2;
		const float innerRadius = innerDiameter / 2;

		float currentPosDeg = angle - 90 + startingCorner*radInc;
		float currentUVDeg = -90 + startingCorner*radInc;

		Vector2DF baseVector(0, -1);
		baseVector.SetDegree(currentPosDeg);

		Vector2DF uvCenter = { 0.5, 0.5 };

		Vector2DF uvVector = { 0, -0.5 };

		float ratio = innerDiameter / outerDiameter;

		int endcorner = endingCorner;
		while (endcorner < startingCorner) endcorner += numberOfCorners;

		for (int i = 0; i < endcorner - startingCorner; ++i)
		{
			Vector2DF currentPosVector = baseVector;
			currentPosVector.SetDegree(currentPosDeg);

			Vector2DF nextPosVector = currentPosVector;
			auto nextPosDeg = nextPosVector.GetDegree();
			nextPosDeg += radInc;
			nextPosVector.SetDegree(nextPosDeg);

			Vector2DF currentUVVector = uvVector;
			currentUVVector.SetDegree(currentUVDeg);

			Vector2DF nextUVVector = currentUVVector;
			auto nextUVDeg = nextUVVector.GetDegree();
			nextUVDeg += radInc;
			nextUVVector.SetDegree(nextUVDeg);


			std::array<Vector2DF, 4> vertexes = { center + currentPosVector*outerRadius, center + nextPosVector*outerRadius, center + nextPosVector*innerRadius, center + currentPosVector*innerRadius };
			std::array<Vector2DF, 4> uvs = { uvCenter + currentUVVector, uvCenter + nextUVVector, uvCenter + nextUVVector*ratio, uvCenter + currentUVVector*ratio };
			std::array<Color, 4> colors = { color, color, color, color };

			SafeAddRef(texture);

			{
				Sprite sprite;

				sprite.pos = vertexes;
				sprite.col = colors;
				sprite.uv = uvs;
				sprite.Texture_ = CreateSharedPtrWithReleaseDLL(texture);
				sprite.AlphaBlend_ = alphaBlend;
				sprite.Priority = priority;

				sprites.push_back(sprite);
			}

			currentPosDeg += radInc;
			currentUVDeg += radInc;
		}
	}