repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgparry/src/shapes/mod.rs | crates/wgparry/src/shapes/mod.rs | //! Geometric shape definitions and their GPU shader implementations.
//!
//! This module provides GPU-accelerated geometric primitives used for collision detection
//! and physics simulation.
mod ball;
mod capsule;
mod convex_polyhedron;
mod cuboid;
mod polyline;
mod segment;
mod triangle;
#[cfg(feature = "dim3")]
m... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgparry/src/shapes/trimesh.rs | crates/wgparry/src/shapes/trimesh.rs | //! Triangle mesh shape.
use crate::bounding_volumes::WgAabb;
use crate::queries::{WgPolygonalFeature, WgProjection, WgRay};
use crate::shapes::{WgConvexPolyhedron, WgTriangle, WgVtxIdx};
use crate::{dim_shader_defs, substitute_aliases};
use wgcore::Shader;
use wgebra::{WgSim2, WgSim3};
#[derive(Shader)]
#[shader(
... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgparry/src/shapes/segment.rs | crates/wgparry/src/shapes/segment.rs | //! Line segment shape.
//!
//! A segment is a straight line connecting two points A and B. It's a fundamental
//! building block used by other shapes like capsules and is useful for ray-casting
//! and distance queries.
use crate::queries::{WgProjection, WgRay};
use crate::{dim_shader_defs, substitute_aliases};
use w... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgparry/src/shapes/capsule.rs | crates/wgparry/src/shapes/capsule.rs | //! Capsule shape - swept sphere along a line segment.
//!
//! A capsule is defined by a line segment (from point A to point B) and a radius.
//! It can be visualized as a sphere swept along the segment, or as a cylinder with
//! hemispherical caps at both ends.
use crate::queries::{WgPolygonalFeature, WgProjection, W... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgparry/src/shapes/triangle.rs | crates/wgparry/src/shapes/triangle.rs | //! Triangle shape.
//!
//! A triangle is defined by three vertices (A, B, C). Triangles are the fundamental
//! building blocks of triangle meshes and are essential for representing complex
//! geometric surfaces in collision detection.
use crate::bounding_volumes::WgAabb;
use crate::queries::{WgPolygonalFeature, WgP... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgparry/src/shapes/ball.rs | crates/wgparry/src/shapes/ball.rs | //! Ball shape - sphere (3D) or circle (2D).
//!
//! The ball is the simplest geometric primitive, defined by a single radius parameter.
//! In 3D, this represents a sphere; in 2D, a circle.
use crate::queries::{WgProjection, WgRay};
use crate::{dim_shader_defs, substitute_aliases};
use wgcore::Shader;
use wgebra::{Wg... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/lib.rs | crates/wgebra/src/lib.rs | #![doc = include_str!("../README.md")]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::result_large_err)]
#![warn(missing_docs)]
pub use geometry::*;
pub use linalg::*;
pub mod geometry;
pub mod linalg;
pub mod utils;
| rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/geometry/lu.rs | crates/wgebra/src/geometry/lu.rs | use nalgebra::{SMatrix, SVector};
use wgcore::re_exports::encase::ShaderType;
use wgcore::{test_shader_compilation, Shader};
fn substitute2(src: &str) -> String {
src.replace("NROWS", "2u")
.replace("NCOLS", "2u")
.replace("PERM", "vec2<u32>")
.replace("MAT", "mat2x2<f32>")
.replace... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/geometry/quat.rs | crates/wgebra/src/geometry/quat.rs | use wgcore::Shader;
// NOTE: interesting perf. comparison between quaternions and matrices:
// https://tech.metail.com/performance-quaternions-gpu/
#[derive(Shader)]
#[shader(src = "quat.wgsl")]
/// Shader exposing a quaternion type and operations for representing 3D rotations.
pub struct WgQuat;
wgcore::test_... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/geometry/inv.rs | crates/wgebra/src/geometry/inv.rs | use wgcore::Shader;
#[derive(Shader)]
#[shader(src = "inv.wgsl")]
/// Shader exposing small matrix inverses.
pub struct WgInv;
wgcore::test_shader_compilation!(WgInv);
| rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/geometry/svd3.rs | crates/wgebra/src/geometry/svd3.rs | use crate::WgQuat;
use nalgebra::{Matrix4x3, Vector4};
use wgcore::Shader;
#[cfg(test)]
use {
naga_oil::compose::NagaModuleDescriptor,
wgpu::{ComputePipeline, Device},
};
#[derive(Copy, Clone, bytemuck::Pod, bytemuck::Zeroable)]
#[repr(C)]
/// A 3D SVD as represented on the gpu, with padding (every fourth rows... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/geometry/qr3.rs | crates/wgebra/src/geometry/qr3.rs | use nalgebra::Matrix3;
use wgcore::{test_shader_compilation, Shader};
#[cfg(test)]
use {
naga_oil::compose::NagaModuleDescriptor,
wgpu::{ComputePipeline, Device},
};
#[derive(Copy, Clone, Debug, encase::ShaderType)]
#[repr(C)]
/// GPU representation of a 3x3 matrix QR decomposition.
///
/// See the [nalgebra](... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/geometry/qr4.rs | crates/wgebra/src/geometry/qr4.rs | use nalgebra::Matrix4;
use wgcore::{test_shader_compilation, Shader};
#[cfg(test)]
use {
naga_oil::compose::NagaModuleDescriptor,
wgpu::{ComputePipeline, Device},
};
#[derive(Copy, Clone, Debug, bytemuck::Pod, bytemuck::Zeroable)]
#[repr(C)]
/// GPU representation of a 4x4 matrix QR decomposition.
///
/// See ... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/geometry/mod.rs | crates/wgebra/src/geometry/mod.rs | //! Geometric transformations.
pub use cholesky::*;
pub use eig2::*;
pub use eig3::*;
pub use eig4::*;
pub use inv::*;
pub use lu::*;
pub use qr2::*;
pub use qr3::*;
pub use qr4::*;
pub use quat::*;
pub use rot2::*;
pub use sim2::*;
pub use sim3::*;
pub use svd2::*;
pub use svd3::*;
mod cholesky;
mod eig2;
mod eig3;
... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/geometry/rot2.rs | crates/wgebra/src/geometry/rot2.rs | use crate::utils::WgTrig;
use wgcore::Shader;
#[derive(Shader)]
#[shader(derive(WgTrig), src = "rot2.wgsl")]
/// Shader exposing a 2D rotation type and operations.
pub struct WgRot2;
wgcore::test_shader_compilation!(WgRot2);
| rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/geometry/eig3.rs | crates/wgebra/src/geometry/eig3.rs | use crate::utils::WgMinMax;
use crate::{WgRot2, WgSymmetricEigen2};
use nalgebra::{Matrix3, Vector3};
use wgcore::{test_shader_compilation, Shader};
#[cfg(test)]
use {
naga_oil::compose::NagaModuleDescriptor,
wgpu::{ComputePipeline, Device},
};
#[derive(Copy, Clone, Debug, encase::ShaderType)]
#[repr(C)]
/// G... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/geometry/qr2.rs | crates/wgebra/src/geometry/qr2.rs | use nalgebra::Matrix2;
use wgcore::{test_shader_compilation, Shader};
#[cfg(test)]
use {
naga_oil::compose::NagaModuleDescriptor,
wgpu::{ComputePipeline, Device},
};
#[derive(Copy, Clone, Debug, bytemuck::Pod, bytemuck::Zeroable)]
#[repr(C)]
/// GPU representation of a 2x2 matrix QR decomposition.
///
/// See ... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/geometry/sim3.rs | crates/wgebra/src/geometry/sim3.rs | use crate::WgQuat;
use nalgebra::Similarity3;
use wgcore::Shader;
/// A GPU-compatible 3d similarity (uniform scale + rotation + translation).
pub type GpuSim3 = Similarity3<f32>;
#[derive(Shader)]
#[shader(derive(WgQuat), src = "sim3.wgsl")]
/// Shader exposing a 2D similarity (uniform scale + rotation + translation... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/geometry/svd2.rs | crates/wgebra/src/geometry/svd2.rs | use crate::utils::WgTrig;
use nalgebra::{Matrix2, Vector2};
use wgcore::Shader;
#[cfg(test)]
use {
naga_oil::compose::NagaModuleDescriptor,
wgpu::{ComputePipeline, Device},
};
#[derive(Copy, Clone, bytemuck::Pod, bytemuck::Zeroable)]
#[repr(C)]
/// GPU representation of a 2x2 matrix SVD.
pub struct GpuSvd2 {
... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/geometry/cholesky.rs | crates/wgebra/src/geometry/cholesky.rs | use wgcore::{test_shader_compilation, Shader};
fn substitute2(src: &str) -> String {
src.replace("DIM", "2")
.replace("MAT", "mat2x2<f32>")
.replace("IMPORT_PATH", "wgebra::cholesky2")
}
fn substitute3(src: &str) -> String {
src.replace("DIM", "3")
.replace("MAT", "mat3x3<f32>")
... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/geometry/sim2.rs | crates/wgebra/src/geometry/sim2.rs | use crate::WgRot2;
use nalgebra::{Isometry2, Similarity2};
use wgcore::Shader;
#[derive(Copy, Clone, PartialEq, Debug, Default, bytemuck::Pod, bytemuck::Zeroable)]
#[repr(C)]
/// A GPU-compatible 2D similarity (uniform scale + rotation + translation).
pub struct GpuSim2 {
/// The similarity value.
pub similari... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/geometry/eig2.rs | crates/wgebra/src/geometry/eig2.rs | use nalgebra::{Matrix2, Vector2};
use wgcore::Shader;
#[cfg(test)]
use {
crate::utils::WgTrig,
naga_oil::compose::NagaModuleDescriptor,
wgpu::{ComputePipeline, Device},
};
#[derive(Copy, Clone, bytemuck::Pod, bytemuck::Zeroable)]
#[repr(C)]
/// GPU representation of a symmetric 2x2 matrix eigendecompositio... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/geometry/eig4.rs | crates/wgebra/src/geometry/eig4.rs | use crate::utils::WgMinMax;
use crate::{WgRot2, WgSymmetricEigen2};
use nalgebra::{Matrix4, Vector4};
use wgcore::{test_shader_compilation, Shader};
#[cfg(test)]
use {
naga_oil::compose::NagaModuleDescriptor,
wgpu::{ComputePipeline, Device},
};
#[derive(Copy, Clone, Debug, bytemuck::Pod, bytemuck::Zeroable)]
#... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/utils/mod.rs | crates/wgebra/src/utils/mod.rs | //! Utilities to address some platform-dependent differences
//! (e.g. for some trigonometric functions).
pub use self::min_max::WgMinMax;
pub use self::trig::WgTrig;
mod min_max;
mod trig;
| rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/utils/min_max.rs | crates/wgebra/src/utils/min_max.rs | use wgcore::Shader;
/// Helper shader functions for calculating the min/max elements of a vector or matrix.
#[derive(Shader)]
#[shader(src = "min_max.wgsl")]
pub struct WgMinMax;
| rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/utils/trig.rs | crates/wgebra/src/utils/trig.rs | use wgcore::Shader;
/// Alternative implementations of some geometric functions on the gpu.
///
/// Some platforms (Metal in particular) has implementations of some trigonometric functions
/// that are not numerically stable. This is the case for example for `atan2` and `atanh` that
/// may occasionally lead to NaNs. ... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/linalg/shape.rs | crates/wgebra/src/linalg/shape.rs | use naga_oil::compose::ShaderDefValue;
use std::collections::HashMap;
use wgcore::Shader;
#[derive(Shader)]
#[shader(src = "shape.wgsl")]
/// A shader for handling matrix/vector indexing based on their shape of type
/// [`wgcore::shapes::ViewShape`].
pub struct Shape;
/// Shader definitions setting the `ROW_MAJOR` bo... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/linalg/op_assign.rs | crates/wgebra/src/linalg/op_assign.rs | use crate::linalg::shape::Shape;
use bytemuck::Pod;
use naga_oil::compose::{ComposerError, NagaModuleDescriptor};
use naga_oil::redirect::Redirector;
use wgcore::kernel::KernelDispatch;
use wgcore::shapes::ViewShapeBuffers;
use wgcore::tensor::GpuVectorView;
use wgcore::utils;
use wgcore::Shader;
use wgpu::{ComputePass... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/linalg/reduce.rs | crates/wgebra/src/linalg/reduce.rs | use crate::linalg::shape::Shape;
use bytemuck::Pod;
use naga_oil::compose::{ComposerError, NagaModuleDescriptor};
use naga_oil::redirect::Redirector;
use nalgebra::DVector;
use wgcore::kernel::KernelDispatch;
use wgcore::shapes::ViewShapeBuffers;
use wgcore::tensor::{GpuScalar, GpuVectorView};
use wgcore::utils;
use wg... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/linalg/mod.rs | crates/wgebra/src/linalg/mod.rs | //! Fundamental linear-algebra matrix/vector operations.
mod gemm;
mod gemv;
mod op_assign;
mod reduce;
mod shape;
pub use gemm::{Gemm, GemmVariant};
pub use gemv::{Gemv, GemvVariant};
pub use op_assign::{OpAssign, OpAssignVariant};
pub use reduce::{Reduce, ReduceOp};
pub use shape::{row_major_shader_defs, Shape};
| rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/linalg/gemv.rs | crates/wgebra/src/linalg/gemv.rs | use crate::linalg::shape::Shape;
use bytemuck::Pod;
use wgcore::kernel::KernelDispatch;
use wgcore::shapes::ViewShapeBuffers;
use wgcore::tensor::GpuCubeView;
use wgcore::Shader;
use wgpu::{ComputePass, ComputePipeline, Device};
#[derive(Shader)]
#[shader(derive(Shape), src = "gemv.wgsl", composable = false)]
/// Shad... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgebra/src/linalg/gemm.rs | crates/wgebra/src/linalg/gemm.rs | use crate::linalg::shape::Shape;
use bytemuck::Pod;
use wgcore::kernel::KernelDispatch;
use wgcore::shapes::ViewShapeBuffers;
use wgcore::tensor::GpuCubeView;
use wgcore::Shader;
use wgpu::{ComputePass, ComputePipeline, Device};
#[derive(Shader)]
#[shader(derive(Shape), src = "gemm.wgsl", composable = false)]
/// Shad... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgcore/src/hot_reloading.rs | crates/wgcore/src/hot_reloading.rs | //! Utility to detect changed files for shader hot-reloading.
use async_channel::Receiver;
use notify::{Event, EventKind};
use std::collections::HashMap;
use std::path::{Path, PathBuf};
#[cfg(not(target_family = "wasm"))]
use notify::Watcher;
#[cfg(doc)]
use crate::Shader;
/// State for tracking file changes.
pub s... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgcore/src/lib.rs | crates/wgcore/src/lib.rs | #![doc = include_str!("../README.md")]
// #![warn(missing_docs)]
#![allow(clippy::result_large_err)]
pub mod composer;
pub mod gpu;
pub mod hot_reloading;
pub mod indirect;
pub mod kernel;
pub mod shader;
pub mod shapes;
pub mod tensor;
pub mod timestamps;
pub mod utils;
pub use bytemuck::Pod;
pub use shader::{Shade... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgcore/src/gpu.rs | crates/wgcore/src/gpu.rs | //! Utilities struct to initialize a gpu device.
use std::sync::Arc;
use wgpu::{Adapter, Backends, Device, Instance, InstanceDescriptor, Queue};
/// Helper struct to initialize a device and its queue.
pub struct GpuInstance {
_instance: Instance, // TODO: do we have to keep this around?
adapter: Adapter, /... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgcore/src/kernel.rs | crates/wgcore/src/kernel.rs | //! Utilities for queueing and dispatching kernels.
use crate::timestamps::GpuTimestamps;
use std::sync::Arc;
use wgpu::{Buffer, CommandEncoder, ComputePass, ComputePassDescriptor, ComputePipeline, Device};
pub trait CommandEncoderExt {
fn compute_pass<'encoder>(
&'encoder mut self,
label: &str,
... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgcore/src/tensor.rs | crates/wgcore/src/tensor.rs | //! Utilities for initializing and slicing tensors, matrices, vectors, and scalars gpu storage
//! buffers.
use crate::gpu::GpuInstance;
use crate::shapes::ViewShape;
use bytemuck::Pod;
use encase::internal::{CreateFrom, ReadFrom, WriteInto};
use encase::{ShaderSize, ShaderType, StorageBuffer};
use nalgebra::{Dim, IsC... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgcore/src/indirect.rs | crates/wgcore/src/indirect.rs | #[derive(Copy, Clone, Debug, PartialEq, Eq, bytemuck::Pod, bytemuck::Zeroable)]
#[repr(C)]
pub struct DispatchIndirectArgs {
pub x: u32,
pub y: u32,
pub z: u32,
}
#[cfg(feature = "derive")]
use crate::Shader;
#[cfg(feature = "derive")]
#[derive(Shader)]
#[shader(src = "indirect.wgsl", krate = "crate")]
pu... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgcore/src/utils.rs | crates/wgcore/src/utils.rs | //! Utilities for creating a ComputePipeline from source or from a naga module.
use wgpu::naga::Module;
use wgpu::{
ComputePipeline, ComputePipelineDescriptor, Device, PipelineCompilationOptions,
ShaderRuntimeChecks,
};
/// Creates a compute pipeline from the shader sources `content` and the name of its `entr... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgcore/src/composer.rs | crates/wgcore/src/composer.rs | //! Extensions over naga-oil’s Composer.
use naga_oil::compose::{
ComposableModuleDefinition, ComposableModuleDescriptor, Composer, ComposerError,
};
/// An extension trait for the naga-oil `Composer` to work around some of its limitations.
pub trait ComposerExt {
/// Adds a composable module to `self` only i... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgcore/src/shapes.rs | crates/wgcore/src/shapes.rs | //! Tensor shape definition.
use crate::tensor::MatrixOrdering;
use dashmap::DashMap;
use std::sync::{Arc, Mutex};
use wgpu::util::{BufferInitDescriptor, DeviceExt};
use wgpu::{Buffer, BufferUsages, Device, Queue};
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, bytemuck::Pod, bytemuck::Zeroable)]
#[repr(C)]
/// Th... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgcore/src/shader.rs | crates/wgcore/src/shader.rs | //! Trait for reusable gpu shaders.
use crate::hot_reloading::HotReloadState;
use dashmap::DashMap;
use naga_oil::compose::{Composer, ComposerError};
use std::any::TypeId;
use std::path::{Path, PathBuf};
use std::sync::OnceLock;
use wgpu::naga::Module;
use wgpu::{Device, Label, ShaderModule, ShaderRuntimeChecks};
///... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgcore/src/timestamps.rs | crates/wgcore/src/timestamps.rs | //! A convenient wrapper for handling gpu timestamps.
//!
//! Note that this is strongly inspired from wgpu’s timestamp queries example:
//! <https://github.com/gfx-rs/wgpu/blob/trunk/examples/src/timestamp_queries/mod.rs>
use wgpu::{BufferAsyncError, ComputePass, ComputePassTimestampWrites, Device, QuerySet, Queue};
... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgcore/examples/hot_reloading.rs | crates/wgcore/examples/hot_reloading.rs | #[cfg(not(feature = "derive"))]
std::compile_error!(
r#"
###############################################################
## The `derive` feature must be enabled to run this example. ##
###############################################################
"#
);
use wgcore::gpu::GpuInstance;
use wgcore::hot_re... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgcore/examples/timestamp_queries.rs | crates/wgcore/examples/timestamp_queries.rs | #[cfg(not(feature = "derive"))]
std::compile_error!(
r#"
###############################################################
## The `derive` feature must be enabled to run this example. ##
###############################################################
"#
);
use wgcore::gpu::GpuInstance;
use wgcore::hot_re... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgcore/examples/overwrite.rs | crates/wgcore/examples/overwrite.rs | #[cfg(not(feature = "derive"))]
std::compile_error!(
r#"
###############################################################
## The `derive` feature must be enabled to run this example. ##
###############################################################
"#
);
use nalgebra::DVector;
use std::fmt::Debug;
use ... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgcore/examples/compose.rs | crates/wgcore/examples/compose.rs | #[cfg(not(feature = "derive"))]
std::compile_error!(
r#"
###############################################################
## The `derive` feature must be enabled to run this example. ##
###############################################################
"#
);
use nalgebra::DVector;
use std::fmt::Debug;
use ... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgcore/examples/buffer_readback.rs | crates/wgcore/examples/buffer_readback.rs | use nalgebra::DVector;
use wgcore::gpu::GpuInstance;
use wgcore::tensor::GpuVector;
use wgpu::BufferUsages;
#[async_std::main]
async fn main() -> anyhow::Result<()> {
// Initialize the gpu device and its queue.
//
// Note that `GpuInstance` is just a simple helper struct for initializing the gpu resources.... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgcore/examples/encase.rs | crates/wgcore/examples/encase.rs | #[cfg(not(feature = "derive"))]
std::compile_error!(
r#"
###############################################################
## The `derive` feature must be enabled to run this example. ##
###############################################################
"#
);
use nalgebra::Vector4;
use wgcore::gpu::GpuInsta... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgcore-derive/src/lib.rs | crates/wgcore-derive/src/lib.rs | //! Derive proc-macros for `wgcore`.
extern crate proc_macro;
use darling::util::PathList;
use darling::{FromDeriveInput, FromField};
use proc_macro::TokenStream;
use quote::{quote, ToTokens};
use syn::{Data, DataStruct, Path};
#[derive(FromDeriveInput, Clone)]
#[darling(attributes(shader))]
struct DeriveShadersArgs... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/src/lib.rs | crates/wgrapier/src/lib.rs | //! GPU-accelerated rigid-body physics engine built on WebGPU/WGSL.
//!
//! **wgrapier** provides a high-performance physics simulation system that runs entirely on the GPU,
//! enabling massively parallel physics computation for thousands of rigid bodies. It is designed to
//! work seamlessly across platforms includin... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/src/pipeline.rs | crates/wgrapier/src/pipeline.rs | //! Physics simulation pipeline orchestrating broad-phase, narrow-phase, and constraint solving.
//!
//! This module provides the high-level physics pipeline that coordinates all stages of a physics
//! simulation step on the GPU. The pipeline manages collision detection, contact generation,
//! constraint solving, and... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/src/dynamics/coloring.rs | crates/wgrapier/src/dynamics/coloring.rs | //! Graph coloring algorithms for parallel constraint solving.
//!
//! This module implements two graph coloring algorithms that enable parallel constraint solving
//! on the GPU:
//!
//! # TOPO-GC (Topological Graph Coloring)
//!
//! A fast, coloring algorithm that typically produces fewer colors and converges
//! in ... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/src/dynamics/solver.rs | crates/wgrapier/src/dynamics/solver.rs | //! GPU-parallel constraint solver using graph coloring.
//!
//! This module implements a constraint-based physics solver that runs entirely on the GPU.
//! It uses graph coloring to enable parallel constraint solving while avoiding data races.
//!
//! # Solver Variants
//!
//! The module supports two main solver algor... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/src/dynamics/joint.rs | crates/wgrapier/src/dynamics/joint.rs | use crate::dynamics::{
GpuLocalMassProperties, GpuSimParams, GpuVelocity, GpuWorldMassProperties, WgBody, WgSimParams,
};
use encase::ShaderType;
use nalgebra::Vector2;
use rapier::dynamics::{
GenericJoint, ImpulseJoint, ImpulseJointSet, JointLimits, JointMotor, RigidBodyHandle,
};
use rapier::math::SPATIAL_DIM... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/src/dynamics/warmstart.rs | crates/wgrapier/src/dynamics/warmstart.rs | //! Warmstarting mechanism for constraint solver temporal coherence.
//!
//! Warmstarting reuses impulses from the previous simulation frame to initialize the
//! constraint solver, significantly improving convergence speed and stability. This exploits
//! temporal coherence - the observation that adjacent frames in a ... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/src/dynamics/mod.rs | crates/wgrapier/src/dynamics/mod.rs | //! Rigid-body dynamics: forces, velocities, constraints, and solvers.
//!
//! This module contains all the components needed for simulating rigid-body dynamics on the GPU:
//!
//! # Core Components
//!
//! - **body**: Rigid body definitions including mass properties, velocities, and poses
//! - **constraint**: Contact... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/src/dynamics/mprops_update.rs | crates/wgrapier/src/dynamics/mprops_update.rs | //! Rigid-bodies world-space mass properties calculation.
use crate::dynamics::{WgBody, WgSimParams};
use wgcore::Shader;
use wgparry::{dim_shader_defs, substitute_aliases};
use wgpu::ComputePipeline;
/// GPU shader for updating the world-space mass properties of rigid-bodies.
#[derive(Shader)]
#[shader(
derive(W... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/src/dynamics/body.rs | crates/wgrapier/src/dynamics/body.rs | //! Rigid-body definitions, mass properties, velocities, and GPU storage.
//!
//! This module provides the core data structures for representing rigid bodies on the GPU,
//! including their poses, velocities, forces, and mass properties. It also provides
//! [`GpuBodySet`] for managing collections of rigid bodies in GP... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/src/dynamics/prefix_sum.rs | crates/wgrapier/src/dynamics/prefix_sum.rs | //! GPU parallel prefix sum (scan) algorithm.
//!
//! This module implements an efficient parallel prefix sum on the GPU using a work-efficient
//! algorithm. Prefix sum is a fundamental parallel primitive used throughout the physics engine.
//!
//! # What is Prefix Sum?
//!
//! Given an input array `[a₀, a₁, a₂, ..., ... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/src/dynamics/constraint.rs | crates/wgrapier/src/dynamics/constraint.rs | //! Contact constraints for collision resolution.
//!
//! This module defines the constraint structures used to resolve collisions between rigid bodies.
//! Constraints are generated from contact manifolds and solved iteratively to compute impulses
//! that prevent penetration and simulate friction.
use encase::Shader... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/src/dynamics/sim_params.rs | crates/wgrapier/src/dynamics/sim_params.rs | //! Simulation parameters controlling physics behavior and solver settings.
//!
//! This module defines the parameters that control how the physics engine behaves,
//! including timestep length, solver iterations, contact compliance, and various
//! tolerances and thresholds.
use wgcore::Shader;
/// WGSL shader defin... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/src_testbed/lib.rs | crates/wgrapier/src_testbed/lib.rs | #![allow(clippy::result_large_err)]
#![allow(clippy::too_many_arguments)]
#[cfg(feature = "dim2")]
use rapier2d as rapier;
#[cfg(feature = "dim3")]
use rapier3d as rapier;
#[cfg(feature = "dim2")]
use wgrapier2d as wgrapier;
#[cfg(feature = "dim3")]
use wgrapier3d as wgrapier;
mod backend;
mod graphics;
mod ui;
use ... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/src_testbed/graphics.rs | crates/wgrapier/src_testbed/graphics.rs | #[cfg(feature = "dim2")]
use rapier2d as rapier;
#[cfg(feature = "dim3")]
use rapier3d as rapier;
use crate::backend::PhysicsBackend;
use crate::SimulationState;
use kiss3d::nalgebra::Point3;
#[cfg(feature = "dim3")]
use kiss3d::prelude::InstanceData;
#[cfg(feature = "dim3")]
use kiss3d::scene::SceneNode;
use kiss3d::... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/src_testbed/ui.rs | crates/wgrapier/src_testbed/ui.rs | #[cfg(feature = "dim2")]
use wgrapier2d as wgrapier;
#[cfg(feature = "dim3")]
use wgrapier3d as wgrapier;
use crate::backend::{BackendType, PhysicsBackend};
use crate::SimulationBuilders;
use kiss3d::egui::CollapsingHeader;
use kiss3d::window::Window;
use wgcore::gpu::GpuInstance;
use wgcore::timestamps::GpuTimestamps... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/src_testbed/backend/gpu.rs | crates/wgrapier/src_testbed/backend/gpu.rs | #[cfg(feature = "dim2")]
use wgrapier2d as wgrapier;
#[cfg(feature = "dim3")]
use wgrapier3d as wgrapier;
use super::SimulationBackend;
use crate::SimulationState;
use wgcore::gpu::GpuInstance;
use wgcore::tensor::GpuVector;
use wgcore::timestamps::GpuTimestamps;
use wgpu::BufferUsages;
use wgrapier::pipeline::{GpuPhy... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/src_testbed/backend/mod.rs | crates/wgrapier/src_testbed/backend/mod.rs | mod cpu;
mod gpu;
pub use cpu::CpuBackend;
pub use gpu::GpuBackend;
#[cfg(feature = "dim2")]
use wgrapier2d as wgrapier;
#[cfg(feature = "dim3")]
use wgrapier3d as wgrapier;
use wgcore::gpu::GpuInstance;
use wgcore::timestamps::GpuTimestamps;
use wgrapier::pipeline::RunStats;
use wgrapier::wgparry::math::GpuSim;
#[... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/src_testbed/backend/cpu.rs | crates/wgrapier/src_testbed/backend/cpu.rs | #[cfg(feature = "dim2")]
use rapier2d as rapier;
#[cfg(feature = "dim3")]
use rapier3d as rapier;
#[cfg(feature = "dim2")]
use wgrapier2d as wgrapier;
#[cfg(feature = "dim3")]
use wgrapier3d as wgrapier;
use super::SimulationBackend;
use crate::SimulationState;
#[cfg(feature = "dim2")]
use nalgebra::Similarity2;
#[cfg... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/crates/examples2d/all_examples2.rs | crates/wgrapier/crates/examples2d/all_examples2.rs | #![allow(dead_code)]
use std::cmp::Ordering;
use wgrapier_testbed2d::{SimulationState, Testbed};
mod balls2;
mod boxes2;
mod boxes_and_balls2;
mod joint_ball2;
mod joint_fixed2;
mod joint_prismatic2;
mod polyline2;
mod primitives2;
mod pyramid2;
fn demo_name_from_command_line() -> Option<String> {
let mut args =... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/crates/examples2d/joint_ball2.rs | crates/wgrapier/crates/examples2d/joint_ball2.rs | use rapier2d::prelude::*;
use wgrapier_testbed2d::SimulationState;
pub fn init_world() -> SimulationState {
/*
* World
*/
let mut bodies = RigidBodySet::new();
let mut colliders = ColliderSet::new();
let mut impulse_joints = ImpulseJointSet::new();
/*
* Create the balls
*/
... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/crates/examples2d/pyramid2.rs | crates/wgrapier/crates/examples2d/pyramid2.rs | use rapier2d::prelude::*;
use wgrapier_testbed2d::SimulationState;
pub fn init_world() -> SimulationState {
/*
* World
*/
let mut bodies = RigidBodySet::new();
let mut colliders = ColliderSet::new();
let impulse_joints = ImpulseJointSet::new();
let _multibody_joints = MultibodyJointSet::n... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/crates/examples2d/joint_prismatic2.rs | crates/wgrapier/crates/examples2d/joint_prismatic2.rs | use rapier2d::prelude::*;
use wgrapier_testbed2d::SimulationState;
pub fn init_world() -> SimulationState {
/*
* World
*/
let mut bodies = RigidBodySet::new();
let mut colliders = ColliderSet::new();
let mut impulse_joints = ImpulseJointSet::new();
/*
* Create the balls
*/
... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/crates/examples2d/boxes2.rs | crates/wgrapier/crates/examples2d/boxes2.rs | use rapier2d::prelude::*;
use wgrapier_testbed2d::SimulationState;
pub fn init_world() -> SimulationState {
/*
* World
*/
let mut bodies = RigidBodySet::new();
let mut colliders = ColliderSet::new();
let impulse_joints = ImpulseJointSet::new();
let _multibody_joints = MultibodyJointSet::n... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/crates/examples2d/polyline2.rs | crates/wgrapier/crates/examples2d/polyline2.rs | use rapier2d::prelude::*;
use wgrapier_testbed2d::SimulationState;
pub fn init_world() -> SimulationState {
/*
* World
*/
let mut bodies = RigidBodySet::new();
let mut colliders = ColliderSet::new();
let impulse_joints = ImpulseJointSet::new();
let _multibody_joints = MultibodyJointSet::n... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/crates/examples2d/balls2.rs | crates/wgrapier/crates/examples2d/balls2.rs | use rapier2d::prelude::*;
use wgrapier_testbed2d::SimulationState;
pub fn init_world() -> SimulationState {
/*
* World
*/
let mut bodies = RigidBodySet::new();
let mut colliders = ColliderSet::new();
let impulse_joints = ImpulseJointSet::new();
let _multibody_joints = MultibodyJointSet::n... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/crates/examples2d/boxes_and_balls2.rs | crates/wgrapier/crates/examples2d/boxes_and_balls2.rs | use rapier2d::prelude::*;
use wgrapier_testbed2d::SimulationState;
pub fn init_world() -> SimulationState {
/*
* World
*/
let mut bodies = RigidBodySet::new();
let mut colliders = ColliderSet::new();
let impulse_joints = ImpulseJointSet::new();
let _multibody_joints = MultibodyJointSet::n... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/crates/examples2d/joint_fixed2.rs | crates/wgrapier/crates/examples2d/joint_fixed2.rs | use rapier2d::prelude::*;
use wgrapier_testbed2d::SimulationState;
pub fn init_world() -> SimulationState {
/*
* World
*/
let mut bodies = RigidBodySet::new();
let mut colliders = ColliderSet::new();
let mut impulse_joints = ImpulseJointSet::new();
/*
* Create the balls
*/
... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/crates/examples2d/primitives2.rs | crates/wgrapier/crates/examples2d/primitives2.rs | use rapier2d::prelude::*;
use wgrapier_testbed2d::SimulationState;
pub fn init_world() -> SimulationState {
/*
* World
*/
let mut bodies = RigidBodySet::new();
let mut colliders = ColliderSet::new();
let impulse_joints = ImpulseJointSet::new();
let _multibody_joints = MultibodyJointSet::n... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/crates/examples3d/many_pyramids3.rs | crates/wgrapier/crates/examples3d/many_pyramids3.rs | use rapier3d::prelude::*;
use wgrapier_testbed3d::SimulationState;
fn create_pyramid(
bodies: &mut RigidBodySet,
colliders: &mut ColliderSet,
offset: Vector<f32>,
stack_height: usize,
rad: f32,
) {
let shift = rad * 2.0;
for i in 0usize..stack_height {
for j in i..stack_height {
... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/crates/examples3d/all_examples3.rs | crates/wgrapier/crates/examples3d/all_examples3.rs | #![allow(dead_code)]
use inflector::Inflector;
use std::cmp::Ordering;
use wgrapier_testbed3d::{SimulationState, Testbed};
mod balls3;
mod boxes3;
mod boxes_and_balls3;
mod joint_ball3;
mod joint_fixed3;
mod joint_prismatic3;
mod joint_revolute3;
mod keva3;
mod many_pyramids3;
mod primitives3;
mod pyramid3;
mod trim... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/crates/examples3d/keva3.rs | crates/wgrapier/crates/examples3d/keva3.rs | use rapier3d::prelude::*;
use wgrapier_testbed3d::SimulationState;
pub fn build_block(
bodies: &mut RigidBodySet,
colliders: &mut ColliderSet,
half_extents: Vector<f32>,
shift: Vector<f32>,
(mut numx, numy, mut numz): (usize, usize, usize),
) {
let dimensions = [half_extents.xyz(), half_extents... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/crates/examples3d/joint_prismatic3.rs | crates/wgrapier/crates/examples3d/joint_prismatic3.rs | use rapier3d::prelude::*;
use wgrapier_testbed3d::SimulationState;
pub fn init_world() -> SimulationState {
/*
* World
*/
let mut bodies = RigidBodySet::new();
let mut colliders = ColliderSet::new();
let mut impulse_joints = ImpulseJointSet::new();
let rad = 0.4;
let num = 10;
le... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/crates/examples3d/primitives3.rs | crates/wgrapier/crates/examples3d/primitives3.rs | use rapier3d::na::Vector3;
use rapier3d::prelude::*;
use wgrapier_testbed3d::SimulationState;
pub fn init_world() -> SimulationState {
const NXZ: isize = 20;
const NY: isize = 40;
let mut bodies = RigidBodySet::default();
let mut colliders = ColliderSet::default();
let impulse_joints = ImpulseJoin... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/crates/examples3d/balls3.rs | crates/wgrapier/crates/examples3d/balls3.rs | use rapier3d::na::Vector3;
use rapier3d::prelude::*;
use wgrapier_testbed3d::SimulationState;
pub fn init_world() -> SimulationState {
const NXZ: isize = 30;
const NY: isize = 70;
let mut bodies = RigidBodySet::default();
let mut colliders = ColliderSet::default();
let impulse_joints = ImpulseJoin... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/crates/examples3d/boxes_and_balls3.rs | crates/wgrapier/crates/examples3d/boxes_and_balls3.rs | use rapier3d::na::Vector3;
use rapier3d::prelude::*;
use wgrapier_testbed3d::SimulationState;
pub fn init_world() -> SimulationState {
const NXZ: isize = 30;
const NY: isize = 70;
let mut bodies = RigidBodySet::default();
let mut colliders = ColliderSet::default();
let impulse_joints = ImpulseJoin... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/crates/examples3d/joint_revolute3.rs | crates/wgrapier/crates/examples3d/joint_revolute3.rs | use rapier3d::prelude::*;
use wgrapier_testbed3d::SimulationState;
pub fn init_world() -> SimulationState {
/*
* World
*/
let mut bodies = RigidBodySet::new();
let mut colliders = ColliderSet::new();
let mut impulse_joints = ImpulseJointSet::new();
let rad = 0.4;
let num = 10;
le... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/crates/examples3d/boxes3.rs | crates/wgrapier/crates/examples3d/boxes3.rs | use rapier3d::na::Vector3;
use rapier3d::prelude::*;
use wgrapier_testbed3d::SimulationState;
pub fn init_world() -> SimulationState {
const NXZ: isize = 30;
const NY: isize = 70;
let mut bodies = RigidBodySet::default();
let mut colliders = ColliderSet::default();
let impulse_joints = ImpulseJoin... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/crates/examples3d/joint_fixed3.rs | crates/wgrapier/crates/examples3d/joint_fixed3.rs | use rapier3d::prelude::*;
use wgrapier_testbed3d::SimulationState;
pub fn init_world() -> SimulationState {
/*
* World
*/
let mut bodies = RigidBodySet::new();
let mut colliders = ColliderSet::new();
let mut impulse_joints = ImpulseJointSet::new();
let rad = 0.4;
let num = 10;
le... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/crates/examples3d/trimesh3.rs | crates/wgrapier/crates/examples3d/trimesh3.rs | use rapier3d::na::Vector3;
use rapier3d::prelude::*;
use wgrapier_testbed3d::SimulationState;
pub fn init_world() -> SimulationState {
const NXZ: isize = 20;
const NY: isize = 40;
let mut bodies = RigidBodySet::default();
let mut colliders = ColliderSet::default();
let impulse_joints = ImpulseJoin... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/crates/examples3d/joint_ball3.rs | crates/wgrapier/crates/examples3d/joint_ball3.rs | use rapier3d::prelude::*;
use wgrapier_testbed3d::SimulationState;
pub fn init_world() -> SimulationState {
/*
* World
*/
let mut bodies = RigidBodySet::new();
let mut colliders = ColliderSet::new();
let mut impulse_joints = ImpulseJointSet::new();
let rad = 0.4;
let ni = 200;
le... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
wgmath/wgmath | https://github.com/wgmath/wgmath/blob/ac89dceb8a33778e895303cd606da38afb015192/crates/wgrapier/crates/examples3d/pyramid3.rs | crates/wgrapier/crates/examples3d/pyramid3.rs | use rapier3d::prelude::*;
use wgrapier_testbed3d::SimulationState;
fn create_pyramid(
bodies: &mut RigidBodySet,
colliders: &mut ColliderSet,
offset: Vector<f32>,
stack_height: usize,
half_extents: Vector<f32>,
) {
let shift = half_extents * 2.5;
for i in 0usize..stack_height {
for ... | rust | Apache-2.0 | ac89dceb8a33778e895303cd606da38afb015192 | 2026-01-04T20:20:10.684006Z | false |
ribru17/ts_query_ls | https://github.com/ribru17/ts_query_ls/blob/40593cb9158dbafb6c1f2e89b24629d8b1d16a8f/src/test_helpers.rs | src/test_helpers.rs | #[cfg(test)]
pub mod helpers {
use dashmap::DashMap;
use serde_json::{Value, to_value};
use std::sync::{Arc, LazyLock, Mutex};
use tower::{Service, ServiceExt};
use tower_lsp::{
LspService,
jsonrpc::{Request, Response},
lsp_types::{
ClientCapabilities, DidOpenTe... | rust | MIT | 40593cb9158dbafb6c1f2e89b24629d8b1d16a8f | 2026-01-04T20:20:11.073589Z | false |
ribru17/ts_query_ls | https://github.com/ribru17/ts_query_ls/blob/40593cb9158dbafb6c1f2e89b24629d8b1d16a8f/src/lib.rs | src/lib.rs | use std::{
collections::{BTreeMap, HashMap},
env,
fmt::{Display, Write as _},
sync::LazyLock,
};
use regex::Regex;
#[cfg(feature = "schema")]
use schemars::JsonSchema;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
static LANGUAGE_REGEX_1: LazyLock<Regex> =
LazyLock::new(|| Regex::... | rust | MIT | 40593cb9158dbafb6c1f2e89b24629d8b1d16a8f | 2026-01-04T20:20:11.073589Z | false |
ribru17/ts_query_ls | https://github.com/ribru17/ts_query_ls/blob/40593cb9158dbafb6c1f2e89b24629d8b1d16a8f/src/util.rs | src/util.rs | use std::{
cell::RefCell,
fs::{self},
path::{Path, PathBuf},
sync::LazyLock,
};
use regex::Regex;
use ropey::Rope;
use serde_json::Value;
use streaming_iterator::StreamingIterator;
use tower_lsp::{
LanguageServer,
lsp_types::{
DocumentDiagnosticParams, DocumentDiagnosticReport, Document... | rust | MIT | 40593cb9158dbafb6c1f2e89b24629d8b1d16a8f | 2026-01-04T20:20:11.073589Z | false |
ribru17/ts_query_ls | https://github.com/ribru17/ts_query_ls/blob/40593cb9158dbafb6c1f2e89b24629d8b1d16a8f/src/main.rs | src/main.rs | use clap::{Parser, Subcommand};
use cli::{
check::check_directories, format::format_directories, lint::lint_directories,
profile::profile_directories,
};
use core::fmt;
use std::{
collections::{BTreeSet, HashMap, HashSet},
env,
fs::{self},
path::{Path, PathBuf},
str,
sync::{Arc, LazyLock... | rust | MIT | 40593cb9158dbafb6c1f2e89b24629d8b1d16a8f | 2026-01-04T20:20:11.073589Z | false |
ribru17/ts_query_ls | https://github.com/ribru17/ts_query_ls/blob/40593cb9158dbafb6c1f2e89b24629d8b1d16a8f/src/logging.rs | src/logging.rs | use tower_lsp::Client;
use tower_lsp::lsp_types::MessageType;
use tracing::field::Field;
use tracing::{Event, Level, Subscriber};
use tracing_subscriber::layer::{Context, Layer};
use tracing_subscriber::registry::LookupSpan;
pub struct LspLogLayer(Client);
impl LspLogLayer {
pub const fn new(client: Client) -> Se... | rust | MIT | 40593cb9158dbafb6c1f2e89b24629d8b1d16a8f | 2026-01-04T20:20:11.073589Z | false |
ribru17/ts_query_ls | https://github.com/ribru17/ts_query_ls/blob/40593cb9158dbafb6c1f2e89b24629d8b1d16a8f/src/handlers/document_symbol.rs | src/handlers/document_symbol.rs | use tower_lsp::lsp_types::{
DocumentSymbol, DocumentSymbolParams, DocumentSymbolResponse, SymbolKind,
};
use tracing::warn;
use tree_sitter::{QueryCursor, StreamingIterator};
use crate::{
Backend, LspClient,
util::{CAPTURES_QUERY, NodeUtil, TextProviderRope},
};
pub fn document_symbol<C: LspClient>(
b... | rust | MIT | 40593cb9158dbafb6c1f2e89b24629d8b1d16a8f | 2026-01-04T20:20:11.073589Z | false |
ribru17/ts_query_ls | https://github.com/ribru17/ts_query_ls/blob/40593cb9158dbafb6c1f2e89b24629d8b1d16a8f/src/handlers/workspace_symbol.rs | src/handlers/workspace_symbol.rs | use std::fs;
use ropey::Rope;
use tower_lsp::{
jsonrpc::Result,
lsp_types::{
Location, ProgressParams, ProgressParamsValue, SymbolInformation, SymbolKind, Url,
WorkDoneProgress, WorkDoneProgressBegin, WorkDoneProgressEnd, WorkDoneProgressReport,
WorkspaceSymbolParams, notification::Prog... | rust | MIT | 40593cb9158dbafb6c1f2e89b24629d8b1d16a8f | 2026-01-04T20:20:11.073589Z | false |
ribru17/ts_query_ls | https://github.com/ribru17/ts_query_ls/blob/40593cb9158dbafb6c1f2e89b24629d8b1d16a8f/src/handlers/did_change_configuration.rs | src/handlers/did_change_configuration.rs | use tower_lsp::lsp_types::DidChangeConfigurationParams;
use crate::{Backend, LspClient, util::set_configuration_options};
pub async fn did_change_configuration<C: LspClient>(
backend: &Backend<C>,
params: DidChangeConfigurationParams,
) {
set_configuration_options(
backend,
Some(params.set... | rust | MIT | 40593cb9158dbafb6c1f2e89b24629d8b1d16a8f | 2026-01-04T20:20:11.073589Z | false |
ribru17/ts_query_ls | https://github.com/ribru17/ts_query_ls/blob/40593cb9158dbafb6c1f2e89b24629d8b1d16a8f/src/handlers/shutdown.rs | src/handlers/shutdown.rs | use tracing::info;
use crate::{Backend, LspClient};
pub fn shutdown<C: LspClient>(_backend: &Backend<C>) {
info!("ts_query_ls shutdown");
}
| rust | MIT | 40593cb9158dbafb6c1f2e89b24629d8b1d16a8f | 2026-01-04T20:20:11.073589Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.