Exemple #1
0
IShape* NodeFactory::CreateTriangle(float width, float height, const Color4F& color)
{
	ShapeTriangleMesh* mesh = MeshFactory::Instance().CreateShapeTriangleMesh(width, height, color);
	RETURN_NULL_IF_NULL(mesh);
	IMaterial* material = MaterialFactory::Instance().CreateShape(MEDUSA_PREFIX(Shape));
	IShape* sprite = new IShape();
	sprite->Initialize();
	sprite->SetSizeToContent(SizeToContent::Mesh);

	sprite->SetMesh(mesh);
	sprite->SetMaterial(material);
	return sprite;
}
Exemple #2
0
IShape* NodeFactory::CreateCircle(float radius, float precision, const Color4F& color)
{
	ShapeGeneralMesh* mesh = MeshFactory::Instance().CreateShapeCircleMesh(radius, precision, color);
	RETURN_NULL_IF_NULL(mesh);
	IMaterial* material = MaterialFactory::Instance().CreateShape(MEDUSA_PREFIX(Shape_TrianglesFan));
	material->SetDrawMode(GraphicsDrawMode::TriangleFan);
	IShape* sprite = new IShape();
	sprite->Initialize();
	sprite->SetSizeToContent(SizeToContent::Mesh);
	sprite->SetMesh(mesh);
	sprite->SetMaterial(material);
	return sprite;
	
}
Exemple #3
0
IShape* NodeFactory::CreateTriangle(const Point3F& p1, const Point3F& p2, const Point3F& p3, const Color4F& color)
{
	auto mesh = MeshFactory::Instance().CreateShapeTriangleMesh(p1, p2, p3, color);
	RETURN_NULL_IF_NULL(mesh);
	auto material = MaterialFactory::Instance().CreateShape(MEDUSA_PREFIX(Shape));
	IShape* sprite = new IShape();
	sprite->Initialize();
	sprite->SetSizeToContent(SizeToContent::Mesh);

	sprite->SetMesh(mesh);
	sprite->SetMaterial(material);
	return sprite;

}
Exemple #4
0
IShape* NodeFactory::CreateRect(const Size2F& rectSize, const Color4F& color)
{

	ShapeQuadMesh* mesh = MeshFactory::Instance().CreateShapeQuadMesh(rectSize, color);
	RETURN_NULL_IF_NULL(mesh);
	IMaterial* material = MaterialFactory::Instance().CreateShape(MEDUSA_PREFIX(Shape));
	IShape* sprite = new IShape();
	sprite->Initialize();
	sprite->SetSizeToContent(SizeToContent::Mesh);

	sprite->SetMesh(mesh);
	sprite->SetMaterial(material);
	sprite->SetSize(rectSize);
	return sprite;
}
Exemple #5
0
IShape* NodeFactory::CreateRectBorder(const Size2F& rectSize, const Color4F& color)
{
	auto mesh = MeshFactory::Instance().CreateShapeQuadMesh(rectSize, color);
	RETURN_NULL_IF_NULL(mesh);
	auto material = MaterialFactory::Instance().CreateShape(MEDUSA_PREFIX(Shape_WireFrame));
	material->SetDrawMode(GraphicsDrawMode::LineStrip);

	IShape* sprite = new IShape();
	sprite->Initialize();
	sprite->SetSizeToContent(SizeToContent::Mesh);

	sprite->SetMesh(mesh);
	sprite->SetMaterial(material);
	sprite->SetSize(rectSize);
	return sprite;
}