started support for new entity base class properties like velocity, gravity, damping, and lifetime

This commit is contained in:
ZappoMan 2014-08-08 11:38:03 -07:00
parent a8188b39d7
commit d50a607bc7
7 changed files with 204 additions and 256 deletions

View file

@ -29,6 +29,15 @@
#include "EntityItem.h"
#include "EntityTree.h"
const float EntityItem::IMMORTAL = -1.0f; /// special lifetime which means the entity lives for ever. default lifetime
const float EntityItem::DEFAULT_GLOW_LEVEL = 0.0f;
const float EntityItem::DEFAULT_MASS = 1.0f;
const float EntityItem::DEFAULT_LIFETIME = EntityItem::IMMORTAL;
const float EntityItem::DEFAULT_DAMPING = 0.99f;
const glm::vec3 EntityItem::DEFAULT_VELOCITY = glm::vec3(0, 0, 0);
const glm::vec3 EntityItem::DEFAULT_GRAVITY = glm::vec3(0, (-9.8f / TREE_SCALE), 0);
const QString EntityItem::DEFAULT_SCRIPT = QString("");
void EntityItem::initFromEntityItemID(const EntityItemID& entityItemID) {
_id = entityItemID.id;
_creatorTokenID = entityItemID.creatorTokenID;
@ -42,6 +51,13 @@ void EntityItem::initFromEntityItemID(const EntityItemID& entityItemID) {
_radius = 0;
_rotation = ENTITY_DEFAULT_ROTATION;
_shouldBeDeleted = false;
_glowLevel = DEFAULT_GLOW_LEVEL;
_mass = DEFAULT_MASS;
_velocity = DEFAULT_VELOCITY;
_gravity = DEFAULT_GRAVITY;
_damping = DEFAULT_DAMPING;
_lifetime = DEFAULT_LIFETIME;
}
EntityItem::EntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) {
@ -219,129 +235,7 @@ qDebug() << "EntityItem::appendEntityData() ... lastEdited=" << lastEdited;
// PROP_SCRIPT
// script would go here...
#if 0 // def HIDE_SUBCLASS_METHODS
// PROP_COLOR
if (requestedProperties.getHasProperty(PROP_COLOR)) {
//qDebug() << "PROP_COLOR requested...";
LevelDetails propertyLevel = packetData->startLevel();
successPropertyFits = packetData->appendColor(getColor());
if (successPropertyFits) {
propertyFlags |= PROP_COLOR;
propertiesDidntFit -= PROP_COLOR;
propertyCount++;
packetData->endLevel(propertyLevel);
} else {
//qDebug() << "PROP_COLOR didn't fit...";
packetData->discardLevel(propertyLevel);
appendState = OctreeElement::PARTIAL;
}
} else {
//qDebug() << "PROP_COLOR NOT requested...";
propertiesDidntFit -= PROP_COLOR;
}
// PROP_MODEL_URL
if (requestedProperties.getHasProperty(PROP_MODEL_URL)) {
//qDebug() << "PROP_MODEL_URL requested...";
LevelDetails propertyLevel = packetData->startLevel();
successPropertyFits = packetData->appendValue(getModelURL());
if (successPropertyFits) {
propertyFlags |= PROP_MODEL_URL;
propertiesDidntFit -= PROP_MODEL_URL;
propertyCount++;
packetData->endLevel(propertyLevel);
} else {
//qDebug() << "PROP_MODEL_URL didn't fit...";
packetData->discardLevel(propertyLevel);
appendState = OctreeElement::PARTIAL;
}
} else {
//qDebug() << "PROP_MODEL_URL NOT requested...";
propertiesDidntFit -= PROP_MODEL_URL;
}
// PROP_ANIMATION_URL
if (requestedProperties.getHasProperty(PROP_ANIMATION_URL)) {
//qDebug() << "PROP_ANIMATION_URL requested...";
LevelDetails propertyLevel = packetData->startLevel();
successPropertyFits = packetData->appendValue(getAnimationURL());
if (successPropertyFits) {
propertyFlags |= PROP_ANIMATION_URL;
propertiesDidntFit -= PROP_ANIMATION_URL;
propertyCount++;
packetData->endLevel(propertyLevel);
} else {
//qDebug() << "PROP_ANIMATION_URL didn't fit...";
packetData->discardLevel(propertyLevel);
appendState = OctreeElement::PARTIAL;
}
} else {
//qDebug() << "PROP_ANIMATION_URL NOT requested...";
propertiesDidntFit -= PROP_ANIMATION_URL;
}
// PROP_ANIMATION_FPS
if (requestedProperties.getHasProperty(PROP_ANIMATION_FPS)) {
//qDebug() << "PROP_ANIMATION_FPS requested...";
LevelDetails propertyLevel = packetData->startLevel();
successPropertyFits = packetData->appendValue(getAnimationFPS());
if (successPropertyFits) {
propertyFlags |= PROP_ANIMATION_FPS;
propertiesDidntFit -= PROP_ANIMATION_FPS;
propertyCount++;
packetData->endLevel(propertyLevel);
} else {
//qDebug() << "PROP_ANIMATION_FPS didn't fit...";
packetData->discardLevel(propertyLevel);
appendState = OctreeElement::PARTIAL;
}
} else {
//qDebug() << "PROP_ANIMATION_FPS NOT requested...";
propertiesDidntFit -= PROP_ANIMATION_FPS;
}
// PROP_ANIMATION_FRAME_INDEX
if (requestedProperties.getHasProperty(PROP_ANIMATION_FRAME_INDEX)) {
//qDebug() << "PROP_ANIMATION_FRAME_INDEX requested...";
LevelDetails propertyLevel = packetData->startLevel();
successPropertyFits = packetData->appendValue(getAnimationFrameIndex());
if (successPropertyFits) {
propertyFlags |= PROP_ANIMATION_FRAME_INDEX;
propertiesDidntFit -= PROP_ANIMATION_FRAME_INDEX;
propertyCount++;
packetData->endLevel(propertyLevel);
} else {
//qDebug() << "PROP_ANIMATION_FRAME_INDEX didn't fit...";
packetData->discardLevel(propertyLevel);
appendState = OctreeElement::PARTIAL;
}
} else {
//qDebug() << "PROP_ANIMATION_FRAME_INDEX NOT requested...";
propertiesDidntFit -= PROP_ANIMATION_FRAME_INDEX;
}
// PROP_ANIMATION_PLAYING
if (requestedProperties.getHasProperty(PROP_ANIMATION_PLAYING)) {
//qDebug() << "PROP_ANIMATION_PLAYING requested...";
LevelDetails propertyLevel = packetData->startLevel();
successPropertyFits = packetData->appendValue(getAnimationIsPlaying());
if (successPropertyFits) {
propertyFlags |= PROP_ANIMATION_PLAYING;
propertiesDidntFit -= PROP_ANIMATION_PLAYING;
propertyCount++;
packetData->endLevel(propertyLevel);
} else {
//qDebug() << "PROP_ANIMATION_PLAYING didn't fit...";
packetData->discardLevel(propertyLevel);
appendState = OctreeElement::PARTIAL;
}
} else {
//qDebug() << "PROP_ANIMATION_PLAYING NOT requested...";
propertiesDidntFit -= PROP_ANIMATION_PLAYING;
}
#endif //def HIDE_SUBCLASS_METHODS
// TO DO - put all the other default items here!!!!
}
if (propertyCount > 0) {
int endOfEntityItemData = packetData->getUncompressedByteOffset();
@ -542,82 +436,6 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
// PROP_SCRIPT
// script would go here...
#if 0 //def HIDE_SUBCLASS_METHODS
// PROP_COLOR
if (propertyFlags.getHasProperty(PROP_COLOR)) {
rgbColor color;
if (overwriteLocalData) {
memcpy(_color, dataAt, sizeof(_color));
}
dataAt += sizeof(color);
bytesRead += sizeof(color);
}
// PROP_MODEL_URL
if (propertyFlags.getHasProperty(PROP_MODEL_URL)) {
// TODO: fix to new format...
uint16_t modelURLLength;
memcpy(&modelURLLength, dataAt, sizeof(modelURLLength));
dataAt += sizeof(modelURLLength);
bytesRead += sizeof(modelURLLength);
QString modelURLString((const char*)dataAt);
dataAt += modelURLLength;
bytesRead += modelURLLength;
if (overwriteLocalData) {
setModelURL(modelURLString);
}
}
// PROP_ANIMATION_URL
if (propertyFlags.getHasProperty(PROP_ANIMATION_URL)) {
// animationURL
uint16_t animationURLLength;
memcpy(&animationURLLength, dataAt, sizeof(animationURLLength));
dataAt += sizeof(animationURLLength);
bytesRead += sizeof(animationURLLength);
QString animationURLString((const char*)dataAt);
dataAt += animationURLLength;
bytesRead += animationURLLength;
if (overwriteLocalData) {
setAnimationURL(animationURLString);
}
}
// PROP_ANIMATION_FPS
if (propertyFlags.getHasProperty(PROP_ANIMATION_FPS)) {
float animationFPS;
memcpy(&animationFPS, dataAt, sizeof(animationFPS));
dataAt += sizeof(animationFPS);
bytesRead += sizeof(animationFPS);
if (overwriteLocalData) {
_animationFPS = animationFPS;
}
}
// PROP_ANIMATION_FRAME_INDEX
if (propertyFlags.getHasProperty(PROP_ANIMATION_FRAME_INDEX)) {
float animationFrameIndex;
memcpy(&animationFrameIndex, dataAt, sizeof(animationFrameIndex));
dataAt += sizeof(animationFrameIndex);
bytesRead += sizeof(animationFrameIndex);
if (overwriteLocalData) {
_animationFrameIndex = animationFrameIndex;
}
}
// PROP_ANIMATION_PLAYING
if (propertyFlags.getHasProperty(PROP_ANIMATION_PLAYING)) {
bool animationIsPlaying;
memcpy(&animationIsPlaying, dataAt, sizeof(animationIsPlaying));
dataAt += sizeof(animationIsPlaying);
bytesRead += sizeof(animationIsPlaying);
if (overwriteLocalData) {
_animationIsPlaying = animationIsPlaying;
}
}
#endif
}
return bytesRead;
}
@ -628,15 +446,6 @@ void EntityItem::debugDump() const {
qDebug(" should die:%s", debug::valueOf(getShouldBeDeleted()));
qDebug(" position:%f,%f,%f", _position.x, _position.y, _position.z);
qDebug(" radius:%f", getRadius());
#if 0 //def HIDE_SUBCLASS_METHODS
qDebug(" color:%d,%d,%d", _color[0], _color[1], _color[2]);
if (!getModelURL().isEmpty()) {
qDebug() << " modelURL:" << qPrintable(getModelURL());
} else {
qDebug() << " modelURL: NONE";
}
#endif
}
@ -846,14 +655,98 @@ qDebug() << "EntityItem::encodeEntityEditMessageDetails() ... lastEdited=" << la
//qDebug() << "PROP_SHOULD_BE_DELETED NOT requested...";
propertiesDidntFit -= PROP_SHOULD_BE_DELETED;
}
// PROP_MASS,
if (requestedProperties.getHasProperty(PROP_MASS)) {
LevelDetails propertyLevel = packetData.startLevel();
successPropertyFits = packetData.appendValue(properties.getMass());
if (successPropertyFits) {
propertyFlags |= PROP_MASS;
propertiesDidntFit -= PROP_MASS;
propertyCount++;
packetData.endLevel(propertyLevel);
} else {
packetData.discardLevel(propertyLevel);
appendState = OctreeElement::PARTIAL;
}
} else {
propertiesDidntFit -= PROP_MASS;
}
// PROP_VELOCITY,
if (requestedProperties.getHasProperty(PROP_VELOCITY)) {
LevelDetails propertyLevel = packetData.startLevel();
successPropertyFits = packetData.appendValue(properties.getVelocity());
if (successPropertyFits) {
propertyFlags |= PROP_VELOCITY;
propertiesDidntFit -= PROP_VELOCITY;
propertyCount++;
packetData.endLevel(propertyLevel);
} else {
packetData.discardLevel(propertyLevel);
appendState = OctreeElement::PARTIAL;
}
} else {
propertiesDidntFit -= PROP_VELOCITY;
}
// PROP_GRAVITY,
if (requestedProperties.getHasProperty(PROP_GRAVITY)) {
LevelDetails propertyLevel = packetData.startLevel();
successPropertyFits = packetData.appendValue(properties.getGravity());
if (successPropertyFits) {
propertyFlags |= PROP_GRAVITY;
propertiesDidntFit -= PROP_GRAVITY;
propertyCount++;
packetData.endLevel(propertyLevel);
} else {
packetData.discardLevel(propertyLevel);
appendState = OctreeElement::PARTIAL;
}
} else {
propertiesDidntFit -= PROP_GRAVITY;
}
// PROP_DAMPING,
if (requestedProperties.getHasProperty(PROP_DAMPING)) {
LevelDetails propertyLevel = packetData.startLevel();
successPropertyFits = packetData.appendValue(properties.getDamping());
if (successPropertyFits) {
propertyFlags |= PROP_DAMPING;
propertiesDidntFit -= PROP_DAMPING;
propertyCount++;
packetData.endLevel(propertyLevel);
} else {
packetData.discardLevel(propertyLevel);
appendState = OctreeElement::PARTIAL;
}
} else {
propertiesDidntFit -= PROP_DAMPING;
}
// PROP_LIFETIME,
if (requestedProperties.getHasProperty(PROP_LIFETIME)) {
LevelDetails propertyLevel = packetData.startLevel();
successPropertyFits = packetData.appendValue(properties.getLifetime());
if (successPropertyFits) {
propertyFlags |= PROP_LIFETIME;
propertiesDidntFit -= PROP_LIFETIME;
propertyCount++;
packetData.endLevel(propertyLevel);
} else {
packetData.discardLevel(propertyLevel);
appendState = OctreeElement::PARTIAL;
}
} else {
propertiesDidntFit -= PROP_LIFETIME;
}
// PROP_SCRIPT
// script would go here...
//#if 0 // def HIDE_SUBCLASS_METHODS
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// TODO: move these??? how to handle this for subclass properties???
// PROP_COLOR
@ -978,7 +871,6 @@ qDebug() << "EntityItem EntityItem::encodeEntityEditMessageDetails() model URL="
propertiesDidntFit -= PROP_ANIMATION_PLAYING;
}
//#endif //def HIDE_SUBCLASS_METHODS
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

