Пример #1
0
        private void CreateSceneLight()
        {
            SceneLight = new PulsarLight("MainDirectionalLight", this, SceneDebugRenderer)
            {
                PulsarComponentClass = PulsarComponent.ComponentClass.Node,
                PulsarComponentType  = PulsarComponent.ComponentType.Light,
                InDesign             = _inDesign
            };

            PulsarModel model = new PulsarModel(SceneLight.GetEntityName());

            SceneLight.BaseEntity.AddComponent(model);
            //baseEntity.AddComponent(model);
            model.SetModel("Models/Box.mdl");

            PulsarMaterial material = new PulsarMaterial(SceneLight.GetEntityName());

            SceneLight.BaseEntity.AddComponent(material);
            //baseEntity.AddComponent(material);
            material.SetMaterial("Materials/StoneTiled.xml");

            model.SetMaterial(material);
            SceneLight.CreateEntity();

            SceneLight.SetDirection(new Vector3(0.6f, -1.0f, 0.8f));
            SceneLight.SetPosition(new Vector3(0, 10, 0));

            SceneLight.Light.LightType   = LightType.Directional;
            SceneLight.Light.Brightness  = 1.1f;
            SceneLight.Light.CastShadows = true;

            SceneLight.SetExtendedProperties();
            SceneLight.BaseEntity.SetupProperties();
        }
Пример #2
0
        public void CreateBox()
        {
            _createdEntity = new BoxEntity("box" + _currentEntityIndex++.ToString(), this, SceneDebugRenderer, _inDesign)
            {
                Scale = new Vector3(5.0f, 5.0f, 5.0f),
                PulsarComponentClass = PulsarComponent.ComponentClass.Node,
                PulsarComponentType  = PulsarComponent.ComponentType.Box,
                InDesign             = _inDesign
            };

            _createdEntity.BaseEntity.Name = ((BoxEntity)_createdEntity).GetEntityName();
            _createdEntity.BaseEntity.SetPosition(new Vector3(0, 3, 0));
            _createdEntity.BaseEntity.SetRotation(new Vector3(0, 0, 0));
            _createdEntity.BaseEntity.SetScale(((BoxEntity)_createdEntity).Scale);

            _createdEntity.BaseEntity.AddComponent(_createdEntity);

            PulsarModel model = new PulsarModel(((BoxEntity)_createdEntity).GetEntityName())
            {
                PulsarComponentClass = PulsarComponent.ComponentClass.Node,
                PulsarComponentType  = PulsarComponent.ComponentType.Model
            };

            _createdEntity.BaseEntity.AddComponent(model);
            model.SetModel("Models/Box.mdl");

            PulsarMaterial material = new PulsarMaterial(((BoxEntity)_createdEntity).GetEntityName())
            {
                PulsarComponentClass = PulsarComponent.ComponentClass.Node,
                PulsarComponentType  = PulsarComponent.ComponentType.Material
            };

            _createdEntity.BaseEntity.AddComponent(material);
            material.SetMaterial("Materials/StoneTiled.xml");

            model.SetMaterial(material);
            ((BoxEntity)_createdEntity).CreateEntity();

            _createdEntity.BaseEntity.SetupProperties();

            //ensure the gizmo is not visible on first creation
            _createdEntity.BaseEntity.GetGizmo().SetGizmoVisible(false);

            Gizmo gizmo = _createdEntity.BaseEntity.GetGizmo();

            if (gizmo != null)
            {
                gizmo.GizmoEnabled = false;
            }
            //_createdEntity.BaseEntity.GetGizmo().Enabled = false;
        }
Пример #3
0
        public void CreateSphere()
        {
            _createdEntity = new SphereEntity("sphere" + _currentEntityIndex++.ToString(), this, SceneDebugRenderer, InDesign)
            {
                Scale = new Vector3(5.0f, 5.0f, 5.0f),
                PulsarComponentClass = PulsarComponent.ComponentClass.Node,
                PulsarComponentType  = PulsarComponent.ComponentType.Sphere,
                InDesign             = _inDesign,
                Diameter             = 5.0f
            };

            _createdEntity.BaseEntity.Name = ((SphereEntity)_createdEntity).GetEntityName();
            _createdEntity.BaseEntity.SetPosition(new Vector3(10, 3, 0));
            _createdEntity.BaseEntity.SetRotation(new Vector3(0, 0, 0));
            _createdEntity.BaseEntity.SetScale(((SphereEntity)_createdEntity).Scale);

            _createdEntity.BaseEntity.AddComponent(_createdEntity);

            PulsarModel model = new PulsarModel(((SphereEntity)_createdEntity).GetEntityName())
            {
                PulsarComponentClass = PulsarComponent.ComponentClass.Node,
                PulsarComponentType  = PulsarComponent.ComponentType.Model
            };

            _createdEntity.BaseEntity.AddComponent(model);
            model.SetModel("Models/Sphere.mdl");

            PulsarMaterial material = new PulsarMaterial(((SphereEntity)_createdEntity).GetEntityName())
            {
                PulsarComponentClass = PulsarComponent.ComponentClass.Node,
                PulsarComponentType  = PulsarComponent.ComponentType.Material
            };

            _createdEntity.BaseEntity.AddComponent(material);
            material.SetMaterial("Materials/StoneTiled.xml");

            model.SetMaterial(material);
            ((SphereEntity)_createdEntity).CreateEntity();

            _createdEntity.BaseEntity.SetupProperties();

            //ensure the gizmo is not visible on first creation
            _createdEntity.BaseEntity.GetGizmo().SetGizmoVisible(false);
        }
