Exemplo n.º 1
0
        protected virtual void CloneCore(SceneNode source)
        {
            _flags = source._flags;
              Name = source.Name;
              ScaleLocal = source.ScaleLocal;
              PoseLocal = source.PoseLocal;
              LastScaleWorld = source.LastScaleWorld;
              LastPoseWorld = source.LastPoseWorld;
              Shape = source.Shape;     // Shallow copy.
              MaxDistance = source.MaxDistance;
              SortTag = source.SortTag;
              UserData = source.UserData;
              // Do not clone: RenderData, SceneData

              if (source.Children != null)
              {
            if (Children == null)
              Children = new SceneNodeCollection();
            else
              Children.Clear();

            foreach (var child in source.Children)
              Children.Add(child.Clone());
              }
        }
Exemplo n.º 2
0
        public SceneNode(string name, Vector2 position, float rotation, Vector2 scale)
        {
            Name = name;
            Position = position;
            Rotation = rotation;
            Scale = scale;

            Children = new SceneNodeCollection(this);
            Entities = new SceneEntityCollection();
        }
        private void AddAnySceneNode(SceneNodeCollection nodeCollection, Vector2 pos)
        {
            if (nodeCollection.SceneNodes.Find((x) => x.SceneId < 0) != null)
            {
                return;
            }

            SceneNode node = nodeCollection.AddSceneNode(
                SceneManagerController.ANY_SCENE_ID, pos);

            NodeEditor.NodeEditor.AddNode(node);
        }
