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); setBodyPitch(0.0f);
setBodyYaw(-90.0f); setBodyYaw(-90.0f);
setBodyRoll(0.0f); setBodyRoll(0.0f);
_constructing = false;
} }
AvatarData::~AvatarData() { AvatarData::~AvatarData() {

View file

@ -25,7 +25,9 @@
#include "../render-utils/simple_frag.h" #include "../render-utils/simple_frag.h"
EntityItemPointer RenderableBoxEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) { 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) { void RenderableBoxEntityItem::setUserData(const QString& value) {

View file

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

View file

@ -20,7 +20,9 @@
#include "RenderableLightEntityItem.h" #include "RenderableLightEntityItem.h"
EntityItemPointer RenderableLightEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) { 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) { void RenderableLightEntityItem::render(RenderArgs* args) {

View file

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

View file

@ -20,7 +20,9 @@
#include "RenderableLineEntityItem.h" #include "RenderableLineEntityItem.h"
EntityItemPointer RenderableLineEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) { 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() { void RenderableLineEntityItem::updateGeometry() {

View file

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

View file

@ -24,13 +24,14 @@
#include "RenderableModelEntityItem.h" #include "RenderableModelEntityItem.h"
EntityItemPointer RenderableModelEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) { 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) : RenderableModelEntityItem::RenderableModelEntityItem(const EntityItemID& entityItemID, bool dimensionsInitialized) :
ModelEntityItem(entityItemID, properties), ModelEntityItem(entityItemID),
_dimensionsInitialized(properties.getDimensionsInitialized()) _dimensionsInitialized(dimensionsInitialized) {
{
} }
RenderableModelEntityItem::~RenderableModelEntityItem() { RenderableModelEntityItem::~RenderableModelEntityItem() {

View file

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

View file

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

View file

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

View file

@ -23,15 +23,15 @@
#include "paintStroke_frag.h" #include "paintStroke_frag.h"
EntityItemPointer RenderablePolyLineEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) { 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) : RenderablePolyLineEntityItem::RenderablePolyLineEntityItem(const EntityItemID& entityItemID) :
PolyLineEntityItem(entityItemID, properties) { PolyLineEntityItem(entityItemID) {
_numVertices = 0; _numVertices = 0;
} }
gpu::PipelinePointer RenderablePolyLineEntityItem::_pipeline; gpu::PipelinePointer RenderablePolyLineEntityItem::_pipeline;

View file

@ -25,7 +25,7 @@ class RenderablePolyLineEntityItem : public PolyLineEntityItem {
public: public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties); static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
static void createPipeline(); static void createPipeline();
RenderablePolyLineEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties); RenderablePolyLineEntityItem(const EntityItemID& entityItemID);
virtual void render(RenderArgs* args); 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; const float MARCHING_CUBE_COLLISION_HULL_OFFSET = 0.5;
EntityItemPointer RenderablePolyVoxEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) { 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, RenderablePolyVoxEntityItem::RenderablePolyVoxEntityItem(const EntityItemID& entityItemID) :
const EntityItemProperties& properties) : PolyVoxEntityItem(entityItemID),
PolyVoxEntityItem(entityItemID, properties),
_mesh(new model::Mesh()), _mesh(new model::Mesh()),
_meshDirty(true), _meshDirty(true),
_xTexture(nullptr), _xTexture(nullptr),

View file

@ -45,8 +45,7 @@ namespace render {
class RenderablePolyVoxEntityItem : public PolyVoxEntityItem { class RenderablePolyVoxEntityItem : public PolyVoxEntityItem {
public: public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties); static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
RenderablePolyVoxEntityItem(const EntityItemID& entityItemID);
RenderablePolyVoxEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties);
virtual ~RenderablePolyVoxEntityItem(); 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) { 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) { void RenderableSphereEntityItem::setUserData(const QString& value) {

View file

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

View file

@ -22,7 +22,9 @@
#include "GLMHelpers.h" #include "GLMHelpers.h"
EntityItemPointer RenderableTextEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) { 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) { void RenderableTextEntityItem::render(RenderArgs* args) {

View file

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

View file

@ -31,11 +31,13 @@ const float DPI = 30.47f;
const float METERS_TO_INCHES = 39.3701f; const float METERS_TO_INCHES = 39.3701f;
EntityItemPointer RenderableWebEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) { 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) : RenderableWebEntityItem::RenderableWebEntityItem(const EntityItemID& entityItemID) :
WebEntityItem(entityItemID, properties) { WebEntityItem(entityItemID) {
qDebug() << "Created web entity " << getID(); qDebug() << "Created web entity " << getID();
} }

View file

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

View file

@ -24,7 +24,9 @@
static const float SPHERE_ENTITY_SCALE = 0.5f; static const float SPHERE_ENTITY_SCALE = 0.5f;
EntityItemPointer RenderableZoneEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) { 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> template<typename Lambda>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -18,7 +18,7 @@ class LightEntityItem : public EntityItem {
public: public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties); 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 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 LineEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
EntityItemPointer result { new LineEntityItem(entityID, properties) }; EntityItemPointer entity { new LineEntityItem(entityID) };
return result; entity->setProperties(properties);
return entity;
} }
LineEntityItem::LineEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) : LineEntityItem::LineEntityItem(const EntityItemID& entityItemID) :
EntityItem(entityItemID) , EntityItem(entityItemID),
_lineWidth(DEFAULT_LINE_WIDTH), _lineWidth(DEFAULT_LINE_WIDTH),
_pointsChanged(true), _pointsChanged(true),
_points(QVector<glm::vec3>(0)) _points(QVector<glm::vec3>(0))
{ {
_type = EntityTypes::Line; _type = EntityTypes::Line;
setProperties(properties);
} }
EntityItemProperties LineEntityItem::getProperties(EntityPropertyFlags desiredProperties) const { EntityItemProperties LineEntityItem::getProperties(EntityPropertyFlags desiredProperties) const {

View file

@ -18,7 +18,7 @@ class LineEntityItem : public EntityItem {
public: public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties); 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 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(""); const QString ModelEntityItem::DEFAULT_COMPOUND_SHAPE_URL = QString("");
EntityItemPointer ModelEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) { 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) : ModelEntityItem::ModelEntityItem(const EntityItemID& entityItemID) : EntityItem(entityItemID)
EntityItem(entityItemID)
{ {
_animationProperties.associateWithAnimationLoop(&_animationLoop); _animationProperties.associateWithAnimationLoop(&_animationLoop);
_animationLoop.setResetOnRunning(false); _animationLoop.setResetOnRunning(false);
_type = EntityTypes::Model; _type = EntityTypes::Model;
setProperties(properties);
_jointMappingCompleted = false; _jointMappingCompleted = false;
_lastKnownCurrentFrame = -1; _lastKnownCurrentFrame = -1;
_color[0] = _color[1] = _color[2] = 0; _color[0] = _color[1] = _color[2] = 0;

View file

@ -21,7 +21,7 @@ class ModelEntityItem : public EntityItem {
public: public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties); 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 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) { 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... // our non-pure virtual subclass for now...
ParticleEffectEntityItem::ParticleEffectEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) : ParticleEffectEntityItem::ParticleEffectEntityItem(const EntityItemID& entityItemID) :
EntityItem(entityItemID), EntityItem(entityItemID),
_lastSimulated(usecTimestampNow()), _lastSimulated(usecTimestampNow()),
_particleLifetimes(DEFAULT_MAX_PARTICLES, 0.0f), _particleLifetimes(DEFAULT_MAX_PARTICLES, 0.0f),
@ -121,12 +123,9 @@ ParticleEffectEntityItem::ParticleEffectEntityItem(const EntityItemID& entityIte
_alphaMiddles(DEFAULT_MAX_PARTICLES, DEFAULT_ALPHA), _alphaMiddles(DEFAULT_MAX_PARTICLES, DEFAULT_ALPHA),
_alphaFinishes(DEFAULT_MAX_PARTICLES, DEFAULT_ALPHA), _alphaFinishes(DEFAULT_MAX_PARTICLES, DEFAULT_ALPHA),
_particleMaxBound(glm::vec3(1.0f, 1.0f, 1.0f)), _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; _type = EntityTypes::ParticleEffect;
setColor(DEFAULT_COLOR); setColor(DEFAULT_COLOR);
setProperties(properties);
} }
ParticleEffectEntityItem::~ParticleEffectEntityItem() { ParticleEffectEntityItem::~ParticleEffectEntityItem() {

View file

@ -20,7 +20,7 @@ public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties); static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
ParticleEffectEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties); ParticleEffectEntityItem(const EntityItemID& entityItemID);
virtual ~ParticleEffectEntityItem(); virtual ~ParticleEffectEntityItem();
ALLOW_INSTANTIATION // This class can be instantiated 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 PolyLineEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
EntityItemPointer result{ new PolyLineEntityItem(entityID, properties) }; EntityItemPointer entity{ new PolyLineEntityItem(entityID) };
return result; entity->setProperties(properties);
return entity;
} }
PolyLineEntityItem::PolyLineEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) : PolyLineEntityItem::PolyLineEntityItem(const EntityItemID& entityItemID) :
EntityItem(entityItemID), EntityItem(entityItemID),
_lineWidth(DEFAULT_LINE_WIDTH), _lineWidth(DEFAULT_LINE_WIDTH),
_pointsChanged(true), _pointsChanged(true),
_points(QVector<glm::vec3>(0.0f)), _points(QVector<glm::vec3>(0.0f)),
_vertices(QVector<glm::vec3>(0.0f)), _vertices(QVector<glm::vec3>(0.0f)),
_normals(QVector<glm::vec3>(0.0f)), _normals(QVector<glm::vec3>(0.0f)),
_strokeWidths(QVector<float>(0.0f)) _strokeWidths(QVector<float>(0.0f))
{ {
_type = EntityTypes::PolyLine; _type = EntityTypes::PolyLine;
_created = properties.getCreated();
setProperties(properties);
} }
EntityItemProperties PolyLineEntityItem::getProperties(EntityPropertyFlags desiredProperties) const { EntityItemProperties PolyLineEntityItem::getProperties(EntityPropertyFlags desiredProperties) const {

View file

@ -18,7 +18,7 @@ class PolyLineEntityItem : public EntityItem {
public: public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties); 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 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(""); const QString PolyVoxEntityItem::DEFAULT_Z_TEXTURE_URL = QString("");
EntityItemPointer PolyVoxEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) { 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) { QByteArray PolyVoxEntityItem::makeEmptyVoxelData(quint16 voxelXSize, quint16 voxelYSize, quint16 voxelZSize) {
@ -49,7 +51,7 @@ QByteArray PolyVoxEntityItem::makeEmptyVoxelData(quint16 voxelXSize, quint16 vox
return newVoxelData; return newVoxelData;
} }
PolyVoxEntityItem::PolyVoxEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) : PolyVoxEntityItem::PolyVoxEntityItem(const EntityItemID& entityItemID) :
EntityItem(entityItemID), EntityItem(entityItemID),
_voxelVolumeSize(PolyVoxEntityItem::DEFAULT_VOXEL_VOLUME_SIZE), _voxelVolumeSize(PolyVoxEntityItem::DEFAULT_VOXEL_VOLUME_SIZE),
_voxelData(PolyVoxEntityItem::DEFAULT_VOXEL_DATA), _voxelData(PolyVoxEntityItem::DEFAULT_VOXEL_DATA),
@ -59,7 +61,6 @@ PolyVoxEntityItem::PolyVoxEntityItem(const EntityItemID& entityItemID, const Ent
_yTextureURL(PolyVoxEntityItem::DEFAULT_Y_TEXTURE_URL), _yTextureURL(PolyVoxEntityItem::DEFAULT_Y_TEXTURE_URL),
_zTextureURL(PolyVoxEntityItem::DEFAULT_Z_TEXTURE_URL) { _zTextureURL(PolyVoxEntityItem::DEFAULT_Z_TEXTURE_URL) {
_type = EntityTypes::PolyVox; _type = EntityTypes::PolyVox;
setProperties(properties);
} }
void PolyVoxEntityItem::setVoxelVolumeSize(glm::vec3 voxelVolumeSize) { void PolyVoxEntityItem::setVoxelVolumeSize(glm::vec3 voxelVolumeSize) {

View file

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

View file

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

View file

@ -18,7 +18,7 @@ class SphereEntityItem : public EntityItem {
public: public:
static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties); 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 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; const bool TextEntityItem::DEFAULT_FACE_CAMERA = false;
EntityItemPointer TextEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) { 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) : TextEntityItem::TextEntityItem(const EntityItemID& entityItemID) : EntityItem(entityItemID) {
EntityItem(entityItemID)
{
_type = EntityTypes::Text; _type = EntityTypes::Text;
setProperties(properties);
} }
const float TEXT_ENTITY_ITEM_FIXED_DEPTH = 0.01f; const float TEXT_ENTITY_ITEM_FIXED_DEPTH = 0.01f;

View file

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

View file

@ -23,14 +23,13 @@
const QString WebEntityItem::DEFAULT_SOURCE_URL("http://www.google.com"); const QString WebEntityItem::DEFAULT_SOURCE_URL("http://www.google.com");
EntityItemPointer WebEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) { 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) : WebEntityItem::WebEntityItem(const EntityItemID& entityItemID) : EntityItem(entityItemID) {
EntityItem(entityItemID)
{
_type = EntityTypes::Web; _type = EntityTypes::Web;
setProperties(properties);
} }
const float WEB_ENTITY_ITEM_FIXED_DEPTH = 0.01f; 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); 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 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 = ""; const QString ZoneEntityItem::DEFAULT_COMPOUND_SHAPE_URL = "";
EntityItemPointer ZoneEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) { 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) : ZoneEntityItem::ZoneEntityItem(const EntityItemID& entityItemID) : EntityItem(entityItemID) {
EntityItem(entityItemID)
{
_type = EntityTypes::Zone; _type = EntityTypes::Zone;
_keyLightColor[RED_INDEX] = DEFAULT_KEYLIGHT_COLOR.red; _keyLightColor[RED_INDEX] = DEFAULT_KEYLIGHT_COLOR.red;
@ -50,8 +50,6 @@ ZoneEntityItem::ZoneEntityItem(const EntityItemID& entityItemID, const EntityIte
_compoundShapeURL = DEFAULT_COMPOUND_SHAPE_URL; _compoundShapeURL = DEFAULT_COMPOUND_SHAPE_URL;
_backgroundMode = BACKGROUND_MODE_INHERIT; _backgroundMode = BACKGROUND_MODE_INHERIT;
setProperties(properties);
} }

View file

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

View file

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

View file

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