internal void Clear()
 {
     WorldMatrix           = MatrixD.Zero;
     CommonObjectData      = default(MyObjectDataCommon);
     NonVoxelObjectData    = MyObjectDataNonVoxel.Invalid;
     VoxelCommonObjectData = MyObjectDataVoxelCommon.Invalid;
     Mesh             = LodMeshId.NULL;
     MergedMesh       = MyMergedLodMeshId.NULL;
     Instancing       = InstancingId.NULL;
     DepthShaders     = MyMaterialShadersBundleId.NULL;
     Shaders          = MyMaterialShadersBundleId.NULL;
     ForwardShaders   = MyMaterialShadersBundleId.NULL;
     DrawSubmesh      = default(MyDrawSubmesh);
     PerMaterialIndex = 0;
     SectionSubmeshes = null;
     InstanceCount    = 0;
     StartInstance    = 0;
     SkinningMatrices = null;
     Type             = MyMaterialType.OPAQUE;
     Flags            = 0;
     Lod          = 0;
     ObjectBuffer = null;
     Parent       = null;
     Material     = MyStringId.NullOrEmpty;
 }
Example #2
0
        internal void AddComponent(MyActorComponent component)
        {
            // only flat hierarchy
            Debug.Assert(component.Type != MyActorComponentEnum.GroupLeaf || GetGroupRoot() == null);
            Debug.Assert(component.Type != MyActorComponentEnum.GroupRoot || GetGroupLeaf() == null);

            component.Assign(this);
            m_components.Add(component);
        }
Example #3
0
        internal void AddComponent <T>(MyActorComponent component) where T : MyActorComponent
        {
            // only flat hierarchy
            Debug.Assert(component.Type != MyActorComponentEnum.GroupLeaf || GetComponent <MyGroupRootComponent>() == null);
            Debug.Assert(component.Type != MyActorComponentEnum.GroupRoot || GetComponent <MyGroupLeafComponent>() == null);

            component.Assign(this);
            m_components.Add(typeof(T), component);
        }
Example #4
0
        internal static void Deallocate(this MyActorComponent item)
        {
            var voxelRenderable = item as MyVoxelRenderableComponent; // TODO: Rewrite this whole method

            if (voxelRenderable != null)
            {
                MyComponentFactory <MyVoxelRenderableComponent> .Deallocate(voxelRenderable);

                return;
            }

            switch (item.Type)
            {
            case MyActorComponentEnum.Renderable:
                MyComponentFactory <MyRenderableComponent> .Deallocate(item as MyRenderableComponent);

                break;

            case MyActorComponentEnum.Instancing:
                MyComponentFactory <MyInstancingComponent> .Deallocate(item as MyInstancingComponent);

                break;

            case MyActorComponentEnum.Skinning:
                MyComponentFactory <MySkinningComponent> .Deallocate(item as MySkinningComponent);

                break;

            case MyActorComponentEnum.Foliage:
                MyComponentFactory <MyFoliageComponent> .Deallocate(item as MyFoliageComponent);

                break;

            case MyActorComponentEnum.GroupLeaf:
                MyComponentFactory <MyGroupLeafComponent> .Deallocate(item as MyGroupLeafComponent);

                break;

            case MyActorComponentEnum.GroupRoot:
                MyComponentFactory <MyGroupRootComponent> .Deallocate(item as MyGroupRootComponent);

                break;

            case MyActorComponentEnum.InstanceLod:
                MyComponentFactory <MyInstanceLodComponent> .Deallocate(item as MyInstanceLodComponent);

                break;

            case MyActorComponentEnum.Unassigned:
                Debug.Assert(false, "Can't find component factory");
                break;
            }
        }
        internal static void Deallocate(this MyActorComponent item)
        {
            switch (item.Type)
            {
            case MyActorComponentEnum.Renderable:
                MyComponentFactory <MyRenderableComponent> .Deallocate(item as MyRenderableComponent);

                break;

            case MyActorComponentEnum.Instancing:
                MyComponentFactory <MyInstancingComponent> .Deallocate(item as MyInstancingComponent);

                break;

            case MyActorComponentEnum.Skinning:
                MyComponentFactory <MySkinningComponent> .Deallocate(item as MySkinningComponent);

                break;

            case MyActorComponentEnum.Foliage:
                MyComponentFactory <MyFoliageComponent> .Deallocate(item as MyFoliageComponent);

                break;

            case MyActorComponentEnum.GroupLeaf:
                MyComponentFactory <MyGroupLeafComponent> .Deallocate(item as MyGroupLeafComponent);

                break;

            case MyActorComponentEnum.GroupRoot:
                MyComponentFactory <MyGroupRootComponent> .Deallocate(item as MyGroupRootComponent);

                break;

            case MyActorComponentEnum.InstanceLod:
                MyComponentFactory <MyInstanceLodComponent> .Deallocate(item as MyInstanceLodComponent);

                break;

            case MyActorComponentEnum.Unassigned:
                Debug.Assert(false, "Can't find component factory");
                break;
            }
        }
Example #6
0
 internal void RemoveComponent(MyActorComponent component)
 {
     component.OnRemove(this);
     m_components.Remove(component);
 }
Example #7
0
 internal void RemoveComponent <T>(MyActorComponent component) where T : MyActorComponent
 {
     component.OnRemove(this);
     m_components.Remove(typeof(T));
 }