Beispiel #1
0
        //internal void addSoftBody(SoftBodyDefinition definition, SimObjectBase instance);

        //internal void addSoftBodyProviderDefinition(SoftBodyProviderDefinition definition, SimObjectBase instance, SimSubScene subScene);

        //internal void addSoftBodyAnchorOrJointDefinition(BulletElementDefinition definition, SimObjectBase instance);

        public IEnumerable <SceneBuildStatus> createProducts(SceneBuildOptions options)
        {
            SceneBuildStatus status = new SceneBuildStatus()
            {
                Subsystem = BulletInterface.Instance.Name
            };

            yield return(status);

            foreach (BulletFactoryEntry entry in rigidBodies)
            {
                entry.createProduct(scene);
            }
            //foreach(SoftBodyProviderEntry entry in softBodyProviders)
            //{
            //    entry.createProduct(scene);
            //}
            //foreach(BulletFactoryEntry entry in softBodies)
            //{
            //    entry.createProduct(scene);
            //}
            foreach (BulletFactoryEntry entry in typedConstraints)
            {
                entry.createProduct(scene);
            }
            //foreach(BulletFactoryEntry entry in softBodyAnchors)
            //{
            //    entry.createProduct(scene);
            //}
        }
        /// <summary>
        /// Load the scene in the given ScenePackage.
        /// </summary>
        /// <param name="scenePackage">The ScenePackage to load.</param>
        public IEnumerable <SceneBuildStatus> loadScene(ScenePackage scenePackage, SceneBuildOptions options)
        {
            currentScenePackage = scenePackage;
            yield return(new SceneBuildStatus()
            {
                Message = "Setting up Resources"
            });

            sceneResourceManager.changeResourcesToMatch(scenePackage.ResourceManager);
            sceneResourceManager.initializeResources();

            currentScene = scenePackage.SceneDefinition.createScene();
            if (OnSceneLoading != null)
            {
                OnSceneLoading.Invoke(this, currentScene);
            }
            currentSimObjects = scenePackage.SimObjectManagerDefinition.createSimObjectManager(currentScene.getDefaultSubScene());
            foreach (var status in currentScene.buildSceneStatus(options))
            {
                yield return(status);
            }
            if (OnSceneLoaded != null)
            {
                OnSceneLoaded.Invoke(this, currentScene);
            }
        }
        public IEnumerable <SceneBuildStatus> createProducts(SceneBuildOptions options)
        {
            SceneBuildStatus status = new SceneBuildStatus()
            {
                Subsystem = "Simulation"
            };

            yield return(status);
        }
Beispiel #4
0
 /// <summary>
 /// Create and add a SimObject to this manager. This is used to create
 /// objects after the build process has run during scene execution.
 /// </summary>
 /// <param name="definition">The definition of the object to create.</param>
 public SimObjectBase createLiveSimObject(SimObjectDefinition definition, SceneBuildOptions options = SceneBuildOptions.None)
 {
     if (!simObjects.ContainsKey(definition.Name))
     {
         SimObjectBase simObj = definition.register(subScene);
         addSimObject(simObj);
         subScene.buildScene(options);
         return(simObj);
     }
     else
     {
         throw new SimObjectException(String.Format("Attempted to create a SimObject {0} that already exists in sub scene {1}.", definition.Name, subScene.Name));
     }
 }
        /// <summary>
        /// Create all products for normal operation currently registered for
        /// construction in this factory.
        /// </summary>
        public IEnumerable <SceneBuildStatus> createProducts(SceneBuildOptions options)
        {
            SceneBuildStatus status = new SceneBuildStatus()
            {
                Subsystem = BehaviorPluginInterface.Instance.Name
            };

            yield return(status);

            bool copyBehavior = (options & SceneBuildOptions.SingleUseDefinitions) == 0;

            foreach (BehaviorFactoryEntry entry in currentBehaviors)
            {
                entry.createProduct(manager, copyBehavior);
            }
        }