View file

@ -84,7 +84,6 @@ public:
// similar to assignment/copy, but it handles keeping lifetime accurate
void copyChangedProperties(const EntityItem& other);
// attributes applicable to all entity types
EntityTypes::EntityType getType() const { return _type; }
const glm::vec3& getPosition() const { return _position; } /// get position in domain scale units (0.0 - 1.0)
@ -99,17 +98,50 @@ public:
bool getShouldBeDeleted() const { return _shouldBeDeleted; }
void setShouldBeDeleted(bool shouldBeDeleted) { _shouldBeDeleted = shouldBeDeleted; }
static const float DEFAULT_GLOW_LEVEL;
float getGlowLevel() const { return _glowLevel; }
void setGlowLevel(float glowLevel) { _glowLevel = glowLevel; }
static const float DEFAULT_MASS;
float getMass() const { return _mass; }
void setMass(float value) { _mass = value; }
static const glm::vec3 DEFAULT_VELOCITY;
const glm::vec3& getVelocity() const { return _velocity; } /// velocity in domain scale units (0.0-1.0) per second
void setVelocity(const glm::vec3& value) { _velocity = value; } /// velocity in domain scale units (0.0-1.0) per second
static const glm::vec3 DEFAULT_GRAVITY;
const glm::vec3& getGravity() const { return _gravity; } /// gravity in domain scale units (0.0-1.0) per second squared
void setGravity(const glm::vec3& value) { _gravity = value; } /// gravity in domain scale units (0.0-1.0) per second squared
static const float DEFAULT_DAMPING;
float getDamping() const { return _damping; }
void setDamping(float value) { _damping = value; }
// lifetime related properties.
static const float IMMORTAL; /// special lifetime which means the entity lives for ever. default lifetime
static const float DEFAULT_LIFETIME;
float getLifetime() const { return _lifetime; } /// get the lifetime in seconds for the entity
void setLifetime(float value) { _lifetime = value; } /// set the lifetime in seconds for the entity
/// is this entity immortal, in that it has no lifetime set, and will exist until manually deleted
bool isImmortal() const { return _lifetime == IMMORTAL; }
/// is this entity mortal, in that it has a lifetime set, and will automatically be deleted when that lifetime expires
bool isMortal() const { return _lifetime != IMMORTAL; }
/// age of this entity in seconds
float getAge() const { return (float)(usecTimestampNow() - _created) / (float)USECS_PER_SECOND; }
// position, size, and bounds related helpers
float getSize() const { return _radius * 2.0f; } /// get maximum dimension in domain scale units (0.0 - 1.0)
glm::vec3 getMinimumPoint() const { return _position - glm::vec3(_radius, _radius, _radius); }
glm::vec3 getMaximumPoint() const { return _position + glm::vec3(_radius, _radius, _radius); }
AACube getAACube() const { return AACube(getMinimumPoint(), getSize()); } /// AACube in domain scale units (0.0 - 1.0)
static const QString DEFAULT_SCRIPT;
const QString& getScript() const { return _script; }
void setScript(const QString& value) { _script = value; }
protected:
virtual void initFromEntityItemID(const EntityItemID& entityItemID); // maybe useful to allow subclasses to init
@ -120,12 +152,19 @@ protected:
bool _newlyCreated;
quint64 _lastUpdated;
quint64 _lastEdited;
quint64 _created;
glm::vec3 _position;
float _radius;
glm::quat _rotation;
bool _shouldBeDeleted;
float _glowLevel;
float _mass;
glm::vec3 _velocity;
glm::vec3 _gravity;
float _damping;
float _lifetime;
QString _script;
};
class SphereEntityItem : public EntityItem {

View file

@ -12,8 +12,6 @@
#ifndef hifi_EntityItemProperties_h
#define hifi_EntityItemProperties_h
#define HIDE_SUBCLASS_METHODS 1
#include <stdint.h>
#include <glm/glm.hpp>
@ -33,17 +31,7 @@
#include "EntityTypes.h"
const uint16_t ENTITY_PACKET_CONTAINS_RADIUS = 1;
const uint16_t ENTITY_PACKET_CONTAINS_POSITION = 2;
const uint16_t ENTITY_PACKET_CONTAINS_COLOR = 4;
const uint16_t ENTITY_PACKET_CONTAINS_SHOULDDIE = 8;
const uint16_t ENTITY_PACKET_CONTAINS_MODEL_URL = 16;
const uint16_t ENTITY_PACKET_CONTAINS_ROTATION = 32;
const uint16_t ENTITY_PACKET_CONTAINS_ANIMATION_URL = 64;
const uint16_t ENTITY_PACKET_CONTAINS_ANIMATION_PLAYING = 128;
const uint16_t ENTITY_PACKET_CONTAINS_ANIMATION_FRAME = 256;
const uint16_t ENTITY_PACKET_CONTAINS_ANIMATION_FPS = 512;
// TODO: should these be static members of EntityItem or EntityItemProperties?
const float ENTITY_DEFAULT_RADIUS = 0.1f / TREE_SCALE;
const float ENTITY_MINIMUM_ELEMENT_SIZE = (1.0f / 100000.0f) / TREE_SCALE; // smallest size container
const QString ENTITY_DEFAULT_MODEL_URL("");
@ -55,13 +43,22 @@ const float ENTITY_DEFAULT_ANIMATION_FPS = 30.0f;
enum EntityPropertyList {
PROP_PAGED_PROPERTY,
PROP_CUSTOM_PROPERTIES_INCLUDED,
// these properties are supported by the EntityItem base class
PROP_VISIBLE,
PROP_POSITION,
PROP_RADIUS,
PROP_ROTATION,
PROP_MASS,
PROP_VELOCITY,
PROP_GRAVITY,
PROP_DAMPING,
PROP_LIFETIME,
PROP_SCRIPT,
PROP_MODEL_URL,
// these properties are supported by some derived classes
PROP_COLOR,
PROP_MODEL_URL,
PROP_ANIMATION_URL,
PROP_ANIMATION_FPS,
PROP_ANIMATION_FRAME_INDEX,
@ -133,15 +130,29 @@ public:
void setRadius(float value) { _radius = value; _radiusChanged = true; }
void setRotation(const glm::quat& rotation) { _rotation = rotation; _rotationChanged = true; }
void setShouldBeDeleted(bool shouldBeDeleted) { _shouldBeDeleted = shouldBeDeleted; _shouldBeDeletedChanged = true; }
float getMass() const { return _mass; }
void setMass(float value) { _mass = value; }
const glm::vec3& getVelocity() const { return _velocity; } /// velocity in domain scale units (0.0-1.0) per second
void setVelocity(const glm::vec3& value) { _velocity = value; } /// velocity in domain scale units (0.0-1.0) per second
const glm::vec3& getGravity() const { return _gravity; } /// gravity in domain scale units (0.0-1.0) per second squared
void setGravity(const glm::vec3& value) { _gravity = value; } /// gravity in domain scale units (0.0-1.0) per second squared
float getDamping() const { return _damping; }
void setDamping(float value) { _damping = value; }
float getLifetime() const { return _lifetime; } /// get the lifetime in seconds for the entity
void setLifetime(float value) { _lifetime = value; } /// set the lifetime in seconds for the entity
// NOTE: how do we handle _defaultSettings???
bool containsBoundsProperties() const { return (_positionChanged || _radiusChanged); }
bool containsPositionChange() const { return _positionChanged; }
bool containsRadiusChange() const { return _radiusChanged; }
// TODO: this need to be more generic. for now, we're going to have the properties class support these as
// named getter/setters, but we want to move them to generic types...
//#ifdef HIDE_SUBCLASS_METHODS
// TODO: this need to be more generic. for now, we're going to have the properties class support these as
// named getter/setters, but we want to move them to generic types...
// properties we want to move to just models and particles
xColor getColor() const { return _color; }
const QString& getModelURL() const { return _modelURL; }
@ -159,7 +170,6 @@ public:
void setAnimationIsPlaying(bool value) { _animationIsPlaying = value; _animationIsPlayingChanged = true; }
void setAnimationFPS(float value) { _animationFPS = value; _animationFPSChanged = true; }
void setGlowLevel(float value) { _glowLevel = value; _glowLevelChanged = true; }
//#endif
private:
friend bool EntityTypes::decodeEntityEditPacket(const unsigned char* data, int bytesToRead, int& processedBytes,
@ -175,15 +185,20 @@ private:
float _radius;
glm::quat _rotation;
bool _shouldBeDeleted;
float _mass;
glm::vec3 _velocity;
glm::vec3 _gravity;
float _damping;
float _lifetime;
QString _script;
bool _positionChanged;
bool _radiusChanged;
bool _rotationChanged;
bool _shouldBeDeletedChanged;
// TODO: this need to be more generic. for now, we're going to have the properties class support these as
// named getter/setters, but we want to move them to generic types...
//#ifdef HIDE_SUBCLASS_METHODS
// TODO: this need to be more generic. for now, we're going to have the properties class support these as
// named getter/setters, but we want to move them to generic types...
xColor _color;
QString _modelURL;
QString _animationURL;
@ -200,7 +215,6 @@ private:
bool _animationFrameIndexChanged;
bool _animationFPSChanged;
bool _glowLevelChanged;
//#endif
bool _defaultSettings;
};

View file

@ -290,13 +290,10 @@ qDebug() << "EntityTypes::decodeEntityEditPacket() ... lastEdited=" << lastEdite
// script would go here...
//#ifdef HIDE_SUBCLASS_METHODS
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// TODO: this needs to be reconciled...
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// PROP_COLOR
if (propertyFlags.getHasProperty(PROP_COLOR)) {
xColor color;
@ -364,7 +361,6 @@ qDebug() << "EntityTypes::decodeEntityEditPacket() ... lastEdited=" << lastEdite
processedBytes += sizeof(animationIsPlaying);
properties.setAnimationIsPlaying(animationIsPlaying);
}
//#endif
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const bool wantDebugging = false;
@ -378,10 +374,6 @@ qDebug() << "EntityTypes::decodeEntityEditPacket() ... lastEdited=" << lastEdite
}
bool EntityTypes::registerEntityTypeRenderer(EntityType entityType, EntityTypeRenderer renderMethod) {
qDebug() << "EntityTypes::registerEntityTypeRenderer()";
qDebug() << " entityType=" << entityType;
qDebug() << " renderMethod=" << (void*)renderMethod;
if (!_renderersInitialized) {
memset(&_renderers,0,sizeof(_renderers));
_renderersInitialized = true;

View file

@ -7,7 +7,9 @@ Base properties...
* velocity
* gravity
* damping
* mass
* glow level
* lifetime
should these be included for all entities? Light, Models, planes, etc?
* rotational velocity? - wouldn't that be cool to be automatic with no edits
@ -38,6 +40,7 @@ Model properties:
// REQUIRED TO DO:
A) add velocity, gravity, damping to entity base class
Aa) visible???
2) EntityTree::update()/EntityTreeElement::update()... velocity changes...
C) verify "update" works
@ -47,26 +50,35 @@ Model properties:
22a) void ModelItemProperties::copyFromNewModelItem(const ModelItem& modelItem); // XXX ??? Do we need this????
22b) Local Entities Overlay - from Local Models Overlay
22c) void ModelTree::sendModels(ModelEditPacketSender* packetSender, float x, float y, float z)....
bool EntityTree::sendEntitiesOperation(OctreeElement* element, void* extraData) {...
DONE -- 22d) void ModelTree::findModelsInCube(const AACube& cube, QVector<ModelItem*>& foundModels)...
DONE -- 22e) void ModelTreeElement::getModelsInside(const AACube& box, QVector<ModelItem*>& foundModels)...
F) TODO: do we need to handle "killing" viewed entities as well???
void EntityTreeElement::updateEntityItemID(const EntityItemID& creatorTokenEntityID, const EntityItemID& knownIDEntityID)...
13) support sitpoints
K) verify shadows work
M) change EntityTree::handleAddEntityResponse() to not scan entire tree... it can use the containing element stuff!!!
N) Handle the ID -> UUID swap in old files to new files
O) Test models -> attachments logic
12) clean up delete behavior...
12a) make sure server is deleting items??
12b) Use the delete message instead of shouldDelete property
Q) Referentials????
R) fix these!!!
EntityItem::encodeEntityEditMessageDetails()
EntityTypes::decodeEntityEditPacket()
These both contain details about non base class properties I think moving this to the EntityItemProperties is better...
// NICE TO DO:
P) unit tests?
Pa) OctreeTests::modelItemTests()...????
// G) why does is the Box entity not drawn in it's bounds
// H) make the rotated model bounds work for other entity types?
@ -135,9 +147,6 @@ Model properties:
// Abort trap: 6
// 12) clean up delete behavior...
// 12a) make sure server is deleting items??
// 12b) Use the delete message instead of shouldDelete property
// 13b) add user properties
// 14) implement "Light" entity, "Fire" entity?
@ -191,4 +200,9 @@ Model properties:
// SOLVED - B) enable animation in model class
// SOLVED - 18) change ID's to UUIDS????
// SOLVED - L) sometimes assert/crashes in server about containing element? I think we're adding entityIDs with UNKNOWN_ID to our maps
// this crash is definitely caused by starting a server with an existing models file which has ID's already in use...
// this crash is definitely caused by starting a server with an existing models file which has ID's already in use...
// SOLVED - M) change EntityTree::handleAddEntityResponse() to not scan entire tree... it can use the containing element stuff!!!
// SOLVED - F) TODO: do we need to handle "killing" viewed entities as well???
// void EntityTreeElement::updateEntityItemID(const EntityItemID& creatorTokenEntityID, const EntityItemID& knownIDEntityID)...

View file

@ -27,7 +27,6 @@
void EntityTests::entityTreeTests(bool verbose) {
//#ifdef HIDE_SUBCLASS_METHODS
bool extraVerbose = false;
int testsTaken = 0;
int testsPassed = 0;
@ -513,8 +512,6 @@ void EntityTests::entityTreeTests(bool verbose) {
if (verbose) {
qDebug() << "******************************************************************************************";
}
//#endif
//#endif // 0
}

View file

@ -1271,7 +1271,7 @@ void OctreeTests::byteCountCodingTests(bool verbose) {
void OctreeTests::modelItemTests(bool verbose) {
#if 0 // def HIDE_SUBCLASS_METHODS
#if 0 // TODO - repair/replace these
//verbose = true;
EntityTreeElementExtraEncodeData modelTreeElementExtraEncodeData;