Fixed documentation and example location.
Still working on ignore lighting and lighting for ColorMaterial. Signed-off-by: Adrian Graur <adrian.graur@tecnico.ulisboa.pt>
This commit is contained in:
parent
2813a2f33a
commit
bef061d874
@ -15,13 +15,12 @@ use crate::render::SpritePipeline;
|
||||
pub const MAX_POINT_LIGHTS_2D: usize = 32;
|
||||
|
||||
/// This structure is sent to the GPU for lighting calculations.
|
||||
///
|
||||
/// - `color_intensity`: RGBA color multiplied by intensity.
|
||||
/// - `position_radius`: XY position of the light, with Z as unused and W as radius.
|
||||
#[repr(C)]
|
||||
#[derive(ShaderType, Clone, Copy, Default, Pod, Zeroable)]
|
||||
pub struct GpuPointLight2D {
|
||||
/// RGBA color multiplied by intensity.
|
||||
pub color_intensity: [f32; 4],
|
||||
/// XY position of the light, Z unused, W as radius.
|
||||
pub position_radius: [f32; 4],
|
||||
}
|
||||
|
||||
|
@ -931,11 +931,12 @@ impl<const I: usize> RenderCommand<Transparent2d> for SetPointLightBindGroup<I>
|
||||
type ItemQuery = ();
|
||||
|
||||
/// Executes the render command to bind the point light data.
|
||||
/// `_item` - The transparent 2D render item (unused in this implementation)
|
||||
/// `_view` - The view uniform offset data (unused in this implementation)
|
||||
/// `_item_query` - The result of the item query (unused since `ItemQuery` is `()`)
|
||||
/// `lights_resource` - The GPU lights resource containing the bind group with light data
|
||||
/// `pass` - The tracked render pass used to record GPU commands
|
||||
///
|
||||
/// * `_item` - The transparent 2D render item (unused in this implementation)
|
||||
/// * `_view` - The view uniform offset data (unused in this implementation)
|
||||
/// * `_item_query` - The result of the item query (unused since `ItemQuery` is `()`)
|
||||
/// * `lights_resource` - The GPU lights resource containing the bind group with light data
|
||||
/// * `pass` - The tracked render pass used to record GPU commands
|
||||
fn render<'w>(
|
||||
_item: &Transparent2d,
|
||||
_view: &ViewUniformOffset,
|
||||
|
@ -9,9 +9,6 @@
|
||||
//! `ArrowRight`: Cycle through colors
|
||||
//! N: Next scene
|
||||
//! O: Disable intensity
|
||||
|
||||
use bevy::math::cos;
|
||||
use bevy::math::sin;
|
||||
use bevy::prelude::*;
|
||||
use bevy::sprite::{FalloffType, PointLight2D};
|
||||
use std::f32::consts::TAU;
|
||||
@ -78,8 +75,8 @@ fn setup_scene1(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||
let radius = 200.0;
|
||||
for i in 0..count {
|
||||
let angle = i as f32 / count as f32 * TAU;
|
||||
let x = radius * cos(angle);
|
||||
let y = radius * sin(angle);
|
||||
let x = radius * angle.cos();
|
||||
let y = radius * angle.sin();
|
||||
commands.spawn((
|
||||
Sprite {
|
||||
image: sprite_handle.clone(),
|
Loading…
Reference in New Issue
Block a user