31 lines
728 B
Rust
31 lines
728 B
Rust
use super::CodePiece;
|
|
use glsl::syntax::ShaderStage;
|
|
use glsl::syntax::TranslationUnit;
|
|
use glsl::transpiler::glsl::show_translation_unit;
|
|
|
|
use crate::impl_code_piece;
|
|
|
|
pub struct Trackball(pub ShaderStage);
|
|
|
|
impl Trackball {
|
|
pub fn new() -> Self {
|
|
let raw = glsl_quasiquote::glsl! {
|
|
uniform mat4 trackball_view;
|
|
uniform mat4 trackball_model;
|
|
uniform mat4 trackball_projection;
|
|
|
|
vec4 transform(vec4 position)
|
|
{
|
|
return trackball_projection
|
|
* trackball_view
|
|
* trackball_model
|
|
* position;
|
|
}
|
|
};
|
|
|
|
Self(raw)
|
|
}
|
|
}
|
|
|
|
impl_code_piece!(Trackball, 0);
|