[update] Moved codes which transpose a matrix, to GLSL.
This commit is contained in:
parent
4ea0041c54
commit
111c98bea2
@ -14,7 +14,7 @@ class CircleElement : ElementInterface {
|
|||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
static struct Instance {
|
static struct Instance {
|
||||||
/// this should be transposed
|
///
|
||||||
align(1) mat3 matrix = mat3.identity;
|
align(1) mat3 matrix = mat3.identity;
|
||||||
///
|
///
|
||||||
align(1) float weight = 1;
|
align(1) float weight = 1;
|
||||||
@ -35,7 +35,7 @@ class CircleElement : ElementInterface {
|
|||||||
override DamageCalculationResult CalculateDamage(vec2 p1, vec2 p2) const {
|
override DamageCalculationResult CalculateDamage(vec2 p1, vec2 p2) const {
|
||||||
if (!alive) return DamageCalculationResult(0, 0);
|
if (!alive) return DamageCalculationResult(0, 0);
|
||||||
|
|
||||||
const m = matrix.transposed.inverse;
|
const m = matrix.inverse;
|
||||||
|
|
||||||
const a = (m * vec3(p1, 1)).xy;
|
const a = (m * vec3(p1, 1)).xy;
|
||||||
const b = (m * vec3(p2, 1)).xy;
|
const b = (m * vec3(p2, 1)).xy;
|
||||||
@ -107,7 +107,7 @@ class CircleElementProgram {
|
|||||||
out vec4 color_;
|
out vec4 color_;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
mat3 m = mat3(m1, m2, m3);
|
mat3 m = transpose(mat3(m1, m2, m3));
|
||||||
vec2 pos = (m * vec3(vert, 1)).xy;
|
vec2 pos = (m * vec3(vert, 1)).xy;
|
||||||
|
|
||||||
uv_ = vert;
|
uv_ = vert;
|
||||||
|
@ -55,7 +55,7 @@ class ScheduledController(
|
|||||||
override void ProcessOperation(float time, ref in ParametersBlock params) {
|
override void ProcessOperation(float time, ref in ParametersBlock params) {
|
||||||
super.ProcessOperation(time, params);
|
super.ProcessOperation(time, params);
|
||||||
static if (MatrixModificationAvailable) {
|
static if (MatrixModificationAvailable) {
|
||||||
target_.matrix = matrix_factory_.Create().transposed;
|
target_.matrix = matrix_factory_.Create();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
override void FinalizeOperation(ref in ParametersBlock params) {
|
override void FinalizeOperation(ref in ParametersBlock params) {
|
||||||
|
Reference in New Issue
Block a user