osc.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. // Copyright 2012 United States Government, as represented by the Secretary of Defense, Under
  2. // Secretary of Defense (Personnel & Readiness).
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  5. // in compliance with the License. You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software distributed under the License
  10. // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  11. // or implied. See the License for the specific language governing permissions and limitations under
  12. // the License.
  13. define( [ "module", "vwf/model" ], function( module, model ) {
  14. // vwf/model/example/scene.js is a demonstration of a scene manager.
  15. return model.load( module, {
  16. // == Module Definition ====================================================================
  17. // -- pipeline -----------------------------------------------------------------------------
  18. // pipeline: [ log ], // vwf <=> log <=> scene
  19. // -- initialize ---------------------------------------------------------------------------
  20. initialize: function() {
  21. this.objects = {}; // maps id => { property: value, ... }
  22. self = this;
  23. this.osc = null;
  24. //window._OSCModel = this;
  25. },
  26. // == Model API ============================================================================
  27. // -- creatingNode -------------------------------------------------------------------------
  28. creatingNode: function( nodeID, childID, childExtendsID, childImplementsIDs,
  29. childSource, childType, childURI, childName, callback /* ( ready ) */ ) {
  30. },
  31. // -- deletingNode -------------------------------------------------------------------------
  32. deletingNode: function( nodeID ) {
  33. },
  34. // -- addingChild --------------------------------------------------------------------------
  35. addingChild: function( nodeID, childID, childName ) {
  36. },
  37. // -- removingChild ------------------------------------------------------------------------
  38. removingChild: function( nodeID, childID ) {
  39. },
  40. // -- parenting ----------------------------------------------------------------------------
  41. parenting: function( nodeID ) {
  42. },
  43. // -- childrening --------------------------------------------------------------------------
  44. childrening: function( nodeID ) {
  45. },
  46. // -- naming -------------------------------------------------------------------------------
  47. naming: function( nodeID ) {
  48. },
  49. // -- creatingProperty ---------------------------------------------------------------------
  50. creatingProperty: function( nodeID, propertyName, propertyValue ) {
  51. // var object = this.objects[nodeID] || ( this.objects[nodeID] = {} );
  52. // return object[propertyName] = propertyValue;
  53. },
  54. // -- initializingProperty -----------------------------------------------------------------
  55. initializingProperty: function( nodeID, propertyName, propertyValue ) {
  56. // var object = this.objects[nodeID] || ( this.objects[nodeID] = {} );
  57. // return object[propertyName] = propertyValue;
  58. },
  59. // TODO: deletingProperty
  60. // -- settingProperty ----------------------------------------------------------------------
  61. settingProperty: function( nodeID, propertyName, propertyValue ) {
  62. // var object = this.objects[nodeID] || ( this.objects[nodeID] = {} );
  63. // return object[propertyName] = propertyValue;
  64. },
  65. // -- gettingProperty ----------------------------------------------------------------------
  66. gettingProperty: function( nodeID, propertyName, propertyValue ) {
  67. // var object = this.objects[nodeID];
  68. // return object && object[propertyName];
  69. },
  70. // -- creatingMethod -----------------------------------------------------------------------
  71. creatingMethod: function( nodeID, methodName, methodParameters, methodBody ) {
  72. },
  73. // TODO: deletingMethod
  74. // -- callingMethod ------------------------------------------------------------------------
  75. callingMethod: function( nodeID, methodName, methodParameters ) {
  76. if (methodName == 'sendOSC') {
  77. if (this.osc == null) {
  78. this.osc = _OSCManager;
  79. }
  80. // var msg = {
  81. // address: "/hello/from/oscjs",
  82. // args: [Math.random()]
  83. // };
  84. this.osc.port.send(methodParameters);
  85. console.log('send: ' + methodParameters);
  86. }
  87. },
  88. // -- creatingEvent ------------------------------------------------------------------------
  89. creatingEvent: function( nodeID, eventName, eventParameters ) {
  90. },
  91. // TODO: deletingEvent
  92. // -- firingEvent --------------------------------------------------------------------------
  93. firingEvent: function( nodeID, eventName, eventParameters ) {
  94. },
  95. // -- executing ----------------------------------------------------------------------------
  96. executing: function( nodeID, scriptText, scriptType ) {
  97. }
  98. } );
  99. } );