public Entity(Mesh mesh) { this.Mesh = mesh; this.Name = "Entity" + Debug.NextObjectId; SubmeshMaterials = new Material[mesh.SubmeshCount]; CreateControls(); }
public SkyBox(Game game, ShaderResourceView cubeMap, string debugName = null) { this.game = game; this.cubeMap = cubeMap; cube = game.ResourceManager.Mesh.Load(InternalResources.MESH_CUBE); MaterialPassDesc desc = new MaterialPassDesc(); desc.ManualConstantBuffers = true; desc.ShaderFile = "Skybox.hlsl"; desc.RasteriazerStates.CullMode = CullMode.Front; desc.DepthStencilStates.DepthWriteMask = DepthWriteMask.Zero; pass = new MaterialPass(game.Device, desc, debugName ?? "Skybox" + Debug.NextObjectId); buffer = Material.CreateBuffer<Data>(); }
public Skydome(Device device) { this.device = device; sphere = Mesh.CreateSphere(); MaterialPassDesc desc = new MaterialPassDesc(); desc.ManualConstantBuffers = true; desc.ShaderFile = "Skydome.hlsl"; desc.RasteriazerStates.CullMode = CullMode.None; desc.DepthStencilStates.IsDepthEnabled = false; pass = new MaterialPass(device, desc, "Skydome"); buffer = Material.CreateBuffer<Data>(); //Game.Instance.AddControl(new Lilium.Controls.ColorPicker("Bottom", () => data.bottomColor, val => data.bottomColor = val)); //Game.Instance.AddControl(new Lilium.Controls.ColorPicker("Top", () => data.topColor, val => data.topColor = val)); }
public MeshPreview(Mesh mesh) { this.mesh = mesh; var game = Game.Instance; { var desc = new MaterialPassDesc(); desc.ManualConstantBuffers = true; desc.ShaderFile = "MeshPreview.hlsl"; passFill = new MaterialPass(game.Device, desc, "Preview(Fill)"); } { var desc = new MaterialPassDesc(); desc.ManualConstantBuffers = true; desc.ShaderFile = "MeshPreview.hlsl"; desc.RasteriazerStates.FillMode = FillMode.Wireframe; passWireframe = new MaterialPass(game.Device, desc, "Preview(Wireframe)"); } shaderBuffer = Material.CreateBuffer<ShaderData>(); shaderBuffer.DebugName = "Preview"; tangentRenderer = new TangentSpaceBasisRenderer(mesh.vertices); }
public void PreviewActive() { var desc = new ShaderResourceViewDescription(); desc.Format = tex.Description.Format; desc.Dimension = ShaderResourceViewDimension.TextureCube; desc.Texture2D.MipLevels = tex.Description.MipLevels; desc.Texture2D.MostDetailedMip = 0; shaderResourceView = new ShaderResourceView(mGame.Device, tex, desc); shaderResourceView.DebugName = "Preview"; if (shaderResourceView == null) return; desc.Dimension = ShaderResourceViewDimension.Texture2DArray; desc.Texture2DArray.ArraySize = 1; desc.Texture2DArray.MipLevels = tex.Description.MipLevels; desc.Texture2DArray.MostDetailedMip = 0; mFaces = new ShaderResourceView[6]; for (int i = 0; i < 6; ++i) { desc.Texture2DArray.FirstArraySlice = i; mFaces[i] = new ShaderResourceView(mGame.Device, tex, desc); } cube = mGame.ResourceManager.Mesh.Load(InternalResources.MESH_CUBE); sphere = mGame.ResourceManager.Mesh.Load(InternalResources.MESH_SPHERE); var passDesc = new MaterialPassDesc(); passDesc.ManualConstantBuffers = true; passDesc.ShaderFile = "CubemapPreview.hlsl"; passCube = new MaterialPass(Game.Instance.Device, passDesc, "Preview(Cube)"); passDesc.PixelShaderFunction = "PS_Sphere"; passSphere = new MaterialPass(mGame.Device, passDesc, "Preview(Sphere)"); skybox = new SkyBox(mGame, shaderResourceView, "Preview"); mQuad = new TexturePreviewQuad(mGame, tex.Description); Light.IsPreviewingTexture = true; }