fix up entity constructors so that setProperties isn't called during the constructor

This commit is contained in:
Seth Alves 2015-10-23 13:52:50 -07:00
parent 22af5b27ab
commit 61269c3ce8
48 changed files with 127 additions and 147 deletions

View file

@ -60,7 +60,6 @@ AvatarData::AvatarData() :
setBodyPitch(0.0f);
setBodyYaw(-90.0f);
setBodyRoll(0.0f);
_constructing = false;
}
AvatarData::~AvatarData() {

View file

@ -25,7 +25,9 @@
#include "../render-utils/simple_frag.h"
EntityItemPointer RenderableBoxEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
return std::make_shared<RenderableBoxEntityItem>(entityID, properties);
EntityItemPointer entity{ new RenderableBoxEntityItem(entityID) };
entity->setProperties(properties);
return entity;
}
void RenderableBoxEntityItem::setUserData(const QString& value) {

View file

@ -20,10 +20,7 @@
class RenderableBoxEntityItem : public BoxEntityItem {
public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
RenderableBoxEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
BoxEntityItem(entityItemID, properties)
{ }
RenderableBoxEntityItem(const EntityItemID& entityItemID) : BoxEntityItem(entityItemID) { }
virtual void render(RenderArgs* args);
virtual void setUserData(const QString& value);

View file

@ -20,7 +20,9 @@
#include "RenderableLightEntityItem.h"
EntityItemPointer RenderableLightEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
return std::make_shared<RenderableLightEntityItem>(entityID, properties);
EntityItemPointer entity{ new RenderableLightEntityItem(entityID) };
entity->setProperties(properties);
return entity;
}
void RenderableLightEntityItem::render(RenderArgs* args) {

View file

@ -18,10 +18,7 @@
class RenderableLightEntityItem : public LightEntityItem {
public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
RenderableLightEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
LightEntityItem(entityItemID, properties)
{ }
RenderableLightEntityItem(const EntityItemID& entityItemID) : LightEntityItem(entityItemID) { }
virtual void render(RenderArgs* args);
virtual bool supportsDetailedRayIntersection() const { return true; }

View file

@ -20,7 +20,9 @@
#include "RenderableLineEntityItem.h"
EntityItemPointer RenderableLineEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
return std::make_shared<RenderableLineEntityItem>(entityID, properties);
EntityItemPointer entity{ new RenderableLineEntityItem(entityID) };
entity->setProperties(properties);
return entity;
}
void RenderableLineEntityItem::updateGeometry() {

View file

@ -20,9 +20,8 @@
class RenderableLineEntityItem : public LineEntityItem {
public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
RenderableLineEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
LineEntityItem(entityItemID, properties),
RenderableLineEntityItem(const EntityItemID& entityItemID) :
LineEntityItem(entityItemID),
_lineVerticesID(GeometryCache::UNKNOWN_ID)
{ }

View file

@ -24,13 +24,14 @@
#include "RenderableModelEntityItem.h"
EntityItemPointer RenderableModelEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
return std::make_shared<RenderableModelEntityItem>(entityID, properties);
EntityItemPointer entity{ new RenderableModelEntityItem(entityID, properties.getDimensionsInitialized()) };
entity->setProperties(properties);
return entity;
}
RenderableModelEntityItem::RenderableModelEntityItem(const EntityItemID& entityItemID,
const EntityItemProperties& properties) :
ModelEntityItem(entityItemID, properties),
_dimensionsInitialized(properties.getDimensionsInitialized())
{
RenderableModelEntityItem::RenderableModelEntityItem(const EntityItemID& entityItemID, bool dimensionsInitialized) :
ModelEntityItem(entityItemID),
_dimensionsInitialized(dimensionsInitialized) {
}
RenderableModelEntityItem::~RenderableModelEntityItem() {

View file

@ -25,7 +25,7 @@ class RenderableModelEntityItem : public ModelEntityItem {
public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
RenderableModelEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties);
RenderableModelEntityItem(const EntityItemID& entityItemID, bool dimensionsInitialized);
virtual ~RenderableModelEntityItem();

View file

@ -117,13 +117,15 @@ namespace render {
gpu::PipelinePointer RenderableParticleEffectEntityItem::_texturedPipeline;
gpu::PipelinePointer RenderableParticleEffectEntityItem::_untexturedPipeline;
EntityItemPointer RenderableParticleEffectEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
return std::make_shared<RenderableParticleEffectEntityItem>(entityID, properties);
EntityItemPointer RenderableParticleEffectEntityItem::factory(const EntityItemID& entityID,
const EntityItemProperties& properties) {
EntityItemPointer entity{ new RenderableParticleEffectEntityItem(entityID) };
entity->setProperties(properties);
return entity;
}
RenderableParticleEffectEntityItem::RenderableParticleEffectEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
ParticleEffectEntityItem(entityItemID, properties) {
RenderableParticleEffectEntityItem::RenderableParticleEffectEntityItem(const EntityItemID& entityItemID) :
ParticleEffectEntityItem(entityItemID) {
// lazy creation of particle system pipeline
if (!_untexturedPipeline && !_texturedPipeline) {
createPipelines();

View file

@ -19,7 +19,7 @@ class RenderableParticleEffectEntityItem : public ParticleEffectEntityItem {
friend class ParticlePayload;
public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
RenderableParticleEffectEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties);
RenderableParticleEffectEntityItem(const EntityItemID& entityItemID);
virtual void update(const quint64& now) override;

View file

@ -23,15 +23,15 @@
#include "paintStroke_frag.h"
EntityItemPointer RenderablePolyLineEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
return EntityItemPointer(new RenderablePolyLineEntityItem(entityID, properties));
EntityItemPointer entity{ new RenderablePolyLineEntityItem(entityID) };
entity->setProperties(properties);
return entity;
}
RenderablePolyLineEntityItem::RenderablePolyLineEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
PolyLineEntityItem(entityItemID, properties) {
RenderablePolyLineEntityItem::RenderablePolyLineEntityItem(const EntityItemID& entityItemID) :
PolyLineEntityItem(entityItemID) {
_numVertices = 0;
}
gpu::PipelinePointer RenderablePolyLineEntityItem::_pipeline;

View file

@ -25,7 +25,7 @@ class RenderablePolyLineEntityItem : public PolyLineEntityItem {
public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
static void createPipeline();
RenderablePolyLineEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties);
RenderablePolyLineEntityItem(const EntityItemID& entityItemID);
virtual void render(RenderArgs* args);

View file

@ -49,12 +49,13 @@ gpu::PipelinePointer RenderablePolyVoxEntityItem::_pipeline = nullptr;
const float MARCHING_CUBE_COLLISION_HULL_OFFSET = 0.5;
EntityItemPointer RenderablePolyVoxEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
return std::make_shared<RenderablePolyVoxEntityItem>(entityID, properties);
EntityItemPointer entity{ new RenderablePolyVoxEntityItem(entityID) };
entity->setProperties(properties);
return entity;
}
RenderablePolyVoxEntityItem::RenderablePolyVoxEntityItem(const EntityItemID& entityItemID,
const EntityItemProperties& properties) :
PolyVoxEntityItem(entityItemID, properties),
RenderablePolyVoxEntityItem::RenderablePolyVoxEntityItem(const EntityItemID& entityItemID) :
PolyVoxEntityItem(entityItemID),
_mesh(new model::Mesh()),
_meshDirty(true),
_xTexture(nullptr),

View file

@ -45,8 +45,7 @@ namespace render {
class RenderablePolyVoxEntityItem : public PolyVoxEntityItem {
public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
RenderablePolyVoxEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties);
RenderablePolyVoxEntityItem(const EntityItemID& entityItemID);
virtual ~RenderablePolyVoxEntityItem();

View file

@ -30,7 +30,9 @@ static const float SPHERE_ENTITY_SCALE = 0.5f;
EntityItemPointer RenderableSphereEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
return std::make_shared<RenderableSphereEntityItem>(entityID, properties);
EntityItemPointer entity{ new RenderableSphereEntityItem(entityID) };
entity->setProperties(properties);
return entity;
}
void RenderableSphereEntityItem::setUserData(const QString& value) {

View file

@ -20,10 +20,7 @@
class RenderableSphereEntityItem : public SphereEntityItem {
public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
RenderableSphereEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
SphereEntityItem(entityItemID, properties)
{ }
RenderableSphereEntityItem(const EntityItemID& entityItemID) : SphereEntityItem(entityItemID) { }
virtual void render(RenderArgs* args);
virtual void setUserData(const QString& value);

View file

@ -22,7 +22,9 @@
#include "GLMHelpers.h"
EntityItemPointer RenderableTextEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
return std::make_shared<RenderableTextEntityItem>(entityID, properties);
EntityItemPointer entity{ new RenderableTextEntityItem(entityID) };
entity->setProperties(properties);
return entity;
}
void RenderableTextEntityItem::render(RenderArgs* args) {

View file

@ -22,10 +22,7 @@ const int FIXED_FONT_POINT_SIZE = 40;
class RenderableTextEntityItem : public TextEntityItem {
public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
RenderableTextEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
TextEntityItem(entityItemID, properties)
{ }
RenderableTextEntityItem(const EntityItemID& entityItemID) : TextEntityItem(entityItemID) { }
~RenderableTextEntityItem() { delete _textRenderer; }
virtual void render(RenderArgs* args);

View file

@ -31,11 +31,13 @@ const float DPI = 30.47f;
const float METERS_TO_INCHES = 39.3701f;
EntityItemPointer RenderableWebEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
return std::make_shared<RenderableWebEntityItem>(entityID, properties);
EntityItemPointer entity{ new RenderableWebEntityItem(entityID) };
entity->setProperties(properties);
return entity;
}
RenderableWebEntityItem::RenderableWebEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
WebEntityItem(entityItemID, properties) {
RenderableWebEntityItem::RenderableWebEntityItem(const EntityItemID& entityItemID) :
WebEntityItem(entityItemID) {
qDebug() << "Created web entity " << getID();
}

View file

@ -22,8 +22,7 @@ class QObject;
class RenderableWebEntityItem : public WebEntityItem {
public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
RenderableWebEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties);
RenderableWebEntityItem(const EntityItemID& entityItemID);
~RenderableWebEntityItem();
virtual void render(RenderArgs* args);

View file

@ -24,7 +24,9 @@
static const float SPHERE_ENTITY_SCALE = 0.5f;
EntityItemPointer RenderableZoneEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
return std::make_shared<RenderableZoneEntityItem>(entityID, properties);
EntityItemPointer entity{ new RenderableZoneEntityItem(entityID) };
entity->setProperties(properties);
return entity;
}
template<typename Lambda>

View file

@ -21,10 +21,10 @@ class RenderableZoneEntityItem : public ZoneEntityItem {
public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
RenderableZoneEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
ZoneEntityItem(entityItemID, properties),
_model(NULL),
_needsInitialSimulation(true)
RenderableZoneEntityItem(const EntityItemID& entityItemID) :
ZoneEntityItem(entityItemID),
_model(NULL),
_needsInitialSimulation(true)
{ }
virtual bool setProperties(const EntityItemProperties& properties);

View file

@ -21,15 +21,13 @@
#include "EntityTreeElement.h"
EntityItemPointer BoxEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
EntityItemPointer result { new BoxEntityItem(entityID, properties) };
return result;
EntityItemPointer entity { new BoxEntityItem(entityID) };
entity->setProperties(properties);
return entity;
}
BoxEntityItem::BoxEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
EntityItem(entityItemID)
{
BoxEntityItem::BoxEntityItem(const EntityItemID& entityItemID) : EntityItem(entityItemID) {
_type = EntityTypes::Box;
setProperties(properties);
}
EntityItemProperties BoxEntityItem::getProperties(EntityPropertyFlags desiredProperties) const {

View file

@ -18,7 +18,7 @@ class BoxEntityItem : public EntityItem {
public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
BoxEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties);
BoxEntityItem(const EntityItemID& entityItemID);
ALLOW_INSTANTIATION // This class can be instantiated

View file

@ -85,7 +85,6 @@ EntityItem::EntityItem(const EntityItemID& entityItemID) :
quint64 now = usecTimestampNow();
_lastSimulated = now;
_lastUpdated = now;
_constructing = false;
}
EntityItem::~EntityItem() {

View file

@ -24,23 +24,20 @@
bool LightEntityItem::_lightsArePickable = false;
EntityItemPointer LightEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
EntityItemPointer result { new LightEntityItem(entityID, properties) };
return result;
EntityItemPointer entity { new LightEntityItem(entityID) };
entity->setProperties(properties);
return entity;
}
// our non-pure virtual subclass for now...
LightEntityItem::LightEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
EntityItem(entityItemID)
{
LightEntityItem::LightEntityItem(const EntityItemID& entityItemID) : EntityItem(entityItemID) {
_type = EntityTypes::Light;
// default property values
_color[RED_INDEX] = _color[GREEN_INDEX] = _color[BLUE_INDEX] = 0;
_intensity = 1.0f;
_exponent = 0.0f;
_cutoff = PI;
setProperties(properties);
}
void LightEntityItem::setDimensions(const glm::vec3& value) {

View file

@ -18,7 +18,7 @@ class LightEntityItem : public EntityItem {
public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
LightEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties);
LightEntityItem(const EntityItemID& entityItemID);
ALLOW_INSTANTIATION // This class can be instantiated

View file

@ -26,20 +26,18 @@ const int LineEntityItem::MAX_POINTS_PER_LINE = 70;
EntityItemPointer LineEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
EntityItemPointer result { new LineEntityItem(entityID, properties) };
return result;
EntityItemPointer entity { new LineEntityItem(entityID) };
entity->setProperties(properties);
return entity;
}
LineEntityItem::LineEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
EntityItem(entityItemID) ,
LineEntityItem::LineEntityItem(const EntityItemID& entityItemID) :
EntityItem(entityItemID),
_lineWidth(DEFAULT_LINE_WIDTH),
_pointsChanged(true),
_points(QVector<glm::vec3>(0))
{
_type = EntityTypes::Line;
setProperties(properties);
}
EntityItemProperties LineEntityItem::getProperties(EntityPropertyFlags desiredProperties) const {

View file

@ -18,7 +18,7 @@ class LineEntityItem : public EntityItem {
public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
LineEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties);
LineEntityItem(const EntityItemID& entityItemID);
ALLOW_INSTANTIATION // This class can be instantiated

View file

@ -25,17 +25,17 @@ const QString ModelEntityItem::DEFAULT_MODEL_URL = QString("");
const QString ModelEntityItem::DEFAULT_COMPOUND_SHAPE_URL = QString("");
EntityItemPointer ModelEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
return std::make_shared<ModelEntityItem>(entityID, properties);
EntityItemPointer entity { new ModelEntityItem(entityID) };
entity->setProperties(properties);
return entity;
}
ModelEntityItem::ModelEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
EntityItem(entityItemID)
ModelEntityItem::ModelEntityItem(const EntityItemID& entityItemID) : EntityItem(entityItemID)
{
_animationProperties.associateWithAnimationLoop(&_animationLoop);
_animationLoop.setResetOnRunning(false);
_type = EntityTypes::Model;
setProperties(properties);
_jointMappingCompleted = false;
_lastKnownCurrentFrame = -1;
_color[0] = _color[1] = _color[2] = 0;

View file

@ -21,7 +21,7 @@ class ModelEntityItem : public EntityItem {
public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
ModelEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties);
ModelEntityItem(const EntityItemID& entityItemID);
ALLOW_INSTANTIATION // This class can be instantiated

View file

@ -97,11 +97,13 @@ const QString ParticleEffectEntityItem::DEFAULT_TEXTURES = "";
EntityItemPointer ParticleEffectEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
return std::make_shared<ParticleEffectEntityItem>(entityID, properties);
EntityItemPointer entity { new ParticleEffectEntityItem(entityID) };
entity->setProperties(properties);
return entity;
}
// our non-pure virtual subclass for now...
ParticleEffectEntityItem::ParticleEffectEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
ParticleEffectEntityItem::ParticleEffectEntityItem(const EntityItemID& entityItemID) :
EntityItem(entityItemID),
_lastSimulated(usecTimestampNow()),
_particleLifetimes(DEFAULT_MAX_PARTICLES, 0.0f),
@ -121,12 +123,9 @@ ParticleEffectEntityItem::ParticleEffectEntityItem(const EntityItemID& entityIte
_alphaMiddles(DEFAULT_MAX_PARTICLES, DEFAULT_ALPHA),
_alphaFinishes(DEFAULT_MAX_PARTICLES, DEFAULT_ALPHA),
_particleMaxBound(glm::vec3(1.0f, 1.0f, 1.0f)),
_particleMinBound(glm::vec3(-1.0f, -1.0f, -1.0f))
{
_particleMinBound(glm::vec3(-1.0f, -1.0f, -1.0f)) {
_type = EntityTypes::ParticleEffect;
setColor(DEFAULT_COLOR);
setProperties(properties);
}
ParticleEffectEntityItem::~ParticleEffectEntityItem() {

View file

@ -20,7 +20,7 @@ public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
ParticleEffectEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties);
ParticleEffectEntityItem(const EntityItemID& entityItemID);
virtual ~ParticleEffectEntityItem();
ALLOW_INSTANTIATION // This class can be instantiated

View file

@ -26,22 +26,21 @@ const int PolyLineEntityItem::MAX_POINTS_PER_LINE = 70;
EntityItemPointer PolyLineEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
EntityItemPointer result{ new PolyLineEntityItem(entityID, properties) };
return result;
EntityItemPointer entity{ new PolyLineEntityItem(entityID) };
entity->setProperties(properties);
return entity;
}
PolyLineEntityItem::PolyLineEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
EntityItem(entityItemID),
_lineWidth(DEFAULT_LINE_WIDTH),
_pointsChanged(true),
_points(QVector<glm::vec3>(0.0f)),
_vertices(QVector<glm::vec3>(0.0f)),
_normals(QVector<glm::vec3>(0.0f)),
_strokeWidths(QVector<float>(0.0f))
PolyLineEntityItem::PolyLineEntityItem(const EntityItemID& entityItemID) :
EntityItem(entityItemID),
_lineWidth(DEFAULT_LINE_WIDTH),
_pointsChanged(true),
_points(QVector<glm::vec3>(0.0f)),
_vertices(QVector<glm::vec3>(0.0f)),
_normals(QVector<glm::vec3>(0.0f)),
_strokeWidths(QVector<float>(0.0f))
{
_type = EntityTypes::PolyLine;
_created = properties.getCreated();
setProperties(properties);
}
EntityItemProperties PolyLineEntityItem::getProperties(EntityPropertyFlags desiredProperties) const {

View file

@ -18,7 +18,7 @@ class PolyLineEntityItem : public EntityItem {
public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
PolyLineEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties);
PolyLineEntityItem(const EntityItemID& entityItemID);
ALLOW_INSTANTIATION // This class can be instantiated

View file

@ -32,7 +32,9 @@ const QString PolyVoxEntityItem::DEFAULT_Y_TEXTURE_URL = QString("");
const QString PolyVoxEntityItem::DEFAULT_Z_TEXTURE_URL = QString("");
EntityItemPointer PolyVoxEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
return std::make_shared<PolyVoxEntityItem>(entityID, properties);
EntityItemPointer entity { new PolyVoxEntityItem(entityID) };
entity->setProperties(properties);
return entity;
}
QByteArray PolyVoxEntityItem::makeEmptyVoxelData(quint16 voxelXSize, quint16 voxelYSize, quint16 voxelZSize) {
@ -49,7 +51,7 @@ QByteArray PolyVoxEntityItem::makeEmptyVoxelData(quint16 voxelXSize, quint16 vox
return newVoxelData;
}
PolyVoxEntityItem::PolyVoxEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
PolyVoxEntityItem::PolyVoxEntityItem(const EntityItemID& entityItemID) :
EntityItem(entityItemID),
_voxelVolumeSize(PolyVoxEntityItem::DEFAULT_VOXEL_VOLUME_SIZE),
_voxelData(PolyVoxEntityItem::DEFAULT_VOXEL_DATA),
@ -59,7 +61,6 @@ PolyVoxEntityItem::PolyVoxEntityItem(const EntityItemID& entityItemID, const Ent
_yTextureURL(PolyVoxEntityItem::DEFAULT_Y_TEXTURE_URL),
_zTextureURL(PolyVoxEntityItem::DEFAULT_Z_TEXTURE_URL) {
_type = EntityTypes::PolyVox;
setProperties(properties);
}
void PolyVoxEntityItem::setVoxelVolumeSize(glm::vec3 voxelVolumeSize) {

View file

@ -18,7 +18,7 @@ class PolyVoxEntityItem : public EntityItem {
public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
PolyVoxEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties);
PolyVoxEntityItem(const EntityItemID& entityItemID);
ALLOW_INSTANTIATION // This class can be instantiated

View file

@ -24,16 +24,14 @@
#include "SphereEntityItem.h"
EntityItemPointer SphereEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
EntityItemPointer result { new SphereEntityItem(entityID, properties) };
return result;
EntityItemPointer entity { new SphereEntityItem(entityID) };
entity->setProperties(properties);
return entity;
}
// our non-pure virtual subclass for now...
SphereEntityItem::SphereEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
EntityItem(entityItemID)
{
SphereEntityItem::SphereEntityItem(const EntityItemID& entityItemID) : EntityItem(entityItemID) {
_type = EntityTypes::Sphere;
setProperties(properties);
_volumeMultiplier *= PI / 6.0f;
}

View file

@ -18,7 +18,7 @@ class SphereEntityItem : public EntityItem {
public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
SphereEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties);
SphereEntityItem(const EntityItemID& entityItemID);
ALLOW_INSTANTIATION // This class can be instantiated

View file

@ -30,14 +30,13 @@ const xColor TextEntityItem::DEFAULT_BACKGROUND_COLOR = { 0, 0, 0};
const bool TextEntityItem::DEFAULT_FACE_CAMERA = false;
EntityItemPointer TextEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
return std::make_shared<TextEntityItem>(entityID, properties);
EntityItemPointer entity { new TextEntityItem(entityID) };
entity->setProperties(properties);
return entity;
}
TextEntityItem::TextEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
EntityItem(entityItemID)
{
TextEntityItem::TextEntityItem(const EntityItemID& entityItemID) : EntityItem(entityItemID) {
_type = EntityTypes::Text;
setProperties(properties);
}
const float TEXT_ENTITY_ITEM_FIXED_DEPTH = 0.01f;

View file

@ -18,7 +18,7 @@ class TextEntityItem : public EntityItem {
public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
TextEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties);
TextEntityItem(const EntityItemID& entityItemID);
ALLOW_INSTANTIATION // This class can be instantiated

View file

@ -23,14 +23,13 @@
const QString WebEntityItem::DEFAULT_SOURCE_URL("http://www.google.com");
EntityItemPointer WebEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
return std::make_shared<WebEntityItem>(entityID, properties);
EntityItemPointer entity { new WebEntityItem(entityID) };
entity->setProperties(properties);
return entity;
}
WebEntityItem::WebEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
EntityItem(entityItemID)
{
WebEntityItem::WebEntityItem(const EntityItemID& entityItemID) : EntityItem(entityItemID) {
_type = EntityTypes::Web;
setProperties(properties);
}
const float WEB_ENTITY_ITEM_FIXED_DEPTH = 0.01f;

View file

@ -17,7 +17,7 @@ public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
WebEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties);
WebEntityItem(const EntityItemID& entityItemID);
ALLOW_INSTANTIATION // This class can be instantiated

View file

@ -31,12 +31,12 @@ const ShapeType ZoneEntityItem::DEFAULT_SHAPE_TYPE = SHAPE_TYPE_BOX;
const QString ZoneEntityItem::DEFAULT_COMPOUND_SHAPE_URL = "";
EntityItemPointer ZoneEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
return std::make_shared<ZoneEntityItem>(entityID, properties);
EntityItemPointer entity { new ZoneEntityItem(entityID) };
entity->setProperties(properties);
return entity;
}
ZoneEntityItem::ZoneEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
EntityItem(entityItemID)
{
ZoneEntityItem::ZoneEntityItem(const EntityItemID& entityItemID) : EntityItem(entityItemID) {
_type = EntityTypes::Zone;
_keyLightColor[RED_INDEX] = DEFAULT_KEYLIGHT_COLOR.red;
@ -50,8 +50,6 @@ ZoneEntityItem::ZoneEntityItem(const EntityItemID& entityItemID, const EntityIte
_compoundShapeURL = DEFAULT_COMPOUND_SHAPE_URL;
_backgroundMode = BACKGROUND_MODE_INHERIT;
setProperties(properties);
}

View file

@ -24,7 +24,7 @@ class ZoneEntityItem : public EntityItem {
public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
ZoneEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties);
ZoneEntityItem(const EntityItemID& entityItemID);
ALLOW_INSTANTIATION // This class can be instantiated

View file

@ -32,11 +32,6 @@ SpatiallyNestablePointer SpatiallyNestable::getParentPointer() const {
return nullptr;
}
if (_constructing) {
// we can't use shared_from_this yet, so stop here.
return nullptr;
}
SpatiallyNestableConstPointer constThisPointer = shared_from_this();
SpatiallyNestablePointer thisPointer = std::const_pointer_cast<SpatiallyNestable>(constThisPointer); // ermahgerd !!!

View file

@ -82,8 +82,6 @@ public:
NestableTypes::NestableType getNestableType() const { return _nestableType; }
protected:
bool _constructing = true;
NestableTypes::NestableType _nestableType; // EntityItem or an AvatarData
QUuid _id;
QUuid _parentID; // what is this thing's transform relative to?