예제 #1
0
 public LevelObject(BehaviourModel.ObjectBehaviourModel _behaviourmodel, RenderObject _renderaspect, ResourceCollectorXNA.Engine.Render.Materials.Material _material, RaycastBoundObject _raycastaspect, EditorData ed)
 {
     behaviourmodel = _behaviourmodel;
     renderaspect = _renderaspect;
     raycastaspect = _raycastaspect;
     editorAspect = ed;
     material = _material;
 }
 /// <summary>
 /// генерирует террайн расположенный в центре своих лок координат
 /// </summary>
 /// <param name="size"></param>
 /// <returns></returns>
 public static TerrainObject GenerateTerrain(int WidthCount, int LenghtCount, float step, bool shadowcaster, bool shadowreceiver)
 {
     TerrainMesh to = TerrainMesh.GenerateMesh(WidthCount, LenghtCount, step);
     TerrainRenderObject tro = new TerrainRenderObject(to);
     tro.isshadowcaster = shadowcaster;
     tro.isshadowreceiver = shadowreceiver;
     RaycastBoundObject rcbo = new RaycastBoundObject(new Logic.SceneGraph.OTBoundingShape(to.Size), null);
     return new TerrainObject(tro, rcbo, new EditorData("sample terrain", ObjectEditorType.TerrainObject));
 }
        private static RaycastBoundObject loadrcbo( 
            ResourceCollector.Content.LevelObjectDescription description,
            ResourceCollector.Pack packs)
        {
            //клижмеш мб один на несколько объектов//его прекрасно удалит сам гк если что
            EngineCollisionMesh ObjectRCCM = null;
            //бш уникален для каждого //его тож гк удалит
            Logic.SceneGraph.OTBoundingShape bs = null;
            if (description.IsRCCMEnabled)
            {
                ResourceCollector.Content.CollisionMesh cm = ResourceCollector.PackList.Instance.GetObject(description.RCCMName) as ResourceCollector.Content.CollisionMesh;

                if (cm.Enginereadedobject.Count == 0)
                    ObjectRCCM = EngineCollisionMesh.FromcontentCollisionMesh(cm);
                else
                    ObjectRCCM = cm.Enginereadedobject[0] as EngineCollisionMesh;

                cm.Enginereadedobject.Add(ObjectRCCM);
                bs = new Logic.SceneGraph.OTBoundingShape(ObjectRCCM);
            }
            else
                bs = new Logic.SceneGraph.OTBoundingShape(description.RCShapeSize);
            //его тоже удалят
            RaycastBoundObject raycastaspect = new RaycastBoundObject(bs, ObjectRCCM);
            return raycastaspect;
        }
 public static TerrainObject SampleTerrain()
 {
     TerrainMesh to = TerrainMesh.GenerateMesh(30, 30, 2.0f);
     TerrainRenderObject tro = new TerrainRenderObject(to);
     tro.isshadowcaster = tro.isshadowreceiver = true;
     RaycastBoundObject rcbo = new RaycastBoundObject(new Logic.SceneGraph.OTBoundingShape(to.Size), null);
     return new TerrainObject(tro, rcbo, new EditorData("sample terrain1", ObjectEditorType.TerrainObject));
 }