Example #1
0
        public void DisplaySceneInTree()
        {
            if (sceneTreeView.InvokeRequired)
            {
                //If an invoke is required because we are running on a different thread
                //we make an instance of the delegate here, once Invoke is called this method
                //will be called again, this time in the context of the called thread
                //when that occurs, InvokeRequired will then have a value of 'false'
                //and we can then update the scenetree with the latest scene information
                var d = new ThreadSafeDisplaySceneElements(DisplaySceneInTree);
                sceneTreeView.Invoke(d, Array.Empty <object>());
            }
            else
            {
                //grab the scene
                _application = (PulsarApplication)_renderScene.DrawingSurface.Application;

                if (_application != null)
                {
                    _scene = _application.DisplayScene;
                    _sceneTree.CurrentScene = _scene;
                    _sceneTree.DisplaySceneElements();
                }
            }
        }
Example #2
0
 public Gizmo(string name, PulsarScene scene, Node gizmoNode, BaseEntity baseEntity)
 {
     _name      = name;
     _scene     = scene;
     _gizmoNode = gizmoNode;
     BaseEntity = baseEntity;
 }
Example #3
0
        private void Pulsar_Shown(object sender, EventArgs e)
        {
            PulsarApplication pulsarApplication = (PulsarApplication)_formRenderScene.DrawingSurface.Application;

            if (pulsarApplication != null)
            {
                _formSceneTree.MainApplication = pulsarApplication;
                _scene = pulsarApplication.DisplayScene;

                _pulsarExtendedProperties.MainApplication = pulsarApplication;
                _pulsarExtendedProperties.Scene           = _scene;

                pulsarApplication.ApplicationForms.Add(_formRenderScene);
                pulsarApplication.ApplicationForms.Add(_formSceneTree);
                pulsarApplication.ApplicationForms.Add(_pulsarExtendedProperties);
                pulsarApplication.ApplicationForms.Add(_pulsarAssets);
            }

            DisplaySceneInTree();

            Resize += Main_Resize;

            //registration for messages
            Registrant registrant = new Registrant
            {
                Subscriber = this,
                Type       = PulsarMessage.MessageType.ClearSelectedObjects
            };
        }
Example #4
0
        public BoxEntity(string name, PulsarScene scene, DebugRenderer debugRenderer, bool inDesign)
        {
            _name  = name;
            _scene = scene;

            if (_scene != null)
            {
                _node = _scene.CreateChild(_name);
                if (_node != null)
                {
                    _baseEntity             = _node.CreateComponent <BaseEntity>();
                    _baseEntity.Name        = name;
                    _baseEntity.Node        = _node;
                    _baseEntity.PulsarScene = scene;
                    _baseEntity.SetDebugRenderer(debugRenderer);
                    InDesign             = inDesign;
                    _baseEntity.InDesign = inDesign;
                    base.BaseEntity      = _baseEntity;
                    CreateEntity();
                }
            }
            PulsarComponentClass = ComponentClass.Node;
            PulsarComponentType  = ComponentType.NodeProperties;

            RegisterForMessages();
        }
Example #5
0
 public PyramidEntity(PulsarScene scene, PulsarApplication application, DebugRenderer debugRenderer)
 {
     _scene         = scene;
     _application   = application;
     _debugRenderer = debugRenderer;
     CreateEntity();
 }
Example #6
0
        public static void SetAsSelected(Node node, Gizmo gizmo, PulsarScene scene)
        {
            StaticModel nodeModel = node.GetComponent <StaticModel>();

            if (nodeModel != null && scene != null)
            {
                PulsarApplication pulsarApplication = scene.GetApplication();
                if (pulsarApplication != null)
                {
                    MaterialTemp tempMaterial = new MaterialTemp(nodeModel, pulsarApplication);
                    if (tempMaterial != null)
                    {
                        tempMaterial.Name = "materialTemp";

                        try
                        {
                            tempMaterial.SetTransparentMaterial();
                        }
                        catch (PulsarGizmoException gizmoException)
                        {
                            gizmoException.Source = "[GizmoHelper:SetAsSelected]";
                            throw gizmoException;
                        }

                        node.AddComponent(tempMaterial);
                        if (gizmo != null)
                        {
                            gizmo.Node.Position = node.Position;
                            gizmo.SetGizmoVisible(true);
                            gizmo.Node.Enabled = true;
                        }
                    }
                }
            }
        }
