コード例 #1
0
ファイル: RenderNav.cs プロジェクト: nptr/MafiaToolkit
 public void Init(OBJData data, int i)
 {
     DoRender      = true;
     this.data     = data;
     lines         = new List <RenderLine>();
     navigationBox = new RenderBoundingBox();
     navigationBox.Init(new BoundingBox(new Vector3(-0.1f), new Vector3(0.1f)));
     navigationBox.SetColour(System.Drawing.Color.Green);
     navigationBox.SetTransform(Matrix.Translation(data.vertices[i].Position));
     vertex = data.vertices[i];
 }
コード例 #2
0
        public bool PreInit(IntPtr WindowHandle)
        {
            D3D = new DirectX11Class();
            if (!D3D.Init(WindowHandle))
            {
                MessageBox.Show("Failed to initialize DirectX11!");
            }
            Profile.Init();
            if (!RenderStorageSingleton.Instance.IsInitialised())
            {
                bool result    = RenderStorageSingleton.Instance.Initialise(D3D);
                var  structure = new M2TStructure();
                //import gizmo
                RenderModel gizmo = new RenderModel();
                structure.ReadFromM2T("Resources/GizmoModel.m2t");
                gizmo.ConvertMTKToRenderModel(structure);
                gizmo.InitBuffers(D3D.Device, D3D.DeviceContext);
                gizmo.DoRender   = true;
                TranslationGizmo = new GizmoTool(gizmo);

                sky       = new RenderModel();
                structure = new M2TStructure();
                structure.ReadFromM2T("Resources/sky_backdrop.m2t");
                sky.ConvertMTKToRenderModel(structure);
                sky.InitBuffers(D3D.Device, D3D.DeviceContext);

                clouds    = new RenderModel();
                structure = new M2TStructure();
                structure.ReadFromM2T("Resources/weather_clouds.m2t");
                clouds.ConvertMTKToRenderModel(structure);
                clouds.InitBuffers(D3D.Device, D3D.DeviceContext);
                clouds.DoRender = false;
            }

            selectionBox.SetColour(System.Drawing.Color.Red);
            selectionBox.Init(new BoundingBox(new Vector3(0.5f), new Vector3(-0.5f)));
            selectionBox.DoRender = false;
            return(true);
        }
コード例 #3
0
ファイル: RenderNav.cs プロジェクト: RoadTrain/Mafia2Toolkit
        public void Init(OBJData data)
        {
            DoRender  = true;
            this.data = data;

            string VertexBatchID = string.Format("NavObjData_{0}", RefManager.GetNewRefID());

            PathVertexBatch = new PrimitiveBatch(PrimitiveType.Box, VertexBatchID);
            foreach (OBJData.VertexStruct Vertex in data.vertices)
            {
                RenderBoundingBox navigationBox = new RenderBoundingBox();
                navigationBox.Init(new BoundingBox(new Vector3(-0.1f), new Vector3(0.1f)));
                navigationBox.SetColour(System.Drawing.Color.Green);
                navigationBox.SetTransform(Matrix4x4.CreateTranslation(Vertex.Position));

                int PathHandle = RefManager.GetNewRefID();
                PathVertexBatch.AddObject(PathHandle, navigationBox);
                BoundingBoxes.Add(navigationBox);
            }

            OwnGraphics.OurPrimitiveManager.AddPrimitiveBatch(PathVertexBatch);
            OwnGraphics.OurPrimitiveManager.AddPrimitiveBatch(PointConnectionsBatch);
        }