Пример #4
0
        public void CreateCone()
        {
            var entity = new ConeEntity("cone" + _currentEntityIndex++.ToString())
            {
                PulsarComponentClass = PulsarComponent.ComponentClass.Node,
                PulsarComponentType  = PulsarComponent.ComponentType.Cone,
                InDesign             = _inDesign,
                Diameter             = 5.0f,
                Height = 5.0f,
                Scale  = new Vector3(5, 5, 5)
            };

            BaseEntity baseEntity = new BaseEntity
                                    (
                entity.GetEntityName(),
                this,
                SceneDebugRenderer,
                new Vector3(10, 2.5f, 0),
                new Vector3(0, 0, 0),
                entity.Scale
                                    )
            {
                InDesign = _inDesign
            };

            baseEntity.AddComponent(entity);

            PulsarModel model = new PulsarModel(entity.GetEntityName());

            baseEntity.AddComponent(model);
            model.SetModel("Models/Cone.mdl");

            PulsarMaterial material = new PulsarMaterial(entity.GetEntityName());

            baseEntity.AddComponent(material);
            material.SetMaterial("Materials/StoneTiled.xml");

            model.SetMaterial(material);
            entity.CreateEntity();

            //ensure the gizmo is not visible on first creation
            baseEntity.GetGizmo().SetGizmoVisible(false);
        }
Пример #5
0
 public void SetMaterial(PulsarMaterial material)
 {
     if (material != null)
     {
         _model.SetMaterial(material.Material);
         if (_baseEntity != null)
         {
             Component existingComponent = _baseEntity.Components.ToList().Find(component => component.Equals(material));
             if (existingComponent == null)
             {
                 _baseEntity.AddComponent(material);
             }
             else
             {
                 //if in select mode, the Gizmo handles the temporary material which will need updating
                 GizmoHelper.UpdateTemporaryMaterialStore(_model.Node, material.Material);
             }
         }
     }
 }
Пример #6
0
        public void CreateCylinder()
        {
            var entity = new CylinderEntity("cylinder" + _currentEntityIndex++.ToString())
            {
                PulsarComponentClass = PulsarComponent.ComponentClass.Node,
                PulsarComponentType  = PulsarComponent.ComponentType.Cylinder,
                InDesign             = _inDesign,
                Diameter             = 5.0f,
                Height = 5.0f,
                Scale  = new Vector3(1, 1, 1)
            };

            BaseEntity baseEntity = new BaseEntity
                                    (
                entity.GetEntityName(),
                this,
                SceneDebugRenderer,
                new Vector3(-5, 2.5f, 0),
                new Vector3(0, 0, 0),
                entity.Scale
                                    )
            {
                InDesign = _inDesign
            };

            baseEntity.AddComponent(entity);

            PulsarModel model = new PulsarModel(entity.GetEntityName());

            baseEntity.AddComponent(model);
            model.SetModel("Models/Cylinder.mdl");

            PulsarMaterial material = new PulsarMaterial(entity.GetEntityName());

            baseEntity.AddComponent(material);
            material.SetMaterial("Materials/StoneTiled.xml");

            model.SetMaterial(material);
            entity.CreateEntity();
        }
Пример #7
0
        public void CreateBox()
        {
            _createdEntity = new BoxEntity("box" + _currentEntityIndex++.ToString(), this, SceneDebugRenderer, _inDesign)
            {
                Scale = new Vector3(1.0f, 1.0f, 1.0f),
                PulsarComponentClass = PulsarComponent.ComponentClass.Node,
                PulsarComponentType  = PulsarComponent.ComponentType.Box,
                InDesign             = _inDesign
            };

            _createdEntity.BaseEntity.Name = ((BoxEntity)_createdEntity).GetEntityName();
            _createdEntity.BaseEntity.SetPosition(new Vector3(0, 3, 0));
            _createdEntity.BaseEntity.SetRotation(new Vector3(0, 0, 0));
            _createdEntity.BaseEntity.SetScale(((BoxEntity)_createdEntity).Scale);

            _createdEntity.BaseEntity.AddComponent(_createdEntity);

            PulsarModel model = new PulsarModel(((BoxEntity)_createdEntity).GetEntityName())
            {
                PulsarComponentClass = PulsarComponent.ComponentClass.Node,
                PulsarComponentType  = PulsarComponent.ComponentType.Model
            };

            _createdEntity.BaseEntity.AddComponent(model);
            model.SetModel("Models/Box.mdl");

            PulsarMaterial material = new PulsarMaterial(((BoxEntity)_createdEntity).GetEntityName())
            {
                PulsarComponentClass = PulsarComponent.ComponentClass.Node,
                PulsarComponentType  = PulsarComponent.ComponentType.Material
            };

            _createdEntity.BaseEntity.AddComponent(material);
            material.SetMaterial("Materials/StoneTiled.xml");

            model.SetMaterial(material);
            ((BoxEntity)_createdEntity).CreateEntity();

            _createdEntity.BaseEntity.SetupProperties();
        }