Beispiel #6
0
        /// <summary>
        /// Build all products currently registered.
        /// </summary>
        public IEnumerable <SceneBuildStatus> createProducts(SceneBuildOptions options)
        {
            SceneBuildStatus status = new SceneBuildStatus()
            {
                Subsystem = OgreInterface.Instance.Name,
                NumItems  = sceneNodes.Count
            };

            yield return(status);

            foreach (OgreFactoryEntry entry in sceneNodes)
            {
                entry.createProduct(targetScene);
                status.CurrentItem++;
                yield return(status);
            }
        }
Beispiel #7
0
 /// <summary>
 /// Build all objects in the scene getting an enumeration over the status
 /// along the way. You must walk the enumerator to fully load the scene.
 /// </summary>
 /// <returns>SceneBuildStatus objects with the status of the scene load.</returns>
 public IEnumerable <SceneBuildStatus> buildSceneStatus(SceneBuildOptions options = SceneBuildOptions.None)
 {
     foreach (SimElementManager manager in simElementManagers)
     {
         foreach (var createStatus in manager.getFactory().createProducts(options))
         {
             yield return(createStatus);
         }
     }
     foreach (SimElementManager manager in simElementManagers)
     {
         manager.getFactory().linkProducts();
     }
     foreach (SimElementManager manager in simElementManagers)
     {
         manager.getFactory().clearDefinitions();
     }
 }
        public IEnumerable <SceneBuildStatus> createProducts(SceneBuildOptions options)
        {
            SceneBuildStatus status = new SceneBuildStatus()
            {
                Subsystem = BEPUikInterface.Instance.Name
            };

            yield return(status);

            foreach (var entry in independentPhaseEntries)
            {
                entry.createProduct(scene);
            }

            foreach (var entry in dependentPhaseEntries)
            {
                entry.createProduct(scene);
            }
        }
        /// <summary>
        /// Load the scene in the given ScenePackage.
        /// </summary>
        /// <param name="scenePackage">The ScenePackage to load.</param>
        public IEnumerable <SceneBuildStatus> loadSceneCo(ScenePackage scenePackage, SceneBuildOptions options = SceneBuildOptions.SingleUseDefinitions)
        {
            this.scenePackage = scenePackage;
            yield return(new SceneBuildStatus()
            {
                Message = "Setting up Resources"
            });

            sceneResourceManager.changeResourcesToMatch(scenePackage.ResourceManager);
            sceneResourceManager.initializeResources();

            scene       = scenePackage.SceneDefinition.createScene();
            scene.Scope = pluginManager.GlobalScope.ServiceProvider.CreateScope();
            if (OnSceneLoading != null)
            {
                OnSceneLoading.Invoke(this, scene);
            }
            currentSimObjects = scenePackage.SimObjectManagerDefinition.createSimObjectManager(scene.getDefaultSubScene());
            if (dynamicMode)
            {
                foreach (var status in scene.buildSceneStatus(options))
                {
                    yield return(status);
                }
            }
            else
            {
                scene.buildStaticScene();
            }
            if (OnSceneLoaded != null)
            {
                OnSceneLoaded.Invoke(this, scene);
            }
            foreach (DebugInterface debugInterface in pluginManager.DebugInterfaces)
            {
                debugInterface.createDebugInterface(pluginManager.RendererPlugin, scene.getDefaultSubScene());
            }
        }
Beispiel #10
0
 /// <summary>
 /// Force the parent scene to run its build routines again. This will
 /// create any sim objects that are pending since the last build.
 /// </summary>
 public void buildScene(SceneBuildOptions options)
 {
     scene.buildScene(options);
 }
Beispiel #11
0
 /// <summary>
 /// Build all objects registered with the scene.
 /// </summary>
 public void buildScene(SceneBuildOptions options = SceneBuildOptions.None)
 {
     foreach (var status in buildSceneStatus(options))
     {
     }
 }
 public void loadScene(ScenePackage scenePackage, SceneBuildOptions options = SceneBuildOptions.SingleUseDefinitions)
 {
     foreach (var step in loadSceneCo(scenePackage, options))
     {
     }
 }