@:directlyUsed@:src({
@global var camera:{ var viewProj : Mat4; var position : Vec3};
@global var global:{ @perObject
var modelView : Mat4};
@input var input:{ var position : Vec3; var rpos : Vec2; var rot : Float; var size : Vec2; var uv : Vec2};
var transformedPosition:Vec3;
var transformedNormal:Vec3;
var projectedPosition:Vec4;
@param var rotationAxis:Mat3;
@param var size:Vec2;
@const var is3D:Bool;
@const var isAbsolute:Bool;
function __init__() {
if (isAbsolute) transformedPosition = input.position;
};
function vertex() {
var rpos = input.rpos;
var rot = input.rot;
var cr = rot.cos();
var sr = rot.sin();
var pos = input.size * rpos;
if (is3D) pos *= size;
var rtmp = pos.x * cr + pos.y * sr;
pos.y = pos.y * cr - pos.x * sr;
pos.x = rtmp;
if (is3D) {
transformedPosition += vec3(pos, 0) * rotationAxis;
} else {
projectedPosition = vec4(transformedPosition, 1) * camera.viewProj;
projectedPosition.xy += pos * size;
};
transformedNormal = (transformedPosition - camera.position).normalize();
};
})@:build(hxsl.Macros.buildShader())@:autoBuild(hxsl.Macros.buildShader())