Skip to content

Commit

Permalink
Adding cone primitives.
Browse files Browse the repository at this point in the history
Squashing commits to make requested target of main with backports to
harmonic.

Signed-off-by: Benjamin Perseghetti <[email protected]>
  • Loading branch information
bperseghetti committed May 15, 2024
1 parent ade7442 commit cf92027
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
3 changes: 3 additions & 0 deletions include/gz/rendering/Marker.hh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ namespace gz

/// \brief Capsule geometry
MT_CAPSULE = 11,

/// \brief Cone geometry
MT_CONE = 12,
};

/// \class Marker Marker.hh gz/rendering/Marker
Expand Down
9 changes: 7 additions & 2 deletions include/gz/rendering/ParticleEmitter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ namespace gz
/// \brief Ellipsoid emitter.
EM_ELLIPSOID = 3,

/// \brief Cone emitter.
EM_CONE = 4,

/// \brief Total number of emitters (keep always at the end).
EM_NUM_EMITTERS = 4,
EM_NUM_EMITTERS = 5,
};

/// \class ParticleEmitter ParticleEmitter.hh
Expand Down Expand Up @@ -86,8 +89,10 @@ namespace gz
/// the emmiter type:
/// - EM_POINT: The area is ignored.
/// - EM_BOX: The area is interpreted as width X height X depth.
/// - EM_CONE: The area is interpreted as the bounding box of the
/// cone. The cone is oriented along the Z-axis.
/// - EM_CYLINDER: The area is interpreted as the bounding box of the
/// cilinder. The cylinder is oriented along the Z-axis.
/// cylinder. The cylinder is oriented along the Z-axis.
/// - EM_ELLIPSOID: The area is interpreted as the bounding box of an
/// ellipsoid shaped area, i.e. a sphere or
/// squashed-sphere area. The parameters are again
Expand Down
6 changes: 6 additions & 0 deletions ogre/src/OgreMarker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ Ogre::MovableObject *OgreMarker::OgreObject() const
return nullptr;
case MT_BOX:
case MT_CAPSULE:
case MT_CONE:
case MT_CYLINDER:
case MT_SPHERE:
{
Expand Down Expand Up @@ -184,6 +185,7 @@ void OgreMarker::SetMaterial(MaterialPtr _material, bool _unique)
break;
case MT_BOX:
case MT_CAPSULE:
case MT_CONE:
case MT_CYLINDER:
case MT_SPHERE:
{
Expand Down Expand Up @@ -257,6 +259,10 @@ void OgreMarker::SetType(MarkerType _markerType)
this->dataPtr->geom =
std::dynamic_pointer_cast<OgreGeometry>(this->scene->CreateCapsule());
break;
case MT_CONE:
this->dataPtr->geom =
std::dynamic_pointer_cast<OgreGeometry>(this->scene->CreateCone());
break;
case MT_CYLINDER:
this->dataPtr->geom =
std::dynamic_pointer_cast<OgreGeometry>(this->scene->CreateCylinder());
Expand Down
6 changes: 6 additions & 0 deletions ogre2/src/Ogre2Marker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ Ogre::MovableObject *Ogre2Marker::OgreObject() const
return nullptr;
case MT_BOX:
case MT_CAPSULE:
case MT_CONE:
case MT_CYLINDER:
case MT_SPHERE:
{
Expand Down Expand Up @@ -236,6 +237,7 @@ void Ogre2Marker::SetMaterial(MaterialPtr _material, bool _unique)
break;
case MT_BOX:
case MT_CAPSULE:
case MT_CONE:
case MT_CYLINDER:
case MT_SPHERE:
{
Expand Down Expand Up @@ -342,6 +344,10 @@ void Ogre2Marker::SetType(MarkerType _markerType)
isGeom = true;
newGeom = this->scene->CreateCapsule();
break;
case MT_CONE:
isGeom = true;
newGeom = this->scene->CreateCone();
break;
case MT_CYLINDER:
isGeom = true;
newGeom = this->scene->CreateCylinder();
Expand Down
2 changes: 2 additions & 0 deletions ogre2/src/Ogre2ParticleEmitter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ static const std::array<std::string, EmitterType::EM_NUM_EMITTERS>
{
"Point",
"Box",
"Cone",
"Cylinder",
"Ellipsoid",
};
Expand Down Expand Up @@ -154,6 +155,7 @@ void Ogre2ParticleEmitter::SetEmitterSize(const gz::math::Vector3d &_size)
break;
}
case EmitterType::EM_BOX:
case EmitterType::EM_CONE:
case EmitterType::EM_CYLINDER:
case EmitterType::EM_ELLIPSOID:
{
Expand Down

0 comments on commit cf92027

Please sign in to comment.