-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding min/max size on gpuemitter. rework infinite mode so lifetime s…
…till increase. Adding LocalRotation simulation shader. WIP on mesh spawn.
- Loading branch information
1 parent
47e670a
commit 6bfecef
Showing
6 changed files
with
145 additions
and
31 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package hrt.prefab.fx.gpuemitter; | ||
|
||
class LocalRotationShader extends ComputeUtils { | ||
|
||
static var SRC = { | ||
@param var speedRotation : Float; | ||
|
||
var relativeTransform : Mat4; | ||
var dt : Float; | ||
var lifeTime : Float; | ||
var particleRandom : Float; | ||
function main() { | ||
var r = 2.0 * random3d(vec2(particleRandom)) - 1.0; | ||
relativeTransform = rotateMatrixX(speedRotation * lifeTime * r.x) * | ||
rotateMatrixY(speedRotation * lifeTime * r.y) * | ||
rotateMatrixZ(speedRotation * lifeTime * r.z) * | ||
relativeTransform; | ||
} | ||
} | ||
} | ||
|
||
class LocalRotation extends SimulationShader { | ||
|
||
@:s var speedRotation : Float = 1.0; | ||
|
||
override function makeShader() { | ||
return new LocalRotationShader(); | ||
} | ||
|
||
override function updateInstance(?propName) { | ||
super.updateInstance(propName); | ||
|
||
var sh = cast(shader, LocalRotationShader); | ||
sh.speedRotation = speedRotation * 2.0 * Math.PI; | ||
} | ||
|
||
#if editor | ||
override function edit( ctx : hide.prefab.EditContext ) { | ||
ctx.properties.add(new hide.Element(' | ||
<div class="group" name="Simulation"> | ||
<dl> | ||
<dt>Rotation speed</dt><dd><input type="range" min="0" max="1" field="speedRotation"/></dd> | ||
</dl> | ||
</div> | ||
'), this, function(pname) { | ||
ctx.onChange(this, pname); | ||
}); | ||
} | ||
#end | ||
|
||
static var _ = Prefab.register("localRotation", LocalRotation); | ||
} |
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