This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Note: This does _not_ compile, it's just to demonstrate the relevant physics bits | |
class Main extends luxe.Game { | |
var fieldWidth:Int = 60; | |
var fieldDepth:Int = 60; | |
var physTimeStep:Float = 1 / 60; | |
var physTimeCounter:Float = 0; | |
var springK:Float = 100; | |
var springDampening:Float = 0.00; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//The source texture that will be transformed | |
uniform sampler2D tex0; | |
//The texture coordinate passed in from the vertex shader (the default luxe vertex shader is suffice) | |
varying vec2 tcoord; | |
//x: width of the texture divided by the radius that represents the top of the image (normally screen width / radius) | |
//y: height of the texture divided by the radius representing the top of the image (normally screen height / radius) | |
uniform vec2 sizeOverRadius; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Just position and velocity along one dimension. We're assuming the particle has a mass of 1. | |
#[derive(Clone)] | |
struct State { | |
x: f64, | |
v: f64, | |
} | |
trait Integrator { | |
fn step(&mut self, state: State, sim: &Simulation, dt: f64) -> State; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//To be used on shadertoy.com | |
//Uses the image at iChannel0 and warps it into polar coordinates | |
void mainImage( out vec4 fragColor, in vec2 fragCoord ) | |
{ | |
vec2 relativePos = fragCoord.xy - (iResolution.xy / 2.0); | |
vec2 polar; | |
polar.y = sqrt(relativePos.x * relativePos.x + relativePos.y * relativePos.y); | |
polar.y /= iResolution.x / 2.0; | |
polar.y = 1.0 - polar.y; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Copyright (c) 2014 Tilman Schmidt (@KeyMaster_) | |
//Permission is hereby granted, free of charge, to any person obtaining a copy | |
//of this software and associated documentation files (the "Software"), to deal | |
//in the Software without restriction, including without limitation the rights | |
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
//copies of the Software, and to permit persons to whom the Software is | |
//furnished to do so, subject to the following conditions: | |
//The above copyright notice and this permission notice shall be included in |
OlderNewer