Example #1
0
        void UpdateMeshEmitterEntity()
        {
            if (!HasEngineInstance())
            {
                return;
            }

            EngineInstanceEntity _inst = null;

            if (_emitterMeshEntity != null && _emitterMeshEntity.Shape != null)
            {
                IEngineShapeInstance targetShapeInstance = _emitterMeshEntity.Shape._engineInstance;

                // Only IEngineShapeInstance that are also EngineInstanceEntity are accepted
                if (targetShapeInstance == null || targetShapeInstance is EngineInstanceEntity)
                {
                    _inst = targetShapeInstance as EngineInstanceEntity;
                }
                else
                {
                    _emitterMeshEntity = null;
                }
            }
            EnginePGroup.SetMeshEmitterEntity(_inst);
        }
Example #2
0
        private void createInstance(System.Windows.Forms.DragEventArgs e)
        {
            _assetPaths = CSharpFramework.Contexts.IDropContext.GetAssetPaths(e);
            _assetTypes = CSharpFramework.Contexts.IDropContext.GetAssetTypes(e);
            _assetNames = CSharpFramework.Contexts.IDropContext.GetAssetNames(e);

            Debug.Assert(_assetPaths.Length == _assetTypes.Length && _assetPaths.Length == _assetNames.Length);
            if (_assetPaths.Length == 0)
            {
                return;
            }

            if (_assetTypes[0] == "Model")
            {
                _instance = new EngineInstanceEntity("VisBaseEntity_cl", _assetPaths[0], null, null, true);
            }
            else if (_assetTypes[0] == "StaticMesh")
            {
                EngineInstanceStaticMesh instance = new EngineInstanceStaticMesh();
                instance.SetMeshFile(_assetPaths[0], "", 0, false);
                instance.SetCollisionBitmask(0);
                _instance = instance;
            }
            else if (_assetTypes[0] == "Prefab")
            {
                EngineInstancePrefab instance = new EngineInstancePrefab();
                instance.SetFilename(_assetPaths[0]);
                _instance = instance;
            }
        }
Example #3
0
        private void createInstance(System.Windows.Forms.DragEventArgs e)
        {
            _assetPaths = CSharpFramework.Contexts.IDropContext.GetAssetPaths(e);
            _assetTypes = CSharpFramework.Contexts.IDropContext.GetAssetTypes(e);
            _assetNames = CSharpFramework.Contexts.IDropContext.GetAssetNames(e);

            Debug.Assert(_assetPaths.Length == _assetTypes.Length && _assetPaths.Length == _assetNames.Length);
            if (_assetPaths.Length == 0)
            {
                return;
            }

            if (_assetTypes[0] == "Model")
            {
                _instance = new EngineInstanceEntity("VisBaseEntity_cl", _assetPaths[0], null, null, true);
            }
            else if (_assetTypes[0] == "StaticMesh")
            {
                EngineInstanceStaticMesh instance = new EngineInstanceStaticMesh();
                LODEntry lodEntry = new LODEntry();
                lodEntry._filename = _assetPaths[0];
                List <LODEntry> lodEntries = new List <LODEntry>();
                lodEntries.Add(lodEntry);
                instance.SetLODChain(lodEntries);
                _instance = instance;
            }
            else if (_assetTypes[0] == "Prefab")
            {
                EngineInstancePrefab instance = new EngineInstancePrefab();
                instance.SetFilename(_assetPaths[0]);
                _instance = instance;
            }
        }
Example #4
0
        public override void CreateEngineInstance(bool bCreateChildren)
        {
            _engineInstance = new EngineInstanceEntity("CameraPositionEntity", null, this, null, true);
            base.CreateEngineInstance(bCreateChildren);
            SetEngineInstanceBaseProperties(); // sets the position etc.

            EngineEntity.SetVariable("FovX", _fCustomFOV.ToString());
            EngineEntity.SetVariable("NearClipDistance", NearClipDistance.ToString());
            EngineEntity.SetVariable("FarClipDistance", FarClipDistance.ToString());
        }
