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-pascalshould not really need a shell script, it can do everything from Pascal. Done, I removed
run.shthere and committed a change to do everything from Pascal – so just running compiled
x3d-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
CylinderX3D node, not
Cone. 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 calls
CylinderCone_Proxywhich 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.Value2 times, for bottom and top radiuses, now.
I think you can achieve what you need by just exposing a new
SFFloat topRadiusfield on the cylinder X3D node. When 0 (default) → the top radius should be equal to bottom radius, so it’s a regular cylinder.
CylinderCone_Proxyshould use it then, like
FinalBottomRadius := 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
FdRadius.Value, most such field access can be simplified now.
TCastleCylindercould use it, exposing
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
As for exposing stacks and slices: they should be already exposed in both
TConeNode. Or do you need them to be exposed also at
TCastleCone? It would make sense, and also something I could do
I’ll get back to this and post here