I want to add topradius and top to the tcastlecone. This looked simple enough, but it uses the TConeNode which is generated by x3d-nodes-to-pascal. I tried to make a bat from the sh script, but the run fails whether I use \ or / paths at generateprocessors.pas line 961 with EFOpenError when it tries to open the wildcard. How can I get this to run on windows? Thanks
-
As for x3d-nodes-to-pascal:
In general, you can run our shell scripts using Cygwin on Windows, see also our coding conventions, āUse PowerShell (not BAT files) for Windows scripting; or, in many cases, use bash (from Cygwin or MSYS2)ā, Coding Conventions | Manual | Castle Game Engine .
But in this case, the simpler answer is:
x3d-nodes-to-pascal
should not really need a shell script, it can do everything from Pascal. Done, I removedrun.sh
there and committed a change to do everything from Pascal ā so just running compiledx3d-nodes-to-pascal
(from itās own directory) will do everything it should.This is already committed to CGE GitHub master branch. If you use engine binary downloads from Download | Castle Game Engine (recommended), then please observe this page: Comparing snapshot...master Ā· castle-engine/castle-engine Ā· GitHub . When it will no longer show the commit āMove 100% of x3d-nodes-to-pascal work into Pascal, no need for a shelā¦ā then it means this commit is part of the downloads on Download | Castle Game Engine .
-
Note in case of your modification:
Better to modify
Cylinder
X3D node, notCone
. This seems more natural, if you want to also tweak the top radius freely ā the result is no longer a ācut coneā.You want to modify the
TCylinderNode.Proxy
. It callsCylinderCone_Proxy
which already can generate a cylinder with different bottom and top radius (the same routine is used for cone, when top radius is 0).It is now used like this:
CylinderCone_Proxy(IFS.FdCoordIndex.Items, CoordNode.FdPoint.Items, NormalNode.FdVector.Items, TexCoords, nil, FdRadius.Value, FdRadius.Value, FdHeight.Value, FdBottom.Value, FdSide.Value, FdTop.Value, CalculateSlices, CalculateStack);
Note that we pass there
FdRadius.Value
2 times, for bottom and top radiuses, now.I think you can achieve what you need by just exposing a new
SFFloat topRadius
field on the cylinder X3D node. When 0 (default) ā the top radius should be equal to bottom radius, so itās a regular cylinder.The
CylinderCone_Proxy
should use it then, likeFinalBottomRadius := Radius; FinalTopRadius := TopRadius; if FinalTopRadius <= 0 then FinalTopRadius := FinalBottomRadius; CylinderCone_Proxy(IFS.FdCoordIndex.Items, CoordNode.FdPoint.Items, NormalNode.FdVector.Items, TexCoords, nil, FinalBottomRadius, FinalTopRadius, FdHeight.Value, FdBottom.Value, FdSide.Value, FdTop.Value, CalculateSlices, CalculateStack);
Note that above I just write
Radius
instead ofFdRadius.Value
, most such field access can be simplified now.Then
TCastleCylinder
could use it, exposingTopRadius: Single
property.
You are a hero. Thanks.
It seemed like adding this to the cylinder resisted my efforts. I have top radius working on the cone. It makes my procedural trees a more natural looking to have taper. The actual class used is abstracted away, so if you want to add this to the cylinder, it will be easy for me to change. I donāt want to have to maintain my own changes to cge so am hoping you will add this in a future release. Ideally you would expose all features offered for a shape. For example controlling stacks and slices would help me control level of detail.
Thanks again for all you do.
They arenāt very natural yet⦠but all the elements are working together. I have to set more realistic parameters, but these are for testing, so I can see ānucklesā between the segments.
Sorry for long silence!
-
Iāll see to expose the
TopRadius
atTCylinderNode
. -
As for exposing stacks and slices: they should be already exposed in both
TCylinderNode
andTConeNode
. Or do you need them to be exposed also atTCastleCylinder
andTCastleCone
? It would make sense, and also something I could do
Iāll get back to this and post here