Example #5
0
        public override bool OnExport(SceneExportInfo info)
        {
            EngineInstanceEntity entity = _engineInstance as EngineInstanceEntity;

            // this shape is only exported as entity if the camera has a key
            SetHint(HintFlags_e.NoExport, string.IsNullOrEmpty(_objectKey));

            if (entity != null)
            {
                // we dont have a specific engine instance class, so assign via standard variable reflection
                entity.SetVariable("NearClipDistance", NearClipDistance.ToString());
                entity.SetVariable("FarClipDistance", FarClipDistance.ToString());
                entity.SetVariable("FovX", FOV.ToString());
            }

            bool bResult = base.OnExport(info);

            return(bResult);
        }
        /// <summary>
        /// Gets the engine instance which belongs to the passed anchor, or NULL if the anchor
        /// is not attached to an entity.
        /// </summary>
        /// <param name="linkTarget">link target</param>
        /// <returns>Entity engine instance, or NULL if anchor is not attached to an entity</returns>
        private EngineInstanceEntity GetEntityFromAnchor(AnchorShape anchorShape)
        {
            // Get the entity shape which holds the anchor
            EntityShape entityShape = anchorShape.Parent as EntityShape;

            if (entityShape == null)
            {
                return(null);
            }

            // Next get the engine instance of the entity shape
            EngineInstanceEntity engineEntityInstance = entityShape._engineInstance as EngineInstanceEntity;

            if (engineEntityInstance == null)
            {
                return(null);
            }

            return(engineEntityInstance);
        }
        /// <summary>
        /// Performs the actual linking on engine instances
        /// </summary>
        /// <param name="src"></param>
        /// <param name="target"></param>
        public override void OnLink(ShapeLink src, ShapeLink target)
        {
            base.OnLink(src, target);

            // Ignore links which don't belong to us
            if (src.OwnerShape != this)
            {
                return;
            }

            // Get the anchor the target link points to
            AnchorShape anchorShape = GetAnchorFromLink(target);

            if (anchorShape == null || !HasEngineInstance())
            {
                return;
            }

            // Get the entity instance the target points to
            EngineInstanceEntity entityInstance = GetEntityFromAnchor(anchorShape);

            // Add the actor to the constraint
            if (entityInstance != null)
            {
                // We have an anchor which belongs to an entity. Add the entity to the constraint
                // and pass the anchor position, relative to the parent entity.
                Vector3F anchorPositionLS = anchorShape.LocalSpacePosition;
                bool     bResult          = EngineConstraintChainInstance.AddEntityAnchor(
                    (long)anchorShape.UniqueID, entityInstance, anchorPositionLS);
                Debug.Assert(bResult == true);
            }
            else
            {
                // Our anchor is statically attached to the world.
                // Add the static world anchor to the constraint. Pass the world space position of the anchor
                // for this purpose.
                Vector3F anchorPositionWS = anchorShape.Position;
                bool     bResult          = EngineConstraintChainInstance.AddWorldAnchor((long)anchorShape.UniqueID, anchorShape);
                Debug.Assert(bResult == true);
            }
        }
 public override void CreateEngineInstance(bool bCreateChildren)
 {
     _engineInstance = new EngineInstanceEntity("CameraPositionEntity", null, this, null, true);
       base.CreateEngineInstance(bCreateChildren);
       SetEngineInstanceBaseProperties(); // sets the position etc.
 }
Example #9
0
 public override void CreateEngineInstance(bool bCreateChildren)
 {
     _engineInstance = new EngineInstanceEntity("CameraPositionEntity", null, this, null, true);
     base.CreateEngineInstance(bCreateChildren);
     SetEngineInstanceBaseProperties(); // sets the position etc.
 }
        public override void CreateEngineInstance(bool bCreateChildren)
        {
            _engineInstance = new EngineInstanceEntity("CameraPositionEntity", null, this, null, true);
              base.CreateEngineInstance(bCreateChildren);
              SetEngineInstanceBaseProperties(); // sets the position etc.

              EngineEntity.SetVariable("FovX", _fCustomFOV.ToString());
              EngineEntity.SetVariable("NearClipDistance", NearClipDistance.ToString());
              EngineEntity.SetVariable("FarClipDistance", FarClipDistance.ToString());
        }