Exemplo n.º 4
0
        private void PopulateConnections(GUIGenericMenu contextMenu)
        {
            SceneNodeCollection nodes = SerializedManager.SceneNodes;

            List <TransitionConnector> madeTransitions = new List <TransitionConnector>();

            foreach (SceneNode node in nodes.SceneNodes)
            {
                foreach (SceneTransition transition in node.SceneInfo.Transitions)
                {
                    TransitionConnector existingOut = madeTransitions.Find((x) =>
                    {
                        return(((SceneNode)x.GetStartNode()).SceneId == node.SceneId &&
                               ((SceneNode)x.GetEndNode()).SceneId == transition.DestinationSceneId);
                    });

                    if (existingOut != null)
                    {
                        existingOut.ConnectionCount++;
                        continue;
                    }

                    TransitionConnector existingIn = madeTransitions.Find((x) =>
                    {
                        return(((SceneNode)x.GetStartNode()).SceneId == transition.DestinationSceneId &&
                               ((SceneNode)x.GetEndNode()).SceneId == node.SceneId);
                    });

                    TransitionConnector newConnection = new TransitionConnector();

                    newConnection.ContextMenu = contextMenu;
                    newConnection.AddNode(node);

                    if (node.SceneId == transition.DestinationSceneId)
                    {
                        AddSelfTransitionNodes(newConnection, node);
                    }

                    newConnection.AddNode(nodes.SceneNodes.Find((x) =>
                                                                x.SceneId == transition.DestinationSceneId));

                    if (existingIn != null)
                    {
                        newConnection.ShiftOver = true;
                        existingIn.ShiftOver    = true;
                    }

                    NodeEditor.AddConnector(newConnection);
                    madeTransitions.Add(newConnection);
                }
            }
        }
        internal void SetEntryScene(int id)
        {
            if (id < 0)
            {
                return;
            }

            if (TargetManager.GetSceneById(id) == null)
            {
                return;
            }

            EntrySceneIdProp.intValue = id;
            EntrySceneIdProp.serializedObject.ApplyModifiedProperties();

            SceneNodeCollection nodes = SceneNodesObject.targetObject as SceneNodeCollection;

            nodes.SetEntrySceneNode(id);
        }
        private SceneNode AddNewScene(string scenePath,
                                      SceneNodeCollection collection, Vector2 pos)
        {
            SceneModel existing = sceneManager.GetSceneByPath(scenePath);

            if (existing == null)
            {
                int id = sceneManager.AddScene(scenePath);
                existing = sceneManager.GetSceneById(id);
            }

            SceneNode existingNode = collection.GetNodeBySceneId(existing.SceneId);

            if (existingNode == null)
            {
                existingNode = collection.AddSceneNode(existing.SceneId, pos);
            }

            NodeEditor.NodeEditor.AddNode(existingNode);

            return(existingNode);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Fills the node editor with nodes that represent the scene data
        /// </summary>
        /// <param name="nodeContextMenu">The context menu to be given to each node</param>
        private void PopulateNodes(GUIGenericMenu nodeContextMenu)
        {
            SceneNodeCollection nodes = SerializedManager.SceneNodes;

            foreach (SceneNode node in nodes.SceneNodes)
            {
                node.ContextMenu = nodeContextMenu;

                node.IsEntryScene = SerializedManager.IsEntryScene(node.SceneId);

                if (node.SceneId == SceneManagerController.ANY_SCENE_ID)
                {
                    node.SceneInfo = SerializedManager.TargetManager.AnyScene;
                }
                else
                {
                    node.SceneInfo = SerializedManager.TargetManager.GetSceneById(node.SceneId);
                }

                NodeEditor.AddNode(node);
            }
        }
        private void SceneHunterEditor_OnSceneImport(object sender, EventArgs <IEnumerable <string> > e)
        {
            Undo.SetCurrentGroupName("Scene Import");
            int importGroup = Undo.GetCurrentGroup();

            Undo.RecordObject(sceneManager, "Before Scene Import");

            NodeEditor.NodeEditor.ClearAll();

            SceneNodeCollection nodeCollection = SerializedSceneManager.
                                                 SceneNodesObject.targetObject as SceneNodeCollection;

            // Remove scene models that aren't part of the listing
            sceneManager.scenes.RemoveAll((x) => !e.Value.Contains(x.SceneAssetPath));

            nodeCollection.SceneNodes.RemoveAll((x) =>
                                                x.SceneInfo == null ||
                                                (!e.Value.Contains(x.SceneInfo.SceneAssetPath) && x.SceneId >= 0));

            Vector2 position = new Vector2(20f, 100f);

            AddAnySceneNode(nodeCollection, position);

            position = new Vector2(300f, 0f);

            foreach (string scenePath in e.Value)
            {
                AddNewScene(scenePath, nodeCollection, position);
                position.y += SceneManagerResources.SceneNodeOpenStyle.fixedHeight;
            }

            SerializedSceneManager.SceneNodesObject.Update();
            SerializedSceneManager.SerializedManager.Update();

            Undo.CollapseUndoOperations(importGroup);

            isInitialized = false;
        }
Exemplo n.º 9
0
        public SceneManager( string name )
			: base()
		{
			this.cameraList = new CameraCollection();
			this.sceneNodeList = new SceneNodeCollection();
			this.animationList = new AnimationCollection();
			this.animationStateList = new AnimationStateSet();
			this.regionList = new List<StaticGeometry.Region>();

			this.shadowCasterQueryListener = new ShadowCasterSceneQueryListener( this );

			// create the root scene node
			this.rootSceneNode = new SceneNode( this, "Root" );
			this.rootSceneNode.SetAsRootNode();
			this.defaultRootNode = this.rootSceneNode;

			this.name = name;

			// default to no fog
			this.fogMode = FogMode.None;

			// no shadows by default
			this.shadowTechnique = ShadowTechnique.None;

			// setup default shadow camera setup
			this._defaultShadowCameraSetup = new DefaultShadowCameraSetup();

			this.illuminationStage = IlluminationRenderStage.None;
			this.renderingNoShadowQueue = false;
			this.renderingMainGroup = false;
			this.shadowColor.a = this.shadowColor.r = this.shadowColor.g = this.shadowColor.b = 0.25f;
			this.shadowDirLightExtrudeDist = 10000;
			this.shadowIndexBufferSize = 51200;
			this.shadowTextureOffset = 0.6f;
			this.shadowTextureFadeStart = 0.7f;
			this.shadowTextureFadeEnd = 0.9f;
			this.shadowTextureSize = 512;
			this.shadowTextureCount = 1;
			this.findVisibleObjects = true;
			this.suppressRenderStateChanges = false;
			this.suppressShadows = false;
			this.shadowUseInfiniteFarPlane = true;
		}
Exemplo n.º 10
0
		public void FindNodes( Sphere sphere, SceneNodeCollection sceneNodeList, SceneNode exclude, bool full, Octree octant )
		{
			//TODO: Implement
		}
Exemplo n.º 11
0
		public void FindNodes( AxisAlignedBox box, SceneNodeCollection sceneNodeList, SceneNode exclude, bool full, Octree octant )
		{
			List<OctreeNode> localList = new List<OctreeNode>();
			if ( octant == null )
			{
				octant = this.octree;
			}

			if ( !full )
			{
				AxisAlignedBox obox = octant.CullBounds;

				Intersection isect = this.Intersect( box, obox );

				if ( isect == Intersection.Outside )
				{
					return;
				}

				full = ( isect == Intersection.Inside );
			}

			foreach ( OctreeNode node in octant.NodeList.Values )
			{
				if ( node != exclude )
				{
					if ( full )
					{
						localList.Add( node );
					}
					else
					{
						Intersection nsect = this.Intersect( box, node.WorldAABB );

						if ( nsect != Intersection.Outside )
						{
							localList.Add( node );
						}
					}
				}
			}

			if ( octant.Children[ 0, 0, 0 ] != null )
				FindNodes( box, sceneNodeList, exclude, full, octant.Children[ 0, 0, 0 ] );

			if ( octant.Children[ 1, 0, 0 ] != null )
				FindNodes( box, sceneNodeList, exclude, full, octant.Children[ 1, 0, 0 ] );

			if ( octant.Children[ 0, 1, 0 ] != null )
				FindNodes( box, sceneNodeList, exclude, full, octant.Children[ 0, 1, 0 ] );

			if ( octant.Children[ 1, 1, 0 ] != null )
				FindNodes( box, sceneNodeList, exclude, full, octant.Children[ 1, 1, 0 ] );

			if ( octant.Children[ 0, 0, 1 ] != null )
				FindNodes( box, sceneNodeList, exclude, full, octant.Children[ 0, 0, 1 ] );

			if ( octant.Children[ 1, 0, 1 ] != null )
				FindNodes( box, sceneNodeList, exclude, full, octant.Children[ 1, 0, 1 ] );

			if ( octant.Children[ 0, 1, 1 ] != null )
				FindNodes( box, sceneNodeList, exclude, full, octant.Children[ 0, 1, 1 ] );

			if ( octant.Children[ 1, 1, 1 ] != null )
				FindNodes( box, sceneNodeList, exclude, full, octant.Children[ 1, 1, 1 ] );

		}
Exemplo n.º 12
0
 public void FindNodes(Sphere sphere, SceneNodeCollection sceneNodeList, SceneNode exclude, bool full, Octree octant)
 {
     //TODO: Implement
 }
Exemplo n.º 13
0
        public void FindNodes(AxisAlignedBox box, SceneNodeCollection sceneNodeList, SceneNode exclude, bool full,
                              Octree octant)
        {
            var localList = new List <OctreeNode>();

            if (octant == null)
            {
                octant = this.octree;
            }

            if (!full)
            {
                AxisAlignedBox obox = octant.CullBounds;

                Intersection isect = Intersect(box, obox);

                if (isect == Intersection.Outside)
                {
                    return;
                }

                full = (isect == Intersection.Inside);
            }

            foreach (OctreeNode node in octant.NodeList.Values)
            {
                if (node != exclude)
                {
                    if (full)
                    {
                        localList.Add(node);
                    }
                    else
                    {
                        Intersection nsect = Intersect(box, node.WorldAABB);

                        if (nsect != Intersection.Outside)
                        {
                            localList.Add(node);
                        }
                    }
                }
            }

            if (octant.Children[0, 0, 0] != null)
            {
                FindNodes(box, sceneNodeList, exclude, full, octant.Children[0, 0, 0]);
            }

            if (octant.Children[1, 0, 0] != null)
            {
                FindNodes(box, sceneNodeList, exclude, full, octant.Children[1, 0, 0]);
            }

            if (octant.Children[0, 1, 0] != null)
            {
                FindNodes(box, sceneNodeList, exclude, full, octant.Children[0, 1, 0]);
            }

            if (octant.Children[1, 1, 0] != null)
            {
                FindNodes(box, sceneNodeList, exclude, full, octant.Children[1, 1, 0]);
            }

            if (octant.Children[0, 0, 1] != null)
            {
                FindNodes(box, sceneNodeList, exclude, full, octant.Children[0, 0, 1]);
            }

            if (octant.Children[1, 0, 1] != null)
            {
                FindNodes(box, sceneNodeList, exclude, full, octant.Children[1, 0, 1]);
            }

            if (octant.Children[0, 1, 1] != null)
            {
                FindNodes(box, sceneNodeList, exclude, full, octant.Children[0, 1, 1]);
            }

            if (octant.Children[1, 1, 1] != null)
            {
                FindNodes(box, sceneNodeList, exclude, full, octant.Children[1, 1, 1]);
            }
        }
        internal void SetActiveScene()
        {
            SceneNodeCollection nodes = SceneNodesObject.targetObject as SceneNodeCollection;

            nodes.UpdateActiveSceneNode();
        }