forked from StrafesNET/strafe-client
sky should not be using model_sampler
This commit is contained in:
parent
822c9d6d5f
commit
c32d3ebd98
18
src/main.rs
18
src/main.rs
@ -594,11 +594,19 @@ impl framework::Example for GraphicsData {
|
||||
})
|
||||
};
|
||||
|
||||
let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
let model_pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
bind_group_layouts: &[
|
||||
&camera_bind_group_layout,
|
||||
&skybox_texture_bind_group_layout,
|
||||
&model_bind_group_layout,
|
||||
],
|
||||
push_constant_ranges: &[],
|
||||
});
|
||||
let sky_pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
bind_group_layouts: &[
|
||||
&camera_bind_group_layout,
|
||||
&skybox_texture_bind_group_layout,
|
||||
],
|
||||
push_constant_ranges: &[],
|
||||
@ -607,7 +615,7 @@ impl framework::Example for GraphicsData {
|
||||
// Create the render pipelines
|
||||
let sky_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
label: Some("Sky Pipeline"),
|
||||
layout: Some(&pipeline_layout),
|
||||
layout: Some(&sky_pipeline_layout),
|
||||
vertex: wgpu::VertexState {
|
||||
module: &shader,
|
||||
entry_point: "vs_sky",
|
||||
@ -634,7 +642,7 @@ impl framework::Example for GraphicsData {
|
||||
});
|
||||
let model_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
label: Some("Model Pipeline"),
|
||||
layout: Some(&pipeline_layout),
|
||||
layout: Some(&model_pipeline_layout),
|
||||
vertex: wgpu::VertexState {
|
||||
module: &shader,
|
||||
entry_point: "vs_entity_texture",
|
||||
@ -932,11 +940,11 @@ impl framework::Example for GraphicsData {
|
||||
});
|
||||
|
||||
rpass.set_bind_group(0, &self.bind_groups.camera, &[]);
|
||||
rpass.set_bind_group(2, &self.bind_groups.skybox_texture, &[]);
|
||||
rpass.set_bind_group(1, &self.bind_groups.skybox_texture, &[]);
|
||||
|
||||
rpass.set_pipeline(&self.pipelines.model);
|
||||
for model in self.models.iter() {
|
||||
rpass.set_bind_group(1, &model.bind_group, &[]);
|
||||
rpass.set_bind_group(2, &model.bind_group, &[]);
|
||||
rpass.set_vertex_buffer(0, model.vertex_buf.slice(..));
|
||||
|
||||
for entity in model.entities.iter() {
|
||||
|
@ -49,13 +49,13 @@ struct ModelInstance{
|
||||
//the texture transform then maps the texture coordinates to the location of the specific texture
|
||||
//group 1 is the model
|
||||
const MAX_MODEL_INSTANCES=4096;
|
||||
@group(1)
|
||||
@group(2)
|
||||
@binding(0)
|
||||
var<uniform> model_instances: array<ModelInstance, MAX_MODEL_INSTANCES>;
|
||||
@group(1)
|
||||
@group(2)
|
||||
@binding(1)
|
||||
var model_texture: texture_2d<f32>;
|
||||
@group(1)
|
||||
@group(2)
|
||||
@binding(2)
|
||||
var model_sampler: sampler;
|
||||
|
||||
@ -85,16 +85,16 @@ fn vs_entity_texture(
|
||||
}
|
||||
|
||||
//group 2 is the skybox texture
|
||||
@group(2)
|
||||
@group(1)
|
||||
@binding(0)
|
||||
var cube_texture: texture_cube<f32>;
|
||||
@group(2)
|
||||
@group(1)
|
||||
@binding(1)
|
||||
var cube_sampler: sampler;
|
||||
|
||||
@fragment
|
||||
fn fs_sky(vertex: SkyOutput) -> @location(0) vec4<f32> {
|
||||
return textureSample(cube_texture, model_sampler, vertex.sampledir);
|
||||
return textureSample(cube_texture, cube_sampler, vertex.sampledir);
|
||||
}
|
||||
|
||||
@fragment
|
||||
|
Loading…
Reference in New Issue
Block a user