public void AddBufferMap() { CudaUtil.AddBufferMap(CommonInfo.frame_buffer0_ptr); CudaUtil.AddBufferMap(CommonInfo.frame_buffer1_ptr); CudaUtil.AddBufferMap(CommonInfo.frame_buffer2_ptr); CudaUtil.AddBufferMap(CommonInfo.picking_buffer_ptr); }
public void loop() { CommonInfo.mainFormHaveShown.WaitOne(); while (true) { if (CommonInfo.isResolutionChanged) { CommonInfo.ChangeResolution(); } //更新scene mf.UpdatePrimitives(); if (commandPool.Excute() > 0) { CudaUtil.GenerateScene(); } //更新面板 mf.RefreshTransormPanel(); //渲染图片 renderBuffer.signal.WaitOne(); // 若当前bitmap为不可渲状态则等待,反之进行下一步 CudaUtil.RenderScene(renderBuffer.index, 3); // 这里应该是 renderScene() renderBuffer.signal.Reset(); //渲染完成后,当前bitmap变为不可渲 renderBuffer.theOther.signal.Set(); //渲染完成后,当前bitmap变为 可被前端显示(简称可显) 状态 renderBuffer = renderBuffer.next; // 切换到下一个bitmap } }
public Triangle GetTriangle(int index) { triangle.points = CudaUtil.CheckPrimitivePoints(index); triangle.normal = CudaUtil.CheckPrimitiveNormal(index); triangle.materialColor = CudaUtil.CheckPrimitiveColor(index); return(triangle); }
public static void AddMapToCuda() { CudaUtil.AddBufferMap(frame_buffer0_ptr); CudaUtil.AddBufferMap(frame_buffer1_ptr); CudaUtil.AddBufferMap(frame_buffer2_ptr); CudaUtil.AddBufferMap(picking_buffer_ptr); }
public Sphere GetSphere(int index) { sphere.centre = CudaUtil.CheckPrimitiveCentre(index); sphere.materialColor = CudaUtil.CheckPrimitiveColor(index); sphere.radius = CudaUtil.CheckPrimitiveRadius(index); return(sphere); }
public bool ChangeTriangle(int index, Triangle triangle) { CudaUtil.ChangePrimitivePoints(index, triangle.points); CudaUtil.ChangePrimitiveColor(index, triangle.materialColor); CudaUtil.ChangePrimitiveNormal(index, triangle.normal); return(true); }
public static void ChangeResolution() { switch (resolution) { case Resolution.P128X72: width = 128; height = 72; break; case Resolution.P256X144: width = 256; height = 144; break; case Resolution.P512X288: width = 512; height = 288; break; case Resolution.P1024X576: width = 1024; height = 576; break; case Resolution.P1280X720: width = 1280; height = 720; break; } CudaUtil.InitializeResources(width, height); ResetMap(); AddMapToCuda(); isResolutionChanged = false; }
public Plane GetPlane(int index) { plane.centre = CudaUtil.CheckPrimitiveCentre(index); plane.materialColor = CudaUtil.CheckPrimitiveColor(index); plane.normal = CudaUtil.CheckPrimitiveNormal(index); return(plane); }
public bool ChangePlane(int index, Plane plane) { CudaUtil.ChangePrimitiveColor(index, plane.materialColor); CudaUtil.ChangePrimitiveNormal(index, plane.normal); CudaUtil.ChangePrimitiveCentre(index, plane.centre); Log.instance.writeLog("将平面的参数变为,质心:" + plane.centre.x.ToString() + plane.centre.y.ToString() + plane.centre.z.ToString()); Log.instance.writeLog("法向量" + plane.normal.x.ToString() + plane.normal.y.ToString() + plane.normal.z.ToString()); return(true); }
public bool ChangeSphere(int index, Sphere sphere) { CudaUtil.ChangePrimitiveCentre(index, sphere.centre); CudaUtil.ChangePrimitiveColor(index, sphere.materialColor); CudaUtil.ChangePrimitiveRadius(index, sphere.radius); Log.instance.writeLog("将球的参数变为,质心:" + sphere.centre.x.ToString() + sphere.centre.y.ToString() + sphere.centre.z.ToString()); return(true); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); CudaUtil.InitializeResources(CommonInfo.width, CommonInfo.height); CommonInfo.MallocMap(); CommonInfo.AddMapToCuda(); mainForm mainForm = new mainForm( ); Loop loop = new Loop(mainForm); ThreadStart renderStart = new ThreadStart(loop.loop); Thread renderLoop = new Thread(renderStart); //开启调度线程(切换图片的函数) ThreadStart showStart = new ThreadStart(loop.ShowImage); Thread showLoop = new Thread(showStart); renderLoop.Start(); showLoop.Start(); Application.Run(mainForm); CudaUtil.FreeResources(); }
public int AddPlane() { return(CudaUtil.AddPlane()); }
public bool DeletrPrimitive(int index) { CudaUtil.DeletePrimitive(index); return(true); }
public int AddSphere() { return(CudaUtil.AddSphere()); }
public int AddTriangle() { return(CudaUtil.AddTriangle()); }
public void SendCameraToCuda() { CudaUtil.SendCamera(camera, CommonInfo.width, CommonInfo.height); }
public void UpdateCamera() { camera.Update(CommonInfo.accumulatedX, CommonInfo.accumulatedY); CudaUtil.SendCamera(camera, CommonInfo.width, CommonInfo.height); }