...
 
Commits (3)
......@@ -93,6 +93,7 @@ void FutariAttractor::refresh() {
s *= 0;
}
_data.changed_layer = _data.futari_layers != futari_layers;
_data.changed_enabled = _data.enabled != enabled;
_data.changed_position = _data.position != p;
_data.changed_orientation = _data.orientation != o;
......@@ -108,6 +109,7 @@ void FutariAttractor::refresh() {
_data.changed_position_mult = _data.position_mult != position_mult;
_data.changed =
_data.changed_layer ||
_data.changed_enabled ||
_data.changed_position ||
_data.changed_orientation ||
......@@ -119,6 +121,7 @@ void FutariAttractor::refresh() {
_data.changed_position_mult;
if (_data.changed) {
_data.futari_layers = futari_layers;
_data.enabled = enabled;
_data.position = p;
_data.orientation = o;
......
......@@ -123,12 +123,12 @@ FutariModifierData* FutariFloor::data_ptr() {
void FutariFloor::refresh() {
_data.reset();
FutariFloor::_data.reset();
if (!enabled) {
_data.changed_enabled = _data.enabled != enabled;
_data.changed = _data.changed_enabled;
_data.enabled = enabled;
FutariFloor::_data.changed_enabled = FutariFloor::_data.enabled != enabled;
FutariFloor::_data.changed = FutariFloor::_data.changed_enabled;
FutariFloor::_data.enabled = enabled;
return;
}
......@@ -141,59 +141,62 @@ void FutariFloor::refresh() {
s *= 0;
}
_data.changed_enabled = _data.enabled != enabled;
_data.changed_position = _data.position != p;
_data.changed_orientation = _data.orientation != o;
_data.changed_xaxis = _data.xaxis != vx;
_data.changed_zaxis = _data.zaxis != vz;
_data.changed_strength = _data.strength != s;
_data.changed_strength_decay =
_data.strength_decay != strength_decay_texture ||
_data.strength_decay.is_valid() != strength_decay_texture.is_valid();
_data.changed_lifetime =
_data.lifetime != lifetime_texture ||
_data.lifetime.is_valid() != lifetime_texture.is_valid();
_data.changed_infinite = _data.infinite != infinite;
_data.changed_width = _data.width != width;
_data.changed_height = _data.height != height;
_data.changed_viscous = _data.viscous != viscous;
_data.changed_range = _data.range != range;
_data.changed_velocity_mult = _data.velocity_mult != velocity_mult;
_data.changed_position_mult = _data.position_mult != position_mult;
_data.changed =
_data.changed_enabled ||
_data.changed_position ||
_data.changed_orientation ||
_data.changed_xaxis ||
_data.changed_zaxis ||
_data.changed_strength ||
_data.changed_strength_decay ||
_data.changed_lifetime ||
_data.changed_infinite ||
_data.changed_width ||
_data.changed_height ||
_data.changed_viscous ||
_data.changed_range ||
_data.changed_velocity_mult ||
_data.changed_position_mult;
if (_data.changed) {
_data.enabled = enabled;
_data.position = p;
_data.orientation = o;
_data.xaxis = vx;
_data.zaxis = vz;
_data.strength = s;
_data.strength_decay = strength_decay_texture;
_data.lifetime = lifetime_texture;
_data.infinite = infinite;
_data.width = width;
_data.height = height;
_data.viscous = viscous;
_data.range = range;
_data.velocity_mult = velocity_mult;
_data.position_mult = position_mult;
FutariFloor::_data.changed_layer = FutariFloor::_data.futari_layers != futari_layers;
FutariFloor::_data.changed_enabled = FutariFloor::_data.enabled != enabled;
FutariFloor::_data.changed_position = FutariFloor::_data.position != p;
FutariFloor::_data.changed_orientation = FutariFloor::_data.orientation != o;
FutariFloor::_data.changed_xaxis = FutariFloor::_data.xaxis != vx;
FutariFloor::_data.changed_zaxis = FutariFloor::_data.zaxis != vz;
FutariFloor::_data.changed_strength = FutariFloor::_data.strength != s;
FutariFloor::_data.changed_strength_decay =
FutariFloor::_data.strength_decay != strength_decay_texture ||
FutariFloor::_data.strength_decay.is_valid() != strength_decay_texture.is_valid();
FutariFloor::_data.changed_lifetime =
FutariFloor::_data.lifetime != lifetime_texture ||
FutariFloor::_data.lifetime.is_valid() != lifetime_texture.is_valid();
FutariFloor::_data.changed_infinite = FutariFloor::_data.infinite != infinite;
FutariFloor::_data.changed_width = FutariFloor::_data.width != width;
FutariFloor::_data.changed_height = FutariFloor::_data.height != height;
FutariFloor::_data.changed_viscous = FutariFloor::_data.viscous != viscous;
FutariFloor::_data.changed_range = FutariFloor::_data.range != range;
FutariFloor::_data.changed_velocity_mult = FutariFloor::_data.velocity_mult != velocity_mult;
FutariFloor::_data.changed_position_mult = FutariFloor::_data.position_mult != position_mult;
FutariFloor::_data.changed =
FutariFloor::_data.changed_layer ||
FutariFloor::_data.changed_enabled ||
FutariFloor::_data.changed_position ||
FutariFloor::_data.changed_orientation ||
FutariFloor::_data.changed_xaxis ||
FutariFloor::_data.changed_zaxis ||
FutariFloor::_data.changed_strength ||
FutariFloor::_data.changed_strength_decay ||
FutariFloor::_data.changed_lifetime ||
FutariFloor::_data.changed_infinite ||
FutariFloor::_data.changed_width ||
FutariFloor::_data.changed_height ||
FutariFloor::_data.changed_viscous ||
FutariFloor::_data.changed_range ||
FutariFloor::_data.changed_velocity_mult ||
FutariFloor::_data.changed_position_mult;
if (FutariFloor::_data.changed) {
FutariFloor::_data.futari_layers = futari_layers;
FutariFloor::_data.enabled = enabled;
FutariFloor::_data.position = p;
FutariFloor::_data.orientation = o;
FutariFloor::_data.xaxis = vx;
FutariFloor::_data.zaxis = vz;
FutariFloor::_data.strength = s;
FutariFloor::_data.strength_decay = strength_decay_texture;
FutariFloor::_data.lifetime = lifetime_texture;
FutariFloor::_data.infinite = infinite;
FutariFloor::_data.width = width;
FutariFloor::_data.height = height;
FutariFloor::_data.viscous = viscous;
FutariFloor::_data.range = range;
FutariFloor::_data.velocity_mult = velocity_mult;
FutariFloor::_data.position_mult = position_mult;
}
}
......
......@@ -84,6 +84,7 @@ public:
// set in modifier constructor
const FutariModifier* ptr;
int futari_type;
uint32_t futari_layers;
bool enabled;
......@@ -99,6 +100,7 @@ public:
Ref<GradientTexture> lifetime;
bool changed;
bool changed_layer;
bool changed_enabled;
bool changed_position;
bool changed_orientation;
......@@ -111,12 +113,14 @@ public:
FutariModifierData() :
ptr(0), futari_type(FMT_NONE),
futari_layers(1),
enabled(FUTARI_MODIFIER_ENABLED),
strength(0),
range(0),
velocity_mult(0),
position_mult(0),
changed(false),
changed_layer(false),
changed_enabled(false),
changed_position(false),
changed_orientation(false),
......@@ -132,6 +136,7 @@ public:
void reset() {
changed = false;
changed_layer = false;
changed_enabled = false;
changed_position = false;
changed_orientation = false;
......@@ -148,6 +153,7 @@ public:
ptr = src.ptr;
futari_type = src.futari_type;
futari_layers = src.futari_layers;
position = src.position;
strength = src.strength;
......@@ -159,6 +165,7 @@ public:
lifetime = src.lifetime;
changed = src.changed;
changed_layer = src.changed_layer;
changed_enabled = src.changed_enabled;
changed_position = src.changed_position;
changed_orientation = src.changed_orientation;
......
This diff is collapsed.
......@@ -92,7 +92,7 @@ public:
// Node* get_root( Node* ) const;
bool find_node( const Node* stack, const Node* needle ) const;
void _internal_process( );
AABB get_aabb( ) const;
......@@ -157,10 +157,32 @@ protected:
Map<String, FutariModifier*> _mod_map;
// called by _internal_process during server lock
void _clear_modifier_vectors();
bool _is_empty_modifier_vectors();
void _rebuild_modifier_vectors();
bool _validate_modifier_vectors();
bool _update_modifier_vectors();
void _regenerate_attractors( Ref<FutariMaterial>& );
void _update_attractors_param( Ref<FutariMaterial>& );
void _regenerate_winds( Ref<FutariMaterial>& );
void _update_winds_param( Ref<FutariMaterial>& );
void _regenerate_vortices( Ref<FutariMaterial>& );
void _update_vortices_param( Ref<FutariMaterial>& );
void _regenerate_floors( Ref<FutariMaterial>& );
void _update_floors_param( Ref<FutariMaterial>& );
Vector<FutariModifierData*> _modifiers;
Vector<FutariAttractorData*> _attractors;
Vector<FutariWindData*> _winds;
Vector<FutariVortexData*> _vortices;
Vector<FutariFloorData*> _floors;
bool bypass_last_revision;
uint64_t last_revision;
bool _procmat_refresh;
......
......@@ -55,13 +55,12 @@
static FutariServer* _instance = 0;
FutariServer* FutariServer::get() {
if (_instance == 0) {
_instance = new FutariServer();
}
return _instance;
}
void FutariServer::append(FutariModifierData* fm) {
......@@ -80,6 +79,7 @@ void FutariServer::append(FutariModifierData* fm) {
_instance->mut->lock();
_instance->modifier_data.push_back(fm);
_instance->_revision++;
_instance->mut->unlock();
}
......@@ -102,6 +102,7 @@ void FutariServer::remove(FutariModifierData* fm) {
_instance->mut->lock();
_instance->modifier_data.erase(itm);
_instance->_revision++;
_instance->mut->unlock();
}
......@@ -125,9 +126,15 @@ std::vector< FutariModifierData* >& FutariServer::data() {
return _instance->modifier_data;
}
FutariServer::FutariServer() {
mut = Mutex::create();
const uint64_t& FutariServer::revision() {
get();
return _instance->_revision;
}
FutariServer::FutariServer():
_revision(0)
{
mut = Mutex::create();
}
FutariServer::~FutariServer() {
......
......@@ -77,6 +77,8 @@ public:
static void unlock();
static std::vector< FutariModifierData* >& data();
static const uint64_t& revision();
protected:
......@@ -85,6 +87,8 @@ protected:
virtual ~FutariServer( );
Mutex *mut;
uint64_t _revision;
std::vector< FutariModifierData* > modifier_data;
......
......@@ -135,6 +135,7 @@ void FutariVortex::refresh() {
s *= 0;
}
FutariVortex::_data.changed_layer = FutariVortex::_data.futari_layers != futari_layers;
FutariVortex::_data.changed_enabled = FutariVortex::_data.enabled != enabled;
FutariVortex::_data.changed_position = FutariVortex::_data.position != p;
FutariVortex::_data.changed_orientation = FutariVortex::_data.orientation != o;
......@@ -161,6 +162,7 @@ void FutariVortex::refresh() {
FutariVortex::_data.height_tex.is_valid() != height_texture.is_valid();
FutariVortex::_data.changed =
FutariVortex::_data.changed_layer ||
FutariVortex::_data.changed_enabled ||
FutariVortex::_data.changed_position ||
FutariVortex::_data.changed_orientation ||
......@@ -177,6 +179,7 @@ void FutariVortex::refresh() {
if (FutariVortex::_data.changed) {
FutariVortex::_data.futari_layers = futari_layers;
FutariVortex::_data.enabled = enabled;
FutariVortex::_data.position = p;
FutariVortex::_data.orientation = o;
......
......@@ -87,6 +87,7 @@ void FutariWind::refresh() {
s *= 0;
}
FutariWind::_data.changed_layer = FutariWind::_data.futari_layers != futari_layers;
FutariWind::_data.changed_enabled = FutariWind::_data.enabled != enabled;
FutariWind::_data.changed_position = FutariWind::_data.position != p;
FutariWind::_data.changed_orientation = FutariWind::_data.orientation != o;
......@@ -102,6 +103,7 @@ void FutariWind::refresh() {
FutariWind::_data.changed_position_mult = FutariWind::_data.position_mult != position_mult;
FutariWind::_data.changed =
FutariWind::_data.changed_layer ||
FutariWind::_data.changed_enabled ||
FutariWind::_data.changed_position ||
FutariWind::_data.changed_orientation ||
......@@ -113,6 +115,7 @@ void FutariWind::refresh() {
FutariWind::_data.changed_position_mult;
if (FutariWind::_data.changed) {
FutariWind::_data.futari_layers = futari_layers;
FutariWind::_data.enabled = enabled;
FutariWind::_data.position = p;
FutariWind::_data.orientation = o;
......