public static void InitializeScene(ref CommonInfo commonInfo)//该函数初始化的时候只执行一次,是按下I键后启动 { CudaUtil.OpenDebugConsole(); CudaUtil.InitializeResources(CommonInfo.Width, CommonInfo.Heght, 64); CudaUtil.AddBufferMap(commonInfo.frame_buffer0_data.Scan0); CudaUtil.AddBufferMap(commonInfo.frame_buffer1_data.Scan0); CudaUtil.AddBufferMap(commonInfo.picking_buffer_data.Scan0); commonInfo.frameBuffer0.UnlockBits(commonInfo.frame_buffer0_data); commonInfo.frameBuffer1.UnlockBits(commonInfo.frame_buffer1_data); commonInfo.pickingBuffer.UnlockBits(commonInfo.picking_buffer_data); Point3[] points = new Point3[3]; points[0] = new Point3(-1.0f, 0.0f, -15.0f); points[1] = new Point3(1.0f, 0.0f, -15.0f); points[2] = new Point3(0.5f, 1.0f, -15.0f); Point2[] uv = new Point2[3]; uv[0] = new Point2(0.0f, 0.0f); uv[1] = new Point2(1.0f, 0.0f); uv[2] = new Point2(0.5f, 1.0f); //CudaUtil.AddTriangle(Color.White, points, uv); CudaUtil.AddSphere(new Point3(0.0f, 0.0f, -5.0f), Color.White, 2.0f); CudaUtil.AddSphere(new Point3(4.0f, 0.0f, -5.0f), Color.White, 2.0f); CudaUtil.AddPlane(new Point3(0.0f, -2.0f, 0.0f), Color.White, new Normal(0.0f, 1.0f, 0.0f)); CudaUtil.AddTexture("C:\\Users\\Hordr\\source\\repos\\CavakazeRenderer\\CavakazeRenderer\\bin\\Debug\\Textures\\albedo.png"); CudaUtil.AddTexture("C:\\Users\\Hordr\\source\\repos\\CavakazeRenderer\\CavakazeRenderer\\bin\\Debug\\Textures\\normal.png"); CudaUtil.AddTexture("C:\\Users\\Hordr\\source\\repos\\CavakazeRenderer\\CavakazeRenderer\\bin\\Debug\\Textures\\metallic.png"); CudaUtil.AddTexture("C:\\Users\\Hordr\\source\\repos\\CavakazeRenderer\\CavakazeRenderer\\bin\\Debug\\Textures\\roughness.png"); CudaUtil.AddTexture("C:\\Users\\Hordr\\source\\repos\\CavakazeRenderer\\CavakazeRenderer\\bin\\Debug\\Textures\\ao.png"); CudaUtil.GenerateTextureList(); CudaUtil.SetPrimitiveDesinyPBRMaterial(0, 0, 1, 2, 3, 4); CudaUtil.SetPrimitiveDesinyPBRMaterial(1, 0, 1, 2, 3, 4); CudaUtil.SetPrimitiveDesinyPBRMaterial(2, 0, 1, 2, 3, 4); CudaUtil.GenerateScene(); }
public override void AddToCuda() { CudaUtil.AddPlane(centre, materialColor, normal); }