public override void SetAdditionalShaderParams(GPUModelResource modelResource) { Config_Grass config = Config as Config_Grass; modelResource.SetInt("size", Config.Amount); Vector4 info = new Vector4(config.Segments, config.Segmentheight, config.Grasswidth, 0); modelResource.SetVector("info", info); }
public GPUGrassModel(Config_Grass config) { Config = config; VerticesCount = Config.Amount * config.Segments * 2; IndicesCount = Config.Amount * (config.Segments - 1) * 6; VerticesKernelDimensions = new Vector2Int(Config.Amount, 1); IndicesKernelDimensions = new Vector2Int(Config.Amount, config.Segments); Spawnpoints = MapGeneration.GeneratePointsScattered(config.Grasswidth, config.Grasswidth, (uint)Config.Amount, 0); //todo: dependant on spawn config VerticesKernelStride = Marshal.SizeOf(typeof(GPUModelVertex)); IndicesKernelStride = Marshal.SizeOf(typeof(int)); BuildDataComputeBufferType = ComputeBufferType.Append; UpdateType = UpdateType.None; }