Skip to content

Can't make extrusion work #174

Description

@slapin

Hi, all!
The results I get from single-segment extrusion over a path

Image

The code:

	Procedural::Shape *pierShape = new Procedural::Shape();
	pierShape->addPoint(6.f, 0.7f);
	pierShape->addPoint(0.f, 0.6f);
...
	Procedural::RoundedCornerSpline3 *pierCurve;
	Procedural::Path pierCurvePath;
...
	if (jp.find("pierPath") != jp.end()) {
		pierPath.reserve(jp["pierPath"].size());
		pierCurve = new Procedural::RoundedCornerSpline3();
		for (auto &jpt : jp["pierPath"]) {
			Ogre::Vector3 pt;
			from_json(jpt, pt);
			pierPath.push_back(pt);
			pierCurve->addPoint(pt);
		}
		OgreAssert(pierPath.size() > 0, "empty path");
		pierCurvePath = pierCurve->realizePath();
		Procedural::Extruder extruder;
		Ogre::MeshPtr extrudedMesh =
			extruder.setShapeToExtrude(pierShape)
				.setExtrusionPath(&pierCurvePath)
				.setEnableNormals(true)
				.setTextureRectangle(
					Ogre::RealRect(0.4f, 0.0f, 0.1f, 0.1f))
				.realizeMesh("pierPathMesh" +
					     Ogre::StringConverter::toString(
						     e.id()));

(can ignore json stuff now, the actual path is (starts with pierPath):

[{"orientation":{"w":1.0,"x":0.0,"y":0.0,"z":0.0},"position":{"x":-9966.490234375,"y":7.0036211013793945,"z":-3791.760498046875},"properties":"{\"pierDepth\":39.581451416015625,\"pierHeight\":7.724061965942383,\"pierLength\":60.0,\"pierOffset\":44.0,\"pierPath\":[{\"x\":0.0,\"y\":0.0,\"z\":0.0},{\"x\":0.0,\"y\":0.1390056610107422,\"z\":2.0},{\"x\":0.0,\"y\":0.2879347801208496,\"z\":4.0},{\"x\":0.0,\"y\":0.4421849250793457,\"z\":6.0},{\"x\":0.0,\"y\":0.5964345932006836,\"z\":8.0},{\"x\":0.0,\"y\":0.6842670440673828,\"z\":10.0},{\"x\":0.0,\"y\":0.7177095413208008,\"z\":12.0},{\"x\":0.0,\"y\":0.7020454406738281,\"z\":14.0},{\"x\":0.0,\"y\":0.6652541160583496,\"z\":16.0},{\"x\":0.0,\"y\":0.6284627914428711,\"z\":18.0},{\"x\":0.0,\"y\":0.4784627854824066,\"z\":20.0},{\"x\":0.0,\"y\":0.32846277952194214,\"z\":22.0},{\"x\":0.0,\"y\":0.17846277356147766,\"z\":24.0},{\"x\":0.0,\"y\":0.028462767601013184,\"z\":26.0},{\"x\":0.0,\"y\":-0.1215372383594513,\"z\":28.0},{\"x\":0.0,\"y\":-0.27153724431991577,\"z\":30.0},{\"x\":0.0,\"y\":-0.42153725028038025,\"z\":32.0},{\"x\":0.0,\"y\":-0.5715372562408447,\"z\":34.0},{\"x\":0.0,\"y\":-0.7215372323989868,\"z\":36.0},{\"x\":0.0,\"y\":-0.8715372085571289,\"z\":38.0},{\"x\":0.0,\"y\":-1.021537184715271,\"z\":40.0},{\"x\":0.0,\"y\":-1.171537160873413,\"z\":42.0},{\"x\":0.0,\"y\":-1.3215371370315552,\"z\":44.0},{\"x\":0.0,\"y\":-6.903621196746826,\"z\":60.746253967285156},{\"x\":0.0,\"y\":-6.903621196746826,\"z\":62.746253967285156}],\"type\":\"harbour\"}"}]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions