Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch/no model tick #473

Open
wants to merge 21 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
aac8b56
Handle reflector actions as they arrive, without waiting for a tick.
davideaster Jan 29, 2015
41229c1
Don't record ticks in the queue. Don't tick nodes and model drivers.
davideaster Jan 29, 2015
e5898aa
first merge test
rchadwic Feb 9, 2015
ed2b3c1
change this to self
rchadwic Feb 9, 2015
a1b5e5d
fix some minor bugs
rchadwic Feb 9, 2015
65d401b
remove twice defined matset
rchadwic Feb 9, 2015
57b03ec
Adds the animatedNodes to the shared state info
scottnc27603 Feb 11, 2015
563d7b8
Removes old depreciated properties
scottnc27603 Feb 11, 2015
3c0f3cb
Corrects the events tag
scottnc27603 Feb 11, 2015
b07308c
Adds the animated nodes to the shared state
scottnc27603 Feb 11, 2015
bf0b2ee
Removes the debugging info for loading assets
scottnc27603 Feb 11, 2015
b0ee31b
Removes some commented out code
scottnc27603 Feb 11, 2015
c159037
Removes the commented out node storing
scottnc27603 Feb 12, 2015
cd1ab09
Removes a node from the animated list if the duration is undefined or 0
scottnc27603 Feb 17, 2015
3b683c0
Removes code that was obsolete dealing with the navObject
scottnc27603 Feb 17, 2015
4e0c26c
Creates a jiggle view driver to implement ticked
scottnc27603 Feb 19, 2015
06b34ee
Turns off debugging of property setting
scottnc27603 Feb 19, 2015
874f5b6
Corrects calling the physics update from the model
scottnc27603 Feb 19, 2015
58b7769
Removes ticking from the threes model
scottnc27603 Feb 19, 2015
a16b240
Removes ticking and moves the block exe to update
scottnc27603 Feb 19, 2015
aadaea2
Removes ticking from the code
scottnc27603 Feb 19, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
93 changes: 33 additions & 60 deletions support/client/lib/vwf.js
Expand Up @@ -194,18 +194,6 @@

this.moniker_ = undefined;

/// Nodes that are receiving ticks.
///
/// @name module:vwf.tickable
///
/// @private

this.tickable = {
// models: [],
// views: [],
nodeIDs: [],
};

// == Private variables ====================================================================

/// @name module:vwf.private
Expand Down Expand Up @@ -405,6 +393,7 @@
{ library: "vwf/view/cesium", active: false },
{ library: "vwf/view/kineticjs", active: false },
{ library: "vwf/view/mil-sym", active: false },
{ library: "vwf/view/jiglib", active: false },
{ library: "vwf/view/audio", active: false },
{ library: "vwf/kernel/utility", active: true },
{ library: "vwf/utility", active: true },
Expand Down Expand Up @@ -461,6 +450,7 @@
{ library: "vwf/view/kineticjs", active: false },
{ library: "vwf/view/mil-sym", active: false },
{ library: "vwf/view/audio", active: false },
{ library: "vwf/view/jiglib", active: false },
{ library: "vwf/view/webrtc", active: false}
]
};
Expand Down Expand Up @@ -948,10 +938,11 @@

fields.origin = "reflector";

// Update the queue. Messages in the queue are ordered by time, then by order of arrival.
// Time is only advanced if the message has no action, meaning it is a tick.
// Update the queue. Insert the message (unless it is only a time tick), and
// advance the queue's record of the current time. Messages in the queue are
// ordered by time, then by order of arrival.

queue.insert( fields, !fields.action ); // may invoke dispatch(), so call last before returning to the host
queue.insert( fields, true ); // may invoke dispatch(), so call last before returning to the host

// Each message from the server allows us to move time forward. Parse the
// timestamp from the message and call dispatch() to execute all queued
Expand Down Expand Up @@ -1224,34 +1215,20 @@

// Advance time to the message time.

if ( this.now != fields.time ) {
this.sequence_ = undefined; // clear after the previous action
this.client_ = undefined; // clear after the previous action
if ( this.now !== fields.time ) {
this.now = fields.time;
this.tock();
}

// Perform the action.
// Set the per-action kernel globals.

if ( fields.action ) { // TODO: don't put ticks on the queue but just use them to fast-forward to the current time (requires removing support for passing ticks to the drivers and nodes)
this.sequence_ = fields.sequence; // note the message's queue sequence number for the duration of the action
this.client_ = fields.client; // ... and note the originating client
this.receive( fields.node, fields.action, fields.member, fields.parameters, fields.respond, fields.origin );
}
else {
this.tick();
}
this.sequence_ = fields.sequence; // note the message's queue sequence number for the duration of the action
this.client_ = fields.client; // ... and note the originating client

}
// Perform the action.

// Advance time to the most recent time received from the server. Tick if the time
// changed.
this.receive( fields.node, fields.action, fields.member, fields.parameters, fields.respond, fields.origin );

if ( queue.ready() && this.now != queue.time ) {
this.sequence_ = undefined; // clear after the previous action
this.client_ = undefined; // clear after the previous action
this.now = queue.time;
this.tock();
}

};
Expand Down Expand Up @@ -1279,24 +1256,12 @@

this.tick = function() {

// Call ticking() on each model.

this.models.forEach( function( model ) {
model.ticking && model.ticking( this.now ); // TODO: maintain a list of tickable models and only call those
}, this );

// Call ticked() on each view.

this.views.forEach( function( view ) {
view.ticked && view.ticked( this.now ); // TODO: maintain a list of tickable views and only call those
}, this );

// Call tick() on each tickable node.

this.tickable.nodeIDs.forEach( function( nodeID ) {
this.callMethod( nodeID, "tick", [ this.now ] );
}, this );

};

// -- tock ---------------------------------------------------------------------------------
Expand Down Expand Up @@ -2708,13 +2673,8 @@ if ( ! childComponent.source ) {
vwf.setProperty( childID, propertyName, deferredInitializations[propertyName] );
} );

// TODO: Adding the node to the tickable list here if it contains a tick() function in JavaScript at initialization time. Replace with better control of ticks on/off and the interval by the node.

if ( vwf.execute( childID, "Boolean( this.tick )" ) ) {
vwf.tickable.nodeIDs.push( childID );
}

// Restore kernel reentry.

replicating && vwf.models.kernel.enable();

}, function() {
Expand Down Expand Up @@ -5400,16 +5360,16 @@ if ( ! childComponent.source ) {
// reinserted.

return object.filter( function( fields ) {
return ! ( fields.origin === "reflector" && fields.sequence > vwf.sequence_ ) && fields.action; // TODO: fields.action is here to filter out tick messages // TODO: don't put ticks on the queue but just use them to fast-forward to the current time (requires removing support for passing ticks to the drivers and nodes)
return ! ( fields.origin === "reflector" && fields.sequence > vwf.sequence_ );
} ).sort( function( fieldsA, fieldsB ) {
return fieldsA.sequence - fieldsB.sequence;
} );

} else if ( depth == 1 ) {

// Remove the sequence fields since they're just local annotations used to keep
// messages ordered by insertion order and aren't directly meaniful outside of this
// client.
// messages ordered by insertion order. They aren't directly meaningful outside of
// this client.

var filtered = {};

Expand Down Expand Up @@ -6832,12 +6792,10 @@ if ( ! childComponent.source ) {

messages.forEach( function( fields ) {

// if ( fields.action ) { // TODO: don't put ticks on the queue but just use them to fast-forward to the current time (requires removing support for passing ticks to the drivers and nodes)

if ( fields.action ) {
fields.sequence = ++this.sequence; // track the insertion order for use as a sort key
this.queue.push( fields );

// }
}

if ( chronic ) {
this.time = Math.max( this.time, fields.time ); // save the latest allowed time for suspend/resume
Expand Down Expand Up @@ -6868,6 +6826,21 @@ if ( ! childComponent.source ) {

} );

// Tick the views on each idle message.

if ( chronic && ! fields.action ) {

// Clear the per-action kernel globals. `tick` isn't an action.

vwf.sequence_ = undefined;
vwf.client_ = undefined;

// Tick the views.

vwf.tick();

}

// Execute the simulation through the new time.

// To prevent actions from executing out of order, callers should immediately return
Expand Down