Example #7
0
        public BaseEntity(string name, PulsarScene scene, DebugRenderer debugRenderer, Vector3 position, Vector3 rotation, Vector3 scale)
        {
            _components          = new List <PulsarComponent>();
            _componentProperties = new List <PulsarComponent>();

            _name          = name;
            _scene         = scene;
            _debugRenderer = debugRenderer;

            if (scene != null)
            {
                _node = scene.CreateChild(_name);
                if (_node != null)
                {
                    _node.AddComponent(this);
                    _pulsarActions = new PulsarActions(_node);
                }
            }

            SetPosition(position);
            SetRotation(rotation);
            SetScale(scale);
            CreateEntity();
            ReceiveSceneUpdates = true;
        }
Example #8
0
        public BaseEntity(string name, PulsarScene scene)
        {
            _components          = new List <PulsarComponent>();
            _componentProperties = new List <PulsarComponent>();

            _name  = name;
            _scene = scene;

            if (scene != null)
            {
                _node = scene.CreateChild(_name);
                if (_node != null)
                {
                    _node.AddComponent(this);
                }
            }
        }
Example #9
0
        public BaseEntity(string name, PulsarScene scene)
        {
            _components          = new List <PulsarComponent>();
            _componentProperties = new List <PulsarComponent>();

            _name  = name;
            _scene = scene;

            if (scene != null)
            {
                _node = scene.CreateChild(_name);
                if (_node != null)
                {
                    _node.AddComponent(this);
                    _pulsarActions = new PulsarActions(_node);
                }
            }
            ReceiveSceneUpdates = true;
        }
Example #10
0
        public BaseEntity(string name, PulsarScene scene, DebugRenderer debugRenderer, Vector3 position)
        {
            _components          = new List <PulsarComponent>();
            _componentProperties = new List <PulsarComponent>();

            _name          = name;
            _scene         = scene;
            _debugRenderer = debugRenderer;

            if (scene != null)
            {
                _node = scene.CreateChild(_name);
                if (_node != null)
                {
                    _node.AddComponent(this);
                }
            }

            SetPosition(position);
            CreateEntity();
        }
Example #11
0
        public static void SetAsSelected(Node node, Gizmo gizmo, PulsarScene scene)
        {
            StaticModel nodeModel = node.GetComponent <StaticModel>();

            if (nodeModel != null)
            {
                MaterialTemp tempMaterial = new MaterialTemp(nodeModel, scene.GetApplication());
                if (tempMaterial != null)
                {
                    tempMaterial.Name = "materialTemp";
                    tempMaterial.SetTransparentMaterial();

                    node.AddComponent(tempMaterial);
                    if (gizmo != null)
                    {
                        gizmo.Node.Position = node.Position;
                        Debug.Print("GizmoHelper.SetAsSelected - Calling gizmo.SetGizmoVisible with value true for gizmo '" + gizmo.Name);
                        gizmo.SetGizmoVisible(true);
                        Debug.Print("GizmoHelper.SetAsSelected - Setting gizmo.Node.Enabled to true for gizmo '" + gizmo.Name);
                        gizmo.Node.Enabled = true;
                    }
                }
            }
        }
Example #12
0
 public PyramidEntity(PulsarScene scene)
 {
     _scene = scene;
     CreateEntity();
 }
Example #13
0
 public Gizmo(string name, PulsarScene scene, Node gizmoNode)
 {
     _name      = name;
     _scene     = scene;
     _gizmoNode = gizmoNode;
 }
Example #14
0
 public Gizmo(PulsarScene scene)
 {
     _scene = scene;
 }
Example #15
0
 public void SetScene(PulsarScene scene)
 {
     _scene = scene;
 }
Example #16
0
 public PyramidEntity(PulsarScene scene, PulsarApplication application)
 {
     _scene       = scene;
     _application = application;
     CreateEntity();
 }
Example #17
0
 public WirePlane(string name, PulsarScene pulsarScene)
 {
     _name  = name;
     _scene = pulsarScene;
 }
Example #18
0
 public TorusEntity(PulsarScene scene)
 {
     _scene = scene;
     CreateEntity();
 }