Working on shapes for metavoxel edits.

This commit is contained in:
Andrzej Kapolka 2014-09-30 17:34:01 -07:00
parent 14267e3902
commit 4dbd2367f4
2 changed files with 62 additions and 0 deletions

View file

@ -1135,3 +1135,23 @@ void VoxelMaterialSphereEdit::apply(MetavoxelData& data, const WeakSharedObjectH
VoxelMaterialSphereEditVisitor visitor(center, radius, bounds, granularity, material, averageColor);
data.guide(visitor);
}
MetavoxelShape::MetavoxelShape(const glm::vec3& translation, const glm::quat& rotation, float scale) :
translation(translation),
rotation(rotation),
scale(scale) {
}
MetavoxelShape::~MetavoxelShape() {
}
MetavoxelSphere::MetavoxelSphere(const glm::vec3& translation, const glm::quat& rotation, float scale) :
MetavoxelShape(translation, rotation, scale) {
}
MetavoxelBox::MetavoxelBox(const glm::vec3& translation, const glm::quat& rotation, float scale,
float aspectXY, float aspectXZ) :
MetavoxelShape(translation, rotation, scale),
aspectXY(aspectXY),
aspectXZ(aspectXZ) {
}

View file

@ -282,4 +282,46 @@ public:
DECLARE_STREAMABLE_METATYPE(VoxelMaterialSphereEdit)
/// Abstract base class for shapes.
class MetavoxelShape {
STREAMABLE
public:
STREAM glm::vec3 translation;
STREAM glm::quat rotation;
STREAM float scale;
MetavoxelShape(const glm::vec3& translation = glm::vec3(), const glm::quat& rotation = glm::quat(), float scale = 1.0f);
virtual ~MetavoxelShape();
};
DECLARE_STREAMABLE_METATYPE(MetavoxelShape)
// A sphere shape.
class MetavoxelSphere : public MetavoxelShape {
STREAMABLE
public:
MetavoxelSphere(const glm::vec3& translation = glm::vec3(), const glm::quat& rotation = glm::quat(), float scale = 1.0f);
};
DECLARE_STREAMABLE_METATYPE(MetavoxelSphere)
// A box shape.
class MetavoxelBox : public MetavoxelShape {
STREAMABLE
public:
STREAM float aspectXY;
STREAM float aspectXZ;
MetavoxelBox(const glm::vec3& translation = glm::vec3(), const glm::quat& rotation = glm::quat(), float scale = 1.0f,
float aspectXY = 1.0f, float aspectXZ = 1.0f);
};
DECLARE_STREAMABLE_METATYPE(MetavoxelBox)
#endif // hifi_MetavoxelMessages_h