public RenderBase(int adapterIndex) { //Only enable when specifically using to debug, eats up CPU time... //ObjectTracker.StackTraceProvider = () => Environment.StackTrace; SetupWindow(); Input.XInputInput.Init(); InitDeviceRes(adapterIndex); InitDebugShaders(); InitTriangle(); WVP = new UConstantBuffer(this, Utilities.SizeOf <Matrix>() * 4); WVP.Set(0); Sun = new SunBuffer(this); var entities = new List <Entity>(); var tank = new Tank(); fishManager = new FishManager(entities, tank); fishRenderer = new FishRenderer(this, fishManager); fishGlow = new FishGlow(this, fishManager); raysRenderer = new RaysRenderer(this); foodManager = new FoodManager(entities, tank); foodRenderer = new FoodRenderer(this, foodManager); decorRenderer = new DecorRenderer(this); //swapChain.SetFullscreenState(true, null); }
public FishRenderer(RenderBase rb, FishManager manager) { RenderBase = rb; Manager = manager; paramsBuffer = new UConstantBuffer(RenderBase, Utilities.SizeOf <Vector4>() * 2); var shaderFlags = #if DEBUG ShaderFlags.Debug; #else ShaderFlags.None; #endif vertexShader = new UVertexShader(RenderBase, "shaders/Vertex_PC_Explode.hlsl", VertexPositionNormal.InputElements); using (var pixelShaderByteCode = ShaderBytecode.CompileFromFile("shaders/Pixel_PC_FishPointLights.hlsl", "main", "ps_4_0", shaderFlags)) pixelShader = new PixelShader(RenderBase.Device, pixelShaderByteCode); vertexBuffer = new Buffer[3]; vertexCount = new int[vertexBuffer.Length]; vertexBuffer[0] = Buffer.Create(RenderBase.Device, BindFlags.VertexBuffer, VertexPositionNormal.LoadSTL("models/fish.stl", out vertexCount[0])); vertexBuffer[1] = Buffer.Create(RenderBase.Device, BindFlags.VertexBuffer, VertexPositionNormal.LoadSTL("models/fish4.stl", out vertexCount[1])); vertexBuffer[2] = Buffer.Create(RenderBase.Device, BindFlags.VertexBuffer, VertexPositionNormal.LoadSTL("models/fish5.stl", out vertexCount[2])); coneVertexBuffer = Buffer.Create(RenderBase.Device, BindFlags.VertexBuffer, new VertexPositionColor[] { new VertexPositionColor(new Vector3(0.0f, 0.0f, 0.0f), Color.White), new VertexPositionColor(new Vector3(1.0f, 1.0f, 0.0f), Color.White), new VertexPositionColor(new Vector3(1.0f, -1.0f, 0.0f), Color.White) }); }
public HeadlessSim(int id) { ID = id; var entities = new List <Entity>(); var tank = new Tank(); fishManager = new FishManager(entities, tank); fishManager.trackDead = false; fishManager.newTopPrefix = "[" + ID + "] New Top: "; foodManager = new FoodManager(entities, tank); }
public FishGlow(RenderBase rb, FishManager manager) { RenderBase = rb; Manager = manager; var shaderFlags = #if DEBUG ShaderFlags.Debug; #else ShaderFlags.None; #endif vertexShader = new UVertexShader(RenderBase, "shaders/Vertex_FS.hlsl", null); using (var pixelShaderByteCode = ShaderBytecode.CompileFromFile("shaders/Pixel_FishGlow.hlsl", "main", "ps_4_0", shaderFlags)) pixelShader = new PixelShader(RenderBase.Device, pixelShaderByteCode); cb = new ConstantBuffers.UConstantBuffer(RenderBase, 4 * 4 + FishManager.MAX_FISH_COUNT * 2 * 4 * 4); }