Hello again.
I’d like to draw a flat (2D) polygon with an outline (thick and different color) and some added details.
Then i’d like to move (a la TransformXY
) and rotate the shape. Maybe also to scale/zoom it.
It seems rather straightforward using DrawPrimitive2D
with GL TrinaglesFan and GL Lines mode.
But i’d like to move to “declarative approach” instead.
Obvious starting points seems to be:
The source examples there are inspiring, but sadly they do not give conceptual overview, what steps / added info is required to turn array of points/vertexes into a figure. There should be some colours, stencils, etc…
- Supported nodes …
TriangleSet2D
(API reference)Triangles.
So far so good. X3D ref seems to say there would be no such thing as “fan” built around some natural “center”, but it would not be hard to copy the initial vertex. Except that…
type TTriangleSet2DNode = class(TAbstractGeometryNode)
Description
Set of triangles in 2D. Rendering of this node is not implemented yet.
Ooops… TO me this sounds weird, in which sence that component is “supported” if it is not rendered? Or is it?
function TTriangleSet2DNode.Proxy
seems implemented and on a cursory look it does not seem much different from TRectangle2DNode.Proxy
, as for the rest it seems mostly auto-generated.
If it still is NOT rendered, then what do i miss?
But yahoo, the sources teach me about TTriangleSetNode
and TTriangleFanSetNode
. The last sounds very good… Yet those are not even mentioned at Geometry3D component | Castle Game Engine
Are them also non-implemented about rendering? But there is no such warning in docs and sources it seems. Castle Game Engine: X3DNodes: Class TTriangleFanSetNode
Also, i wonder if that is possible to translate all 3D classes to their 2D counterparts. It seems it can be well templates, it seems all one needs is to replace Vector3
with Vector2
as coordinates type and add explicit property Z
. Perhaps it would miss a goal of straightforward mapping of XML nodes, though. Yet maybe some easy conversion of 2D to 3D, like https://www.makewordart.com could be handy.
Transform := TTransformNode.Create;
RectGeometry := TRectangle2DNode.CreateWithShape(RectShape);
But why?
constructor CreateWithTransform(out Shape: TShapeNode; out Transform: TTransformNode);