mirror of
https://github.com/open-goal/jak-project.git
synced 2024-11-23 22:29:53 +00:00
[decomp] joint-mod-h (#560)
* decompile joint-mod-h * format' * missing include * fix test
This commit is contained in:
parent
a572587a0e
commit
54f72e9b10
@ -1542,6 +1542,8 @@ std::string fixed_operator_to_string(FixedOperatorKind kind) {
|
||||
return "&";
|
||||
case FixedOperatorKind::ASM_SLLV_R0:
|
||||
return ".asm.sllv.r0";
|
||||
case FixedOperatorKind::ASM_MADDS:
|
||||
return ".asm.madd.s";
|
||||
default:
|
||||
assert(false);
|
||||
return "";
|
||||
@ -2493,4 +2495,16 @@ FormElement* make_cast_using_existing(FormElement* elt, const TypeSpec& type, Fo
|
||||
}
|
||||
}
|
||||
|
||||
GenericElement* alloc_generic_token_op(const std::string& name,
|
||||
const std::vector<Form*>& args,
|
||||
FormPool& pool) {
|
||||
auto op = GenericOperator::make_function(
|
||||
pool.alloc_single_element_form<ConstantTokenElement>(nullptr, name));
|
||||
return pool.alloc_element<GenericElement>(op, args);
|
||||
}
|
||||
|
||||
Form* alloc_var_form(const RegisterAccess& var, FormPool& pool) {
|
||||
return pool.alloc_single_element_form<SimpleAtomElement>(nullptr, SimpleAtom::make_var(var));
|
||||
}
|
||||
|
||||
} // namespace decompiler
|
||||
|
@ -1645,4 +1645,8 @@ std::optional<SimpleAtom> form_element_as_atom(const FormElement* f);
|
||||
std::optional<SimpleAtom> form_as_atom(const Form* f);
|
||||
FormElement* make_cast_using_existing(Form* form, const TypeSpec& type, FormPool& pool);
|
||||
FormElement* make_cast_using_existing(FormElement* elt, const TypeSpec& type, FormPool& pool);
|
||||
GenericElement* alloc_generic_token_op(const std::string& name,
|
||||
const std::vector<Form*>& args,
|
||||
FormPool& pool);
|
||||
Form* alloc_var_form(const RegisterAccess& var, FormPool& pool);
|
||||
} // namespace decompiler
|
||||
|
@ -3110,6 +3110,29 @@ void push_asm_pextuw_to_stack(const AsmOp* op,
|
||||
}
|
||||
}
|
||||
|
||||
void push_asm_madds_to_stack(const AsmOp* op,
|
||||
FormElement* /*form_elt*/,
|
||||
const Env& env,
|
||||
FormPool& pool,
|
||||
FormStack& stack) {
|
||||
auto src0 = op->src(0);
|
||||
assert(src0.has_value());
|
||||
|
||||
auto src1 = op->src(1);
|
||||
assert(src1.has_value());
|
||||
|
||||
auto dst = op->dst();
|
||||
assert(dst.has_value());
|
||||
|
||||
auto vars = pop_to_forms({*src0, *src1}, env, pool, stack, true);
|
||||
|
||||
stack.push_value_to_reg(
|
||||
*dst,
|
||||
pool.alloc_single_element_form<GenericElement>(
|
||||
nullptr, GenericOperator::make_fixed(FixedOperatorKind::ASM_MADDS), vars),
|
||||
true, env.get_variable_type(*dst, true));
|
||||
}
|
||||
|
||||
void push_asm_to_stack(const AsmOp* op,
|
||||
FormElement* form_elt,
|
||||
const Env& env,
|
||||
@ -3128,6 +3151,11 @@ void push_asm_to_stack(const AsmOp* op,
|
||||
case InstructionKind::PEXTUW:
|
||||
push_asm_pextuw_to_stack(op, form_elt, env, pool, stack);
|
||||
break;
|
||||
/*
|
||||
case InstructionKind::MADDS:
|
||||
push_asm_madds_to_stack(op, form_elt, env, pool, stack);
|
||||
break;
|
||||
*/
|
||||
default:
|
||||
stack.push_form_element(form_elt, true);
|
||||
break;
|
||||
|
@ -147,6 +147,7 @@ enum class FixedOperatorKind {
|
||||
SYMBOL_TO_STRING,
|
||||
ADDRESS_OF,
|
||||
ASM_SLLV_R0,
|
||||
ASM_MADDS,
|
||||
INVALID
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
#include <array>
|
||||
|
||||
#include "insert_lets.h"
|
||||
#include "decompiler/IR2/GenericElementMatcher.h"
|
||||
@ -383,6 +384,105 @@ FormElement* rewrite_let(LetElement* in, const Env& env, FormPool& pool) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FormElement* rewrite_multi_let_as_vector_dot(LetElement* in, const Env& env, FormPool& pool) {
|
||||
if (in->body()->size() != 3) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* The body:
|
||||
(.mula.s f1-11 f4-0)
|
||||
(.madda.s f2-1 f5-0)
|
||||
(.madd.s f1-12 f3-0 f6-0)
|
||||
*/
|
||||
|
||||
// get asm ops
|
||||
std::array<RegisterAccess[2], 3> vars;
|
||||
std::array<InstructionKind, 3> kinds = {InstructionKind::MULAS, InstructionKind::MADDAS,
|
||||
InstructionKind::MADDS};
|
||||
for (int i = 0; i < 3; i++) {
|
||||
auto as_op = dynamic_cast<AsmOpElement*>(in->body()->at(i));
|
||||
if (!as_op) {
|
||||
return nullptr;
|
||||
}
|
||||
if (as_op->op()->instruction().kind != kinds[i]) {
|
||||
return nullptr;
|
||||
}
|
||||
for (int j = 0; j < 2; j++) {
|
||||
assert(as_op->op()->src(j).has_value());
|
||||
vars[i][j] = *as_op->op()->src(j);
|
||||
}
|
||||
}
|
||||
|
||||
RegisterAccess output = *dynamic_cast<AsmOpElement*>(in->body()->at(2))->op()->dst();
|
||||
int start_idx = in->entries().size() - 6;
|
||||
|
||||
std::optional<RegisterAccess> in_vars[2];
|
||||
for (int in_var = 0; in_var < 2; in_var++) {
|
||||
for (int axis = 0; axis < 3; axis++) {
|
||||
int idx = start_idx + in_var * 3 + axis;
|
||||
std::string axis_name(1, "xyz"[axis]);
|
||||
auto matcher =
|
||||
Matcher::deref(Matcher::any_reg(0), false, {DerefTokenMatcher::string(axis_name)});
|
||||
auto mr = match(matcher, in->entries().at(idx).src);
|
||||
if (!mr.matched) {
|
||||
return nullptr;
|
||||
}
|
||||
auto this_var = mr.maps.regs.at(0);
|
||||
assert(this_var.has_value());
|
||||
if (in_vars[in_var].has_value()) {
|
||||
// seen it before
|
||||
if (env.get_variable_name(*this_var) != env.get_variable_name(*in_vars[in_var])) {
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
assert(axis == 0);
|
||||
// first time seeing it.
|
||||
in_vars[in_var] = this_var;
|
||||
}
|
||||
|
||||
if (env.get_variable_name(vars[axis][in_var]) !=
|
||||
env.get_variable_name(in->entries().at(idx).dest)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// don't inline in the actual function...
|
||||
if (env.func->guessed_name.to_string() == "vector-dot") {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto dot_op = alloc_generic_token_op(
|
||||
"vector-dot", {alloc_var_form(*in_vars[0], pool), alloc_var_form(*in_vars[1], pool)}, pool);
|
||||
auto dot_set = pool.alloc_element<SetVarElement>(output, pool.alloc_single_form(nullptr, dot_op),
|
||||
true, TypeSpec("float"));
|
||||
|
||||
// remove let forms:
|
||||
for (int i = 0; i < 6; i++) {
|
||||
in->entries().pop_back();
|
||||
}
|
||||
|
||||
if (in->entries().empty()) {
|
||||
dot_set->parent_form = in->parent_form;
|
||||
return dot_set;
|
||||
}
|
||||
// replace body:
|
||||
in->body()->elts().clear();
|
||||
in->body()->push_back(dot_set);
|
||||
return in;
|
||||
}
|
||||
|
||||
FormElement* rewrite_multi_let(LetElement* in, const Env& env, FormPool& pool) {
|
||||
if (in->entries().size() >= 6) {
|
||||
auto as_vector_dot = rewrite_multi_let_as_vector_dot(in, env, pool);
|
||||
if (as_vector_dot) {
|
||||
return as_vector_dot;
|
||||
}
|
||||
}
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
Form* insert_cast_for_let(RegisterAccess dst,
|
||||
const TypeSpec& src_type,
|
||||
Form* src,
|
||||
@ -668,37 +768,44 @@ LetStats insert_lets(const Function& func, Env& env, FormPool& pool, Form* top_l
|
||||
bool changed = true;
|
||||
while (changed) {
|
||||
changed = false;
|
||||
top_level_form->apply([&](FormElement* f) {
|
||||
auto as_let = dynamic_cast<LetElement*>(f);
|
||||
if (!as_let) {
|
||||
return;
|
||||
}
|
||||
top_level_form->apply_form([&](Form* form) {
|
||||
for (int idx = 0; idx < form->size(); idx++) {
|
||||
auto* f = form->at(idx);
|
||||
auto as_let = dynamic_cast<LetElement*>(f);
|
||||
if (!as_let) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto inner_let = dynamic_cast<LetElement*>(as_let->body()->try_as_single_element());
|
||||
if (!inner_let) {
|
||||
return;
|
||||
}
|
||||
auto inner_let = dynamic_cast<LetElement*>(as_let->body()->try_as_single_element());
|
||||
if (!inner_let) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (auto& e : inner_let->entries()) {
|
||||
if (!as_let->is_star()) {
|
||||
RegAccessSet used;
|
||||
e.src->collect_vars(used, true);
|
||||
std::unordered_set<std::string> used_by_name;
|
||||
for (auto used_var : used) {
|
||||
used_by_name.insert(env.get_variable_name(used_var));
|
||||
}
|
||||
for (auto& old_entry : as_let->entries()) {
|
||||
if (used_by_name.find(env.get_variable_name(old_entry.dest)) != used_by_name.end()) {
|
||||
as_let->make_let_star();
|
||||
break;
|
||||
for (auto& e : inner_let->entries()) {
|
||||
if (!as_let->is_star()) {
|
||||
RegAccessSet used;
|
||||
e.src->collect_vars(used, true);
|
||||
std::unordered_set<std::string> used_by_name;
|
||||
for (auto used_var : used) {
|
||||
used_by_name.insert(env.get_variable_name(used_var));
|
||||
}
|
||||
for (auto& old_entry : as_let->entries()) {
|
||||
if (used_by_name.find(env.get_variable_name(old_entry.dest)) != used_by_name.end()) {
|
||||
as_let->make_let_star();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
as_let->add_entry(e);
|
||||
}
|
||||
as_let->add_entry(e);
|
||||
}
|
||||
|
||||
as_let->set_body(inner_let->body());
|
||||
changed = true;
|
||||
as_let->set_body(inner_let->body());
|
||||
|
||||
// rewrite:
|
||||
form->at(idx) = rewrite_multi_let(as_let, env, pool);
|
||||
assert(form->at(idx)->parent_form == form);
|
||||
changed = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1573,9 +1573,9 @@
|
||||
;; - Types
|
||||
|
||||
(deftype matrix (structure)
|
||||
((data float 16 :offset-assert 0)
|
||||
(vector vector 4 :inline :offset 0)
|
||||
((vector vector 4 :inline :offset 0)
|
||||
(quad uint128 4 :offset 0)
|
||||
(data float 16 :offset 0)
|
||||
)
|
||||
:method-count-assert 10
|
||||
:size-assert #x40
|
||||
|
@ -470,7 +470,7 @@
|
||||
"(method 11 joint-mod)": [
|
||||
[15, "s3", "process-drawable"],
|
||||
[[26, 66], "s3", "fact-info-enemy"],
|
||||
[46, "v1", "(pointer process)"]
|
||||
[[45, 50], "v1", "(pointer process)"]
|
||||
],
|
||||
|
||||
"joint-mod-look-at-handler": [[[2, 254], "gp", "joint-mod"]],
|
||||
|
@ -1804,7 +1804,7 @@
|
||||
"(method 14 joint-mod)": { "args": ["obj", "trans", "rot", "scale"] },
|
||||
"(method 11 joint-mod)": {
|
||||
"args": ["obj", "target-trans", "option", "proc"],
|
||||
"vars": { "s1-0": "proc-drawable", "s3-1": "enemy-facts", "f30-0": "dist" }
|
||||
"vars": { "s1-0": "proc-drawable", "s3-1": ["enemy-facts", "fact-info-enemy"], "f30-0": "dist", "v1-12": ["ppointer", "(pointer process)"] }
|
||||
},
|
||||
|
||||
"joint-mod-look-at-handler": { "args": ["csp", "xform", "mat"] }
|
||||
|
@ -98,3 +98,7 @@
|
||||
:size-assert #x3640
|
||||
:flag-assert #x900003640
|
||||
)
|
||||
|
||||
(define-extern cspace<-parented-transformq-joint! (function cspace transformq none))
|
||||
(define-extern cspace<-transformq! (function cspace transformq matrix))
|
||||
(define-extern vector<-cspace! (function vector cspace vector))
|
@ -41,3 +41,5 @@
|
||||
)
|
||||
|
||||
|
||||
(define-extern add-debug-matrix (function symbol bucket-id matrix none))
|
||||
(define-extern add-debug-text-sphere (function symbol bucket-id vector float string rgba none))
|
@ -129,3 +129,4 @@
|
||||
)
|
||||
|
||||
|
||||
(declare-type target basic)
|
@ -7,9 +7,9 @@
|
||||
|
||||
;; A 4x4 matrix, stored in row-major order
|
||||
(deftype matrix (structure)
|
||||
((data float 16 :offset-assert 0)
|
||||
(vector vector 4 :inline :offset 0)
|
||||
((vector vector 4 :inline :offset-assert 0)
|
||||
(quad uint128 4 :offset 0)
|
||||
(data float 16 :offset 0) ;; moved so the decompiler looks at vector first.
|
||||
)
|
||||
:method-count-assert 10
|
||||
:size-assert #x40
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -734,4 +734,73 @@
|
||||
)
|
||||
|
||||
(define-extern process-drawable-art-error state)
|
||||
(define-extern *res-static-buf* pointer)
|
||||
(define-extern *res-static-buf* pointer)
|
||||
(define-extern vector-dot (function vector vector float))
|
||||
|
||||
(declare-type cspace structure)
|
||||
|
||||
(define-extern joint-mod-look-at-handler (function cspace transformq none))
|
||||
(define-extern joint-mod-world-look-at-handler (function cspace transformq none))
|
||||
(define-extern joint-mod-rotate-handler (function cspace transformq none))
|
||||
(define-extern joint-mod-joint-set-handler (function cspace transformq none))
|
||||
(define-extern joint-mod-joint-set*-handler (function cspace transformq none))
|
||||
|
||||
(defenum joint-mod-handler-mode
|
||||
:bitfield #t
|
||||
:type uint32
|
||||
(flex-blend 0) ;; 1
|
||||
(look-at 1) ;; 2
|
||||
(world-look-at 2) ;; 4
|
||||
(rotate 3) ;; 8
|
||||
(joint-set 4) ;; 16
|
||||
(joint-set* 5) ;; 32
|
||||
;; ?? ;; 64
|
||||
(reset 7) ;; 128
|
||||
)
|
||||
|
||||
(defenum bucket-id
|
||||
:type uint32
|
||||
:bitfield #f
|
||||
|
||||
(tfrag-tex0 5)
|
||||
;; merc0 10
|
||||
;; generic0 11
|
||||
|
||||
(tfrag-tex1 12)
|
||||
;; merc1 17
|
||||
;; generic1 18
|
||||
|
||||
(shrub-tex0 19)
|
||||
|
||||
(shrub-tex1 25)
|
||||
|
||||
(alpha-tex0 31)
|
||||
|
||||
(alpha-tex1 38)
|
||||
|
||||
(pris-tex0 48)
|
||||
;; merc0 49
|
||||
;; generic0 50
|
||||
|
||||
(pris-tex1 51)
|
||||
;; merc1 52
|
||||
;; generic1 53
|
||||
|
||||
(water-tex0 57)
|
||||
;; merc0 58 (+ default)
|
||||
;; generic0 59 (+ default)
|
||||
|
||||
(water-tex1 60)
|
||||
;; merc1 61
|
||||
;; generic1 62
|
||||
;; debug text 68
|
||||
(debug-draw 68)
|
||||
)
|
||||
|
||||
(define-extern cspace<-parented-transformq-joint! (function cspace transformq none))
|
||||
(define-extern cspace<-transformq! (function cspace transformq matrix))
|
||||
(define-extern vector<-cspace! (function vector cspace vector))
|
||||
(define-extern add-debug-text-sphere (function symbol bucket-id vector float string rgba none))
|
||||
(define-extern add-debug-matrix (function symbol bucket-id matrix none))
|
||||
|
||||
(define-extern vector-flatten! (function vector vector vector vector))
|
@ -61,7 +61,7 @@
|
||||
(defmethod inspect bone ((obj bone))
|
||||
(format #t "[~8x] ~A~%" obj 'bone)
|
||||
(format #t "~Ttransform: #<matrix @ #x~X>~%" (-> obj transform))
|
||||
(format #t "~Tposition: #<vector @ #x~X>~%" (&-> obj transform data 12))
|
||||
(format #t "~Tposition: #<vector @ #x~X>~%" (-> obj transform vector 3))
|
||||
(format #t "~Tscale: #<vector @ #x~X>~%" (-> obj scale))
|
||||
(format #t "~Tcache: #<bone-cache @ #x~X>~%" (-> obj cache))
|
||||
obj
|
||||
|
@ -15,10 +15,10 @@
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(let ((v1-0 arg0))
|
||||
(let ((a0-2 (&-> *math-camera* inv-camera-rot data 8))
|
||||
(let ((a0-2 (-> *math-camera* inv-camera-rot vector 2))
|
||||
(f0-0 arg1)
|
||||
)
|
||||
(.lvf vf1 a0-2)
|
||||
(.lvf vf1 (&-> a0-2 quad))
|
||||
(let ((a0-3 f0-0))
|
||||
(.mov vf2 a0-3)
|
||||
)
|
||||
@ -27,12 +27,7 @@
|
||||
(.mul.x.vf vf1 vf1 vf2 :mask #b111)
|
||||
(.svf (&-> v1-0 quad) vf1)
|
||||
)
|
||||
(vector+float*!
|
||||
arg0
|
||||
arg0
|
||||
(the-as vector (&-> *math-camera* inv-camera-rot data 4))
|
||||
arg2
|
||||
)
|
||||
(vector+float*! arg0 arg0 (-> *math-camera* inv-camera-rot vector 1) arg2)
|
||||
(let ((a0-5 arg0))
|
||||
(let ((v1-3 arg0)
|
||||
(a1-3 (-> *math-camera* trans))
|
||||
@ -93,8 +88,8 @@
|
||||
|
||||
;; definition for function camera-angle
|
||||
(defun camera-angle ()
|
||||
(let ((f0-0 (-> *math-camera* camera-rot data 0))
|
||||
(f1-0 (-> *math-camera* camera-rot data 2))
|
||||
(let ((f0-0 (-> *math-camera* camera-rot vector 0 x))
|
||||
(f1-0 (-> *math-camera* camera-rot vector 0 z))
|
||||
)
|
||||
(atan f1-0 f0-0)
|
||||
)
|
||||
@ -128,6 +123,3 @@
|
||||
(none)
|
||||
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
@ -171,29 +171,29 @@
|
||||
(cam-fov-mult (-> math-cam fov-correction-factor))
|
||||
)
|
||||
(set!
|
||||
(-> math-cam perspective data 0)
|
||||
(-> math-cam perspective vector 0 x)
|
||||
(*
|
||||
cam-fov-mult
|
||||
(- (/ (-> math-cam x-pix) (* (-> math-cam x-ratio) (-> math-cam d))))
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> math-cam perspective data 5)
|
||||
(-> math-cam perspective vector 1 y)
|
||||
(*
|
||||
cam-fov-mult
|
||||
(- (/ (-> math-cam y-pix) (* (-> math-cam y-ratio) (-> math-cam d))))
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> math-cam perspective data 10)
|
||||
(-> math-cam perspective vector 2 z)
|
||||
(* (* cam-fov-mult (+ (-> math-cam f) (-> math-cam d))) corrected-fog)
|
||||
)
|
||||
(set!
|
||||
(-> math-cam perspective data 11)
|
||||
(-> math-cam perspective vector 2 w)
|
||||
(* (/ cam-fov-mult (-> math-cam d)) fog-at-near-plane)
|
||||
)
|
||||
(set!
|
||||
(-> math-cam perspective data 14)
|
||||
(-> math-cam perspective vector 3 z)
|
||||
(*
|
||||
(* (* (* -2.0 corrected-fog) (-> math-cam f)) (-> math-cam d))
|
||||
cam-fov-mult
|
||||
@ -235,36 +235,36 @@
|
||||
(set! (-> math-cam guard y) (/ (-> math-cam y-clip) (-> math-cam y-pix)))
|
||||
(set! (-> math-cam guard z) 1.0)
|
||||
(set! (-> math-cam guard w) 1.0)
|
||||
(set! (-> math-cam isometric data 14) (- 16777215.0 hvdf-z))
|
||||
(set! (-> math-cam isometric vector 3 z) (- 16777215.0 hvdf-z))
|
||||
)
|
||||
(set! (-> math-cam isometric data 15) fog-at-near-plane)
|
||||
(let ((persp-xx (-> math-cam perspective data 0))
|
||||
(persp-yy (-> math-cam perspective data 5))
|
||||
(persp-x (* -1.9996 (-> math-cam perspective data 0)))
|
||||
(set! (-> math-cam isometric vector 3 w) fog-at-near-plane)
|
||||
(let ((persp-xx (-> math-cam perspective vector 0 x))
|
||||
(persp-yy (-> math-cam perspective vector 1 y))
|
||||
(persp-x (* -1.9996 (-> math-cam perspective vector 0 x)))
|
||||
)
|
||||
(let ((sprite-row-0 (-> math-cam sprite-2d)))
|
||||
(set! (-> sprite-row-0 data 0) persp-x)
|
||||
(set! (-> sprite-row-0 data 1) 0.0)
|
||||
(set! (-> sprite-row-0 data 2) 0.0)
|
||||
(set! (-> sprite-row-0 data 3) 0.0)
|
||||
(set! (-> sprite-row-0 vector 0 x) persp-x)
|
||||
(set! (-> sprite-row-0 vector 0 y) 0.0)
|
||||
(set! (-> sprite-row-0 vector 0 z) 0.0)
|
||||
(set! (-> sprite-row-0 vector 0 w) 0.0)
|
||||
)
|
||||
(let ((sprite-row-1 (&-> math-cam sprite-2d data 4)))
|
||||
(set! (-> sprite-row-1 0) 0.0)
|
||||
(set! (-> sprite-row-1 1) (- (* (/ persp-yy persp-xx) persp-x)))
|
||||
(set! (-> sprite-row-1 2) 0.0)
|
||||
(set! (-> sprite-row-1 3) 0.0)
|
||||
(let ((sprite-row-1 (-> math-cam sprite-2d vector 1)))
|
||||
(set! (-> sprite-row-1 x) 0.0)
|
||||
(set! (-> sprite-row-1 y) (- (* (/ persp-yy persp-xx) persp-x)))
|
||||
(set! (-> sprite-row-1 z) 0.0)
|
||||
(set! (-> sprite-row-1 w) 0.0)
|
||||
)
|
||||
(let ((sprite-row-2 (&-> math-cam sprite-2d data 8)))
|
||||
(set! (-> sprite-row-2 0) 0.0)
|
||||
(set! (-> sprite-row-2 1) 0.0)
|
||||
(set! (-> sprite-row-2 2) (- persp-x))
|
||||
(set! (-> sprite-row-2 3) 0.0)
|
||||
(let ((sprite-row-2 (-> math-cam sprite-2d vector 2)))
|
||||
(set! (-> sprite-row-2 x) 0.0)
|
||||
(set! (-> sprite-row-2 y) 0.0)
|
||||
(set! (-> sprite-row-2 z) (- persp-x))
|
||||
(set! (-> sprite-row-2 w) 0.0)
|
||||
)
|
||||
(let ((sprite-row-3 (&-> math-cam sprite-2d data 12)))
|
||||
(set! (-> sprite-row-3 0) 0.0)
|
||||
(set! (-> sprite-row-3 1) 0.0)
|
||||
(set! (-> sprite-row-3 2) (* 500000000.0 persp-x))
|
||||
(set! (-> sprite-row-3 3) (* (* 60.0 persp-x) (-> math-cam pfog0)))
|
||||
(let ((sprite-row-3 (-> math-cam sprite-2d vector 3)))
|
||||
(set! (-> sprite-row-3 x) 0.0)
|
||||
(set! (-> sprite-row-3 y) 0.0)
|
||||
(set! (-> sprite-row-3 z) (* 500000000.0 persp-x))
|
||||
(set! (-> sprite-row-3 w) (* (* 60.0 persp-x) (-> math-cam pfog0)))
|
||||
)
|
||||
)
|
||||
(let ((v1-15 (-> math-cam sprite-2d-hvdf)))
|
||||
@ -339,9 +339,9 @@
|
||||
(matrix-identity! (-> gp-0 inv-camera-rot))
|
||||
(matrix-identity! (-> gp-0 camera-rot))
|
||||
(.svf (&-> (-> gp-0 trans) quad) vf0)
|
||||
(set! (-> gp-0 isometric data 0) 1.0)
|
||||
(set! (-> gp-0 isometric data 5) 0.5)
|
||||
(set! (-> gp-0 isometric data 10) -1.0)
|
||||
(set! (-> gp-0 isometric vector 0 x) 1.0)
|
||||
(set! (-> gp-0 isometric vector 1 y) 0.5)
|
||||
(set! (-> gp-0 isometric vector 2 z) -1.0)
|
||||
(set! (-> gp-0 reset) 1)
|
||||
(set! (-> gp-0 smooth-step) 0.0)
|
||||
(set! (-> gp-0 smooth-t) 0.0)
|
||||
|
@ -41,24 +41,12 @@
|
||||
(define
|
||||
*font-default-matrix*
|
||||
(new 'static 'matrix
|
||||
:data
|
||||
(new 'static 'array float 16
|
||||
1.0
|
||||
0.0
|
||||
0.0
|
||||
0.0
|
||||
0.0
|
||||
1.0
|
||||
0.0
|
||||
0.0
|
||||
0.0
|
||||
0.0
|
||||
1.0
|
||||
0.0
|
||||
-256.0
|
||||
0.0
|
||||
0.0
|
||||
1.0
|
||||
:vector
|
||||
(new 'static 'inline-array vector 4
|
||||
(new 'static 'vector :x 1.0)
|
||||
(new 'static 'vector :y 1.0)
|
||||
(new 'static 'vector :z 1.0)
|
||||
(new 'static 'vector :x -256.0 :w 1.0)
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -204,7 +192,7 @@
|
||||
(cond
|
||||
((= z 0.0)
|
||||
(let ((v1-4 obj))
|
||||
(set! (-> v1-4 origin z) (-> *math-camera* isometric data 14))
|
||||
(set! (-> v1-4 origin z) (-> *math-camera* isometric vector 3 z))
|
||||
)
|
||||
)
|
||||
(else
|
||||
|
@ -66,10 +66,10 @@
|
||||
(format #t "[~8x] ~A~%" obj 'light-ellipse)
|
||||
(format #t "~Tmatrix: #<matrix @ #x~X>~%" (-> obj matrix))
|
||||
(format #t "~Tcolor: #<rgbaf @ #x~X>~%" (-> obj color))
|
||||
(format #t "~Tname: ~A~%" (-> obj matrix data 3))
|
||||
(format #t "~Tdecay-start: ~f~%" (-> obj matrix data 7))
|
||||
(format #t "~Tambient-point-ratio: ~f~%" (-> obj matrix data 11))
|
||||
(format #t "~Tlevel: ~f~%" (-> obj matrix data 15))
|
||||
(format #t "~Tname: ~A~%" (-> obj matrix vector 0 w))
|
||||
(format #t "~Tdecay-start: ~f~%" (-> obj matrix vector 1 w))
|
||||
(format #t "~Tambient-point-ratio: ~f~%" (-> obj matrix vector 2 w))
|
||||
(format #t "~Tlevel: ~f~%" (-> obj matrix vector 3 w))
|
||||
(format #t "~Tfunc-symbol: ~A~%" (-> obj color w))
|
||||
(format #t "~Tfunc: ~A~%" (-> obj color w))
|
||||
obj
|
||||
@ -208,7 +208,3 @@
|
||||
;; failed to figure out what this is:
|
||||
(let ((v0-9 0))
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
;; definition of type matrix
|
||||
(deftype matrix (structure)
|
||||
((data float 16 :offset-assert 0)
|
||||
(vector vector 4 :inline :offset 0)
|
||||
((vector vector 4 :inline :offset 0)
|
||||
(quad uint128 4 :offset 0)
|
||||
(data float 16 :offset 0)
|
||||
)
|
||||
:method-count-assert 10
|
||||
:size-assert #x40
|
||||
@ -19,9 +19,9 @@
|
||||
;; INFO: this function exists in multiple non-identical object files
|
||||
(defmethod inspect matrix ((obj matrix))
|
||||
(format #t "[~8x] ~A~%" obj 'matrix)
|
||||
(format #t "~Tdata[16] @ #x~X~%" (-> obj data))
|
||||
(format #t "~Tvector[4] @ #x~X~%" (-> obj data))
|
||||
(format #t "~Tquad[4] @ #x~X~%" (-> obj data))
|
||||
(format #t "~Tdata[16] @ #x~X~%" (-> obj vector))
|
||||
(format #t "~Tvector[4] @ #x~X~%" (-> obj vector))
|
||||
(format #t "~Tquad[4] @ #x~X~%" (-> obj vector))
|
||||
obj
|
||||
)
|
||||
|
||||
@ -81,5 +81,3 @@
|
||||
)
|
||||
arg0
|
||||
)
|
||||
|
||||
|
||||
|
@ -8,34 +8,34 @@
|
||||
(format
|
||||
#t
|
||||
"~T[~F] [~F] [~F] [~F]~%"
|
||||
(-> obj data 0)
|
||||
(-> obj data 1)
|
||||
(-> obj data 2)
|
||||
(-> obj data 3)
|
||||
(-> obj vector 0 x)
|
||||
(-> obj vector 0 y)
|
||||
(-> obj vector 0 z)
|
||||
(-> obj vector 0 w)
|
||||
)
|
||||
(format
|
||||
#t
|
||||
"~T[~F] [~F] [~F] [~F]~%"
|
||||
(-> obj data 4)
|
||||
(-> obj data 5)
|
||||
(-> obj data 6)
|
||||
(-> obj data 7)
|
||||
(-> obj vector 1 x)
|
||||
(-> obj vector 1 y)
|
||||
(-> obj vector 1 z)
|
||||
(-> obj vector 1 w)
|
||||
)
|
||||
(format
|
||||
#t
|
||||
"~T[~F] [~F] [~F] [~F]~%"
|
||||
(-> obj data 8)
|
||||
(-> obj data 9)
|
||||
(-> obj data 10)
|
||||
(-> obj data 11)
|
||||
(-> obj vector 2 x)
|
||||
(-> obj vector 2 y)
|
||||
(-> obj vector 2 z)
|
||||
(-> obj vector 2 w)
|
||||
)
|
||||
(format
|
||||
#t
|
||||
"~T[~F] [~F] [~F] [~F]~%"
|
||||
(-> obj data 12)
|
||||
(-> obj data 13)
|
||||
(-> obj data 14)
|
||||
(-> obj data 15)
|
||||
(-> obj vector 3 x)
|
||||
(-> obj vector 3 y)
|
||||
(-> obj vector 3 z)
|
||||
(-> obj vector 3 w)
|
||||
)
|
||||
obj
|
||||
)
|
||||
@ -76,10 +76,10 @@
|
||||
(set! (-> arg0 vector 2 quad) (the-as uint128 0))
|
||||
(set! (-> arg0 vector 3 quad) (the-as uint128 0))
|
||||
(let ((f0-0 1.0))
|
||||
(set! (-> arg0 data 15) f0-0)
|
||||
(set! (-> arg0 data 10) f0-0)
|
||||
(set! (-> arg0 data 5) f0-0)
|
||||
(set! (-> arg0 data 0) f0-0)
|
||||
(set! (-> arg0 vector 3 w) f0-0)
|
||||
(set! (-> arg0 vector 2 z) f0-0)
|
||||
(set! (-> arg0 vector 1 y) f0-0)
|
||||
(set! (-> arg0 vector 0 x) f0-0)
|
||||
)
|
||||
arg0
|
||||
)
|
||||
@ -493,18 +493,18 @@
|
||||
;; definition for function matrix-translate!
|
||||
(defun matrix-translate! ((dst matrix) (trans vector))
|
||||
(matrix-identity! dst)
|
||||
(set! (-> dst data 12) (-> trans x))
|
||||
(set! (-> dst data 13) (-> trans y))
|
||||
(set! (-> dst data 14) (-> trans z))
|
||||
(set! (-> dst vector 3 x) (-> trans x))
|
||||
(set! (-> dst vector 3 y) (-> trans y))
|
||||
(set! (-> dst vector 3 z) (-> trans z))
|
||||
dst
|
||||
)
|
||||
|
||||
;; definition for function matrix-translate+!
|
||||
;; Used lq/sq
|
||||
(defun matrix-translate+! ((dst matrix) (src matrix) (trans vector))
|
||||
(set! (-> dst data 12) (+ (-> src data 12) (-> trans x)))
|
||||
(set! (-> dst data 13) (+ (-> src data 13) (-> trans y)))
|
||||
(set! (-> dst data 14) (+ (-> src data 14) (-> trans z)))
|
||||
(set! (-> dst vector 3 x) (+ (-> src vector 3 x) (-> trans x)))
|
||||
(set! (-> dst vector 3 y) (+ (-> src vector 3 y) (-> trans y)))
|
||||
(set! (-> dst vector 3 z) (+ (-> src vector 3 z) (-> trans z)))
|
||||
(when (!= dst src)
|
||||
(set! (-> dst vector 0 quad) (-> src vector 0 quad))
|
||||
(set! (-> dst vector 1 quad) (-> src vector 1 quad))
|
||||
@ -520,10 +520,10 @@
|
||||
(set! (-> dst vector 1 quad) (the-as uint128 0))
|
||||
(set! (-> dst vector 2 quad) (the-as uint128 0))
|
||||
(set! (-> dst vector 3 quad) (the-as uint128 0))
|
||||
(set! (-> dst data 0) (-> scale x))
|
||||
(set! (-> dst data 5) (-> scale y))
|
||||
(set! (-> dst data 10) (-> scale z))
|
||||
(set! (-> dst data 15) 1.0)
|
||||
(set! (-> dst vector 0 x) (-> scale x))
|
||||
(set! (-> dst vector 1 y) (-> scale y))
|
||||
(set! (-> dst vector 2 z) (-> scale z))
|
||||
(set! (-> dst vector 3 w) 1.0)
|
||||
dst
|
||||
)
|
||||
|
||||
@ -559,10 +559,10 @@
|
||||
(set! (-> dst vector 1 quad) (the-as uint128 0))
|
||||
(set! (-> dst vector 2 quad) (the-as uint128 0))
|
||||
(set! (-> dst vector 3 quad) (the-as uint128 0))
|
||||
(set! (-> dst data 0) (/ 1.0 (-> scale x)))
|
||||
(set! (-> dst data 5) (/ 1.0 (-> scale y)))
|
||||
(set! (-> dst data 10) (/ 1.0 (-> scale z)))
|
||||
(set! (-> dst data 15) 1.0)
|
||||
(set! (-> dst vector 0 x) (/ 1.0 (-> scale x)))
|
||||
(set! (-> dst vector 1 y) (/ 1.0 (-> scale y)))
|
||||
(set! (-> dst vector 2 z) (/ 1.0 (-> scale z)))
|
||||
(set! (-> dst vector 3 w) 1.0)
|
||||
dst
|
||||
)
|
||||
|
||||
@ -601,13 +601,13 @@
|
||||
(set! (-> dst vector 1 quad) (the-as uint128 0))
|
||||
(set! (-> dst vector 2 quad) (the-as uint128 0))
|
||||
(set! (-> dst vector 3 quad) (the-as uint128 0))
|
||||
(set! (-> dst data 0) 1.0)
|
||||
(set! (-> dst data 5) rot-cos)
|
||||
(set! (-> dst data 6) rot-sin)
|
||||
(set! (-> dst data 9) (- rot-sin))
|
||||
(set! (-> dst data 10) rot-cos)
|
||||
(set! (-> dst vector 0 x) 1.0)
|
||||
(set! (-> dst vector 1 y) rot-cos)
|
||||
(set! (-> dst vector 1 z) rot-sin)
|
||||
(set! (-> dst vector 2 y) (- rot-sin))
|
||||
(set! (-> dst vector 2 z) rot-cos)
|
||||
)
|
||||
(set! (-> dst data 15) 1.0)
|
||||
(set! (-> dst vector 3 w) 1.0)
|
||||
dst
|
||||
)
|
||||
|
||||
@ -621,13 +621,13 @@
|
||||
(set! (-> dst vector 1 quad) (the-as uint128 0))
|
||||
(set! (-> dst vector 2 quad) (the-as uint128 0))
|
||||
(set! (-> dst vector 3 quad) (the-as uint128 0))
|
||||
(set! (-> dst data 0) rot-cos)
|
||||
(set! (-> dst data 2) (- rot-sin))
|
||||
(set! (-> dst data 5) 1.0)
|
||||
(set! (-> dst data 8) rot-sin)
|
||||
(set! (-> dst data 10) rot-cos)
|
||||
(set! (-> dst vector 0 x) rot-cos)
|
||||
(set! (-> dst vector 0 z) (- rot-sin))
|
||||
(set! (-> dst vector 1 y) 1.0)
|
||||
(set! (-> dst vector 2 x) rot-sin)
|
||||
(set! (-> dst vector 2 z) rot-cos)
|
||||
)
|
||||
(set! (-> dst data 15) 1.0)
|
||||
(set! (-> dst vector 3 w) 1.0)
|
||||
dst
|
||||
)
|
||||
|
||||
@ -641,13 +641,13 @@
|
||||
(set! (-> dst vector 1 quad) (the-as uint128 0))
|
||||
(set! (-> dst vector 2 quad) (the-as uint128 0))
|
||||
(set! (-> dst vector 3 quad) (the-as uint128 0))
|
||||
(set! (-> dst data 0) rot-cos)
|
||||
(set! (-> dst data 1) rot-sin)
|
||||
(set! (-> dst data 4) (- rot-sin))
|
||||
(set! (-> dst data 5) rot-cos)
|
||||
(set! (-> dst vector 0 x) rot-cos)
|
||||
(set! (-> dst vector 0 y) rot-sin)
|
||||
(set! (-> dst vector 1 x) (- rot-sin))
|
||||
(set! (-> dst vector 1 y) rot-cos)
|
||||
)
|
||||
(set! (-> dst data 10) 1.0)
|
||||
(set! (-> dst data 15) 1.0)
|
||||
(set! (-> dst vector 2 z) 1.0)
|
||||
(set! (-> dst vector 3 w) 1.0)
|
||||
dst
|
||||
)
|
||||
|
||||
@ -746,24 +746,24 @@
|
||||
(cos-z (-> cos-vec z))
|
||||
(sin-z (-> sin-vec z))
|
||||
)
|
||||
(set! (-> dst data 0) (- (* cos-y cos-z) (* (* sin-y cos-x) sin-z)))
|
||||
(set! (-> dst data 1) (* sin-y sin-x))
|
||||
(set! (-> dst data 2) (- (+ (* cos-y sin-z) (* (* sin-y cos-x) cos-z))))
|
||||
(set! (-> dst data 3) 0.0)
|
||||
(set! (-> dst data 4) (* sin-x sin-z))
|
||||
(set! (-> dst data 5) cos-x)
|
||||
(set! (-> dst data 6) (* sin-x cos-z))
|
||||
(set! (-> dst data 7) 0.0)
|
||||
(set! (-> dst data 8) (+ (* sin-y cos-z) (* (* cos-y cos-x) sin-z)))
|
||||
(set! (-> dst data 9) (- (* cos-y sin-x)))
|
||||
(set! (-> dst data 10) (- (* (* cos-y cos-x) cos-z) (* sin-y sin-z)))
|
||||
(set! (-> dst vector 0 x) (- (* cos-y cos-z) (* (* sin-y cos-x) sin-z)))
|
||||
(set! (-> dst vector 0 y) (* sin-y sin-x))
|
||||
(set! (-> dst vector 0 z) (- (+ (* cos-y sin-z) (* (* sin-y cos-x) cos-z))))
|
||||
(set! (-> dst vector 0 w) 0.0)
|
||||
(set! (-> dst vector 1 x) (* sin-x sin-z))
|
||||
(set! (-> dst vector 1 y) cos-x)
|
||||
(set! (-> dst vector 1 z) (* sin-x cos-z))
|
||||
(set! (-> dst vector 1 w) 0.0)
|
||||
(set! (-> dst vector 2 x) (+ (* sin-y cos-z) (* (* cos-y cos-x) sin-z)))
|
||||
(set! (-> dst vector 2 y) (- (* cos-y sin-x)))
|
||||
(set! (-> dst vector 2 z) (- (* (* cos-y cos-x) cos-z) (* sin-y sin-z)))
|
||||
)
|
||||
)
|
||||
(set! (-> dst data 11) 0.0)
|
||||
(set! (-> dst data 12) 0.0)
|
||||
(set! (-> dst data 13) 0.0)
|
||||
(set! (-> dst data 14) 0.0)
|
||||
(set! (-> dst data 15) 1.0)
|
||||
(set! (-> dst vector 2 w) 0.0)
|
||||
(set! (-> dst vector 3 x) 0.0)
|
||||
(set! (-> dst vector 3 y) 0.0)
|
||||
(set! (-> dst vector 3 z) 0.0)
|
||||
(set! (-> dst vector 3 w) 1.0)
|
||||
dst
|
||||
)
|
||||
|
||||
@ -835,15 +835,15 @@
|
||||
|
||||
;; definition for function matrix-3x3-determinant
|
||||
(defun matrix-3x3-determinant ((mat matrix))
|
||||
(let ((f8-0 (-> mat data 0))
|
||||
(f1-0 (-> mat data 1))
|
||||
(f4-0 (-> mat data 2))
|
||||
(f2-0 (-> mat data 4))
|
||||
(f5-0 (-> mat data 5))
|
||||
(f9-0 (-> mat data 6))
|
||||
(f3-0 (-> mat data 8))
|
||||
(f6-0 (-> mat data 9))
|
||||
(f0-0 (-> mat data 10))
|
||||
(let ((f8-0 (-> mat vector 0 x))
|
||||
(f1-0 (-> mat vector 0 y))
|
||||
(f4-0 (-> mat vector 0 z))
|
||||
(f2-0 (-> mat vector 1 x))
|
||||
(f5-0 (-> mat vector 1 y))
|
||||
(f9-0 (-> mat vector 1 z))
|
||||
(f3-0 (-> mat vector 2 x))
|
||||
(f6-0 (-> mat vector 2 y))
|
||||
(f0-0 (-> mat vector 2 z))
|
||||
)
|
||||
(-
|
||||
(+ (+ (* (* f8-0 f5-0) f0-0) (* (* f1-0 f9-0) f3-0)) (* (* f4-0 f2-0) f6-0))
|
||||
@ -877,77 +877,92 @@
|
||||
(defun matrix-3x3-inverse! ((dst matrix) (src matrix))
|
||||
(let ((f0-0 (matrix-3x3-determinant src)))
|
||||
(set!
|
||||
(-> dst data 0)
|
||||
(-> dst vector 0 x)
|
||||
(/
|
||||
(-
|
||||
(* (-> src data 5) (-> src data 10))
|
||||
(* (-> src data 6) (-> src data 9))
|
||||
(* (-> src vector 1 y) (-> src vector 2 z))
|
||||
(* (-> src vector 1 z) (-> src vector 2 y))
|
||||
)
|
||||
f0-0
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> dst data 4)
|
||||
(-> dst vector 1 x)
|
||||
(/
|
||||
(-
|
||||
(* (-> src data 6) (-> src data 8))
|
||||
(* (-> src data 4) (-> src data 10))
|
||||
(* (-> src vector 1 z) (-> src vector 2 x))
|
||||
(* (-> src vector 1 x) (-> src vector 2 z))
|
||||
)
|
||||
f0-0
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> dst data 8)
|
||||
(/
|
||||
(- (* (-> src data 4) (-> src data 9)) (* (-> src data 5) (-> src data 8)))
|
||||
f0-0
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> dst data 1)
|
||||
(-> dst vector 2 x)
|
||||
(/
|
||||
(-
|
||||
(* (-> src data 9) (-> src data 2))
|
||||
(* (-> src data 10) (-> src data 1))
|
||||
(* (-> src vector 1 x) (-> src vector 2 y))
|
||||
(* (-> src vector 1 y) (-> src vector 2 x))
|
||||
)
|
||||
f0-0
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> dst data 5)
|
||||
(-> dst vector 0 y)
|
||||
(/
|
||||
(-
|
||||
(* (-> src data 10) (-> src data 0))
|
||||
(* (-> src data 8) (-> src data 2))
|
||||
(* (-> src vector 2 y) (-> src vector 0 z))
|
||||
(* (-> src vector 2 z) (-> src vector 0 y))
|
||||
)
|
||||
f0-0
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> dst data 9)
|
||||
(-> dst vector 1 y)
|
||||
(/
|
||||
(- (* (-> src data 8) (-> src data 1)) (* (-> src data 9) (-> src data 0)))
|
||||
(-
|
||||
(* (-> src vector 2 z) (-> src vector 0 x))
|
||||
(* (-> src vector 2 x) (-> src vector 0 z))
|
||||
)
|
||||
f0-0
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> dst data 2)
|
||||
(-> dst vector 2 y)
|
||||
(/
|
||||
(- (* (-> src data 1) (-> src data 6)) (* (-> src data 2) (-> src data 5)))
|
||||
(-
|
||||
(* (-> src vector 2 x) (-> src vector 0 y))
|
||||
(* (-> src vector 2 y) (-> src vector 0 x))
|
||||
)
|
||||
f0-0
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> dst data 6)
|
||||
(-> dst vector 0 z)
|
||||
(/
|
||||
(- (* (-> src data 2) (-> src data 4)) (* (-> src data 0) (-> src data 6)))
|
||||
(-
|
||||
(* (-> src vector 0 y) (-> src vector 1 z))
|
||||
(* (-> src vector 0 z) (-> src vector 1 y))
|
||||
)
|
||||
f0-0
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> dst data 10)
|
||||
(-> dst vector 1 z)
|
||||
(/
|
||||
(- (* (-> src data 0) (-> src data 5)) (* (-> src data 1) (-> src data 4)))
|
||||
(-
|
||||
(* (-> src vector 0 z) (-> src vector 1 x))
|
||||
(* (-> src vector 0 x) (-> src vector 1 z))
|
||||
)
|
||||
f0-0
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> dst vector 2 z)
|
||||
(/
|
||||
(-
|
||||
(* (-> src vector 0 x) (-> src vector 1 y))
|
||||
(* (-> src vector 0 y) (-> src vector 1 x))
|
||||
)
|
||||
f0-0
|
||||
)
|
||||
)
|
||||
@ -959,77 +974,92 @@
|
||||
(defun matrix-3x3-inverse-transpose! ((dst matrix) (src matrix))
|
||||
(let ((f0-0 (matrix-3x3-determinant src)))
|
||||
(set!
|
||||
(-> dst data 0)
|
||||
(-> dst vector 0 x)
|
||||
(/
|
||||
(-
|
||||
(* (-> src data 5) (-> src data 10))
|
||||
(* (-> src data 6) (-> src data 9))
|
||||
(* (-> src vector 1 y) (-> src vector 2 z))
|
||||
(* (-> src vector 1 z) (-> src vector 2 y))
|
||||
)
|
||||
f0-0
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> dst data 1)
|
||||
(-> dst vector 0 y)
|
||||
(/
|
||||
(-
|
||||
(* (-> src data 6) (-> src data 8))
|
||||
(* (-> src data 4) (-> src data 10))
|
||||
(* (-> src vector 1 z) (-> src vector 2 x))
|
||||
(* (-> src vector 1 x) (-> src vector 2 z))
|
||||
)
|
||||
f0-0
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> dst data 2)
|
||||
(/
|
||||
(- (* (-> src data 4) (-> src data 9)) (* (-> src data 5) (-> src data 8)))
|
||||
f0-0
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> dst data 4)
|
||||
(-> dst vector 0 z)
|
||||
(/
|
||||
(-
|
||||
(* (-> src data 9) (-> src data 2))
|
||||
(* (-> src data 10) (-> src data 1))
|
||||
(* (-> src vector 1 x) (-> src vector 2 y))
|
||||
(* (-> src vector 1 y) (-> src vector 2 x))
|
||||
)
|
||||
f0-0
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> dst data 5)
|
||||
(-> dst vector 1 x)
|
||||
(/
|
||||
(-
|
||||
(* (-> src data 10) (-> src data 0))
|
||||
(* (-> src data 8) (-> src data 2))
|
||||
(* (-> src vector 2 y) (-> src vector 0 z))
|
||||
(* (-> src vector 2 z) (-> src vector 0 y))
|
||||
)
|
||||
f0-0
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> dst data 6)
|
||||
(-> dst vector 1 y)
|
||||
(/
|
||||
(- (* (-> src data 8) (-> src data 1)) (* (-> src data 9) (-> src data 0)))
|
||||
(-
|
||||
(* (-> src vector 2 z) (-> src vector 0 x))
|
||||
(* (-> src vector 2 x) (-> src vector 0 z))
|
||||
)
|
||||
f0-0
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> dst data 8)
|
||||
(-> dst vector 1 z)
|
||||
(/
|
||||
(- (* (-> src data 1) (-> src data 6)) (* (-> src data 2) (-> src data 5)))
|
||||
(-
|
||||
(* (-> src vector 2 x) (-> src vector 0 y))
|
||||
(* (-> src vector 2 y) (-> src vector 0 x))
|
||||
)
|
||||
f0-0
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> dst data 9)
|
||||
(-> dst vector 2 x)
|
||||
(/
|
||||
(- (* (-> src data 2) (-> src data 4)) (* (-> src data 0) (-> src data 6)))
|
||||
(-
|
||||
(* (-> src vector 0 y) (-> src vector 1 z))
|
||||
(* (-> src vector 0 z) (-> src vector 1 y))
|
||||
)
|
||||
f0-0
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> dst data 10)
|
||||
(-> dst vector 2 y)
|
||||
(/
|
||||
(- (* (-> src data 0) (-> src data 5)) (* (-> src data 1) (-> src data 4)))
|
||||
(-
|
||||
(* (-> src vector 0 z) (-> src vector 1 x))
|
||||
(* (-> src vector 0 x) (-> src vector 1 z))
|
||||
)
|
||||
f0-0
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> dst vector 2 z)
|
||||
(/
|
||||
(-
|
||||
(* (-> src vector 0 x) (-> src vector 1 y))
|
||||
(* (-> src vector 0 y) (-> src vector 1 x))
|
||||
)
|
||||
f0-0
|
||||
)
|
||||
)
|
||||
@ -1083,22 +1113,22 @@
|
||||
|
||||
;; definition for function matrix-4x4-determinant
|
||||
(defun matrix-4x4-determinant ((dst matrix))
|
||||
(let ((f15-0 (-> dst data 0))
|
||||
(f14-0 (-> dst data 1))
|
||||
(f10-0 (-> dst data 2))
|
||||
(f2-0 (-> dst data 3))
|
||||
(f9-0 (-> dst data 4))
|
||||
(f6-0 (-> dst data 5))
|
||||
(f3-0 (-> dst data 6))
|
||||
(f11-0 (-> dst data 7))
|
||||
(f5-0 (-> dst data 8))
|
||||
(f1-0 (-> dst data 9))
|
||||
(f8-0 (-> dst data 10))
|
||||
(f13-0 (-> dst data 11))
|
||||
(f0-0 (-> dst data 12))
|
||||
(f7-0 (-> dst data 13))
|
||||
(f4-0 (-> dst data 14))
|
||||
(f12-0 (-> dst data 15))
|
||||
(let ((f15-0 (-> dst vector 0 x))
|
||||
(f14-0 (-> dst vector 0 y))
|
||||
(f10-0 (-> dst vector 0 z))
|
||||
(f2-0 (-> dst vector 0 w))
|
||||
(f9-0 (-> dst vector 1 x))
|
||||
(f6-0 (-> dst vector 1 y))
|
||||
(f3-0 (-> dst vector 1 z))
|
||||
(f11-0 (-> dst vector 1 w))
|
||||
(f5-0 (-> dst vector 2 x))
|
||||
(f1-0 (-> dst vector 2 y))
|
||||
(f8-0 (-> dst vector 2 z))
|
||||
(f13-0 (-> dst vector 2 w))
|
||||
(f0-0 (-> dst vector 3 x))
|
||||
(f7-0 (-> dst vector 3 y))
|
||||
(f4-0 (-> dst vector 3 z))
|
||||
(f12-0 (-> dst vector 3 w))
|
||||
)
|
||||
(-
|
||||
(+
|
||||
@ -1176,18 +1206,18 @@
|
||||
;; definition for function matrix-4x4-inverse-transpose!
|
||||
(defun matrix-4x4-inverse-transpose! ((dst matrix) (src matrix))
|
||||
(let ((f0-0 (matrix-4x4-determinant src)))
|
||||
(let ((f9-0 (-> src data 5))
|
||||
(f2-0 (-> src data 6))
|
||||
(f5-0 (-> src data 7))
|
||||
(f3-0 (-> src data 9))
|
||||
(f6-0 (-> src data 10))
|
||||
(f10-0 (-> src data 11))
|
||||
(f4-0 (-> src data 13))
|
||||
(f7-0 (-> src data 14))
|
||||
(f1-0 (-> src data 15))
|
||||
(let ((f9-0 (-> src vector 1 y))
|
||||
(f2-0 (-> src vector 1 z))
|
||||
(f5-0 (-> src vector 1 w))
|
||||
(f3-0 (-> src vector 2 y))
|
||||
(f6-0 (-> src vector 2 z))
|
||||
(f10-0 (-> src vector 2 w))
|
||||
(f4-0 (-> src vector 3 y))
|
||||
(f7-0 (-> src vector 3 z))
|
||||
(f1-0 (-> src vector 3 w))
|
||||
)
|
||||
(set!
|
||||
(-> dst data 0)
|
||||
(-> dst vector 0 x)
|
||||
(/
|
||||
(-
|
||||
(+
|
||||
@ -1203,18 +1233,18 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((f9-2 (-> src data 4))
|
||||
(f2-2 (-> src data 6))
|
||||
(f5-2 (-> src data 7))
|
||||
(f3-1 (-> src data 8))
|
||||
(f6-1 (-> src data 10))
|
||||
(f10-1 (-> src data 11))
|
||||
(f4-3 (-> src data 12))
|
||||
(f7-2 (-> src data 14))
|
||||
(f1-6 (-> src data 15))
|
||||
(let ((f9-2 (-> src vector 1 x))
|
||||
(f2-2 (-> src vector 1 z))
|
||||
(f5-2 (-> src vector 1 w))
|
||||
(f3-1 (-> src vector 2 x))
|
||||
(f6-1 (-> src vector 2 z))
|
||||
(f10-1 (-> src vector 2 w))
|
||||
(f4-3 (-> src vector 3 x))
|
||||
(f7-2 (-> src vector 3 z))
|
||||
(f1-6 (-> src vector 3 w))
|
||||
)
|
||||
(set!
|
||||
(-> dst data 1)
|
||||
(-> dst vector 0 y)
|
||||
(-
|
||||
(/
|
||||
(-
|
||||
@ -1232,18 +1262,18 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((f9-4 (-> src data 4))
|
||||
(f2-4 (-> src data 5))
|
||||
(f5-4 (-> src data 7))
|
||||
(f3-2 (-> src data 8))
|
||||
(f6-2 (-> src data 9))
|
||||
(f10-2 (-> src data 11))
|
||||
(f4-6 (-> src data 12))
|
||||
(f7-4 (-> src data 13))
|
||||
(f1-13 (-> src data 15))
|
||||
(let ((f9-4 (-> src vector 1 x))
|
||||
(f2-4 (-> src vector 1 y))
|
||||
(f5-4 (-> src vector 1 w))
|
||||
(f3-2 (-> src vector 2 x))
|
||||
(f6-2 (-> src vector 2 y))
|
||||
(f10-2 (-> src vector 2 w))
|
||||
(f4-6 (-> src vector 3 x))
|
||||
(f7-4 (-> src vector 3 y))
|
||||
(f1-13 (-> src vector 3 w))
|
||||
)
|
||||
(set!
|
||||
(-> dst data 2)
|
||||
(-> dst vector 0 z)
|
||||
(/
|
||||
(-
|
||||
(+
|
||||
@ -1259,18 +1289,18 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((f9-6 (-> src data 4))
|
||||
(f2-6 (-> src data 5))
|
||||
(f5-6 (-> src data 6))
|
||||
(f3-3 (-> src data 8))
|
||||
(f6-3 (-> src data 9))
|
||||
(f10-3 (-> src data 10))
|
||||
(f4-9 (-> src data 12))
|
||||
(f7-6 (-> src data 13))
|
||||
(f1-19 (-> src data 14))
|
||||
(let ((f9-6 (-> src vector 1 x))
|
||||
(f2-6 (-> src vector 1 y))
|
||||
(f5-6 (-> src vector 1 z))
|
||||
(f3-3 (-> src vector 2 x))
|
||||
(f6-3 (-> src vector 2 y))
|
||||
(f10-3 (-> src vector 2 z))
|
||||
(f4-9 (-> src vector 3 x))
|
||||
(f7-6 (-> src vector 3 y))
|
||||
(f1-19 (-> src vector 3 z))
|
||||
)
|
||||
(set!
|
||||
(-> dst data 3)
|
||||
(-> dst vector 0 w)
|
||||
(-
|
||||
(/
|
||||
(-
|
||||
@ -1288,18 +1318,18 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((f9-8 (-> src data 1))
|
||||
(f2-8 (-> src data 2))
|
||||
(f5-8 (-> src data 3))
|
||||
(f3-4 (-> src data 9))
|
||||
(f6-4 (-> src data 10))
|
||||
(f10-4 (-> src data 11))
|
||||
(f4-12 (-> src data 13))
|
||||
(f7-8 (-> src data 14))
|
||||
(f1-26 (-> src data 15))
|
||||
(let ((f9-8 (-> src vector 0 y))
|
||||
(f2-8 (-> src vector 0 z))
|
||||
(f5-8 (-> src vector 0 w))
|
||||
(f3-4 (-> src vector 2 y))
|
||||
(f6-4 (-> src vector 2 z))
|
||||
(f10-4 (-> src vector 2 w))
|
||||
(f4-12 (-> src vector 3 y))
|
||||
(f7-8 (-> src vector 3 z))
|
||||
(f1-26 (-> src vector 3 w))
|
||||
)
|
||||
(set!
|
||||
(-> dst data 4)
|
||||
(-> dst vector 1 x)
|
||||
(-
|
||||
(/
|
||||
(-
|
||||
@ -1317,18 +1347,18 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((f9-10 (-> src data 0))
|
||||
(f2-10 (-> src data 2))
|
||||
(f5-10 (-> src data 3))
|
||||
(f3-5 (-> src data 8))
|
||||
(f6-5 (-> src data 10))
|
||||
(f10-5 (-> src data 11))
|
||||
(f4-15 (-> src data 12))
|
||||
(f7-10 (-> src data 14))
|
||||
(f1-33 (-> src data 15))
|
||||
(let ((f9-10 (-> src vector 0 x))
|
||||
(f2-10 (-> src vector 0 z))
|
||||
(f5-10 (-> src vector 0 w))
|
||||
(f3-5 (-> src vector 2 x))
|
||||
(f6-5 (-> src vector 2 z))
|
||||
(f10-5 (-> src vector 2 w))
|
||||
(f4-15 (-> src vector 3 x))
|
||||
(f7-10 (-> src vector 3 z))
|
||||
(f1-33 (-> src vector 3 w))
|
||||
)
|
||||
(set!
|
||||
(-> dst data 5)
|
||||
(-> dst vector 1 y)
|
||||
(/
|
||||
(-
|
||||
(+
|
||||
@ -1344,18 +1374,18 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((f9-12 (-> src data 0))
|
||||
(f2-12 (-> src data 1))
|
||||
(f5-12 (-> src data 3))
|
||||
(f3-6 (-> src data 8))
|
||||
(f6-6 (-> src data 9))
|
||||
(f10-6 (-> src data 11))
|
||||
(f4-18 (-> src data 12))
|
||||
(f7-12 (-> src data 13))
|
||||
(f1-39 (-> src data 15))
|
||||
(let ((f9-12 (-> src vector 0 x))
|
||||
(f2-12 (-> src vector 0 y))
|
||||
(f5-12 (-> src vector 0 w))
|
||||
(f3-6 (-> src vector 2 x))
|
||||
(f6-6 (-> src vector 2 y))
|
||||
(f10-6 (-> src vector 2 w))
|
||||
(f4-18 (-> src vector 3 x))
|
||||
(f7-12 (-> src vector 3 y))
|
||||
(f1-39 (-> src vector 3 w))
|
||||
)
|
||||
(set!
|
||||
(-> dst data 6)
|
||||
(-> dst vector 1 z)
|
||||
(-
|
||||
(/
|
||||
(-
|
||||
@ -1373,18 +1403,18 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((f9-14 (-> src data 0))
|
||||
(f2-14 (-> src data 1))
|
||||
(f5-14 (-> src data 2))
|
||||
(f3-7 (-> src data 8))
|
||||
(f6-7 (-> src data 9))
|
||||
(f10-7 (-> src data 10))
|
||||
(f4-21 (-> src data 12))
|
||||
(f7-14 (-> src data 13))
|
||||
(f1-46 (-> src data 14))
|
||||
(let ((f9-14 (-> src vector 0 x))
|
||||
(f2-14 (-> src vector 0 y))
|
||||
(f5-14 (-> src vector 0 z))
|
||||
(f3-7 (-> src vector 2 x))
|
||||
(f6-7 (-> src vector 2 y))
|
||||
(f10-7 (-> src vector 2 z))
|
||||
(f4-21 (-> src vector 3 x))
|
||||
(f7-14 (-> src vector 3 y))
|
||||
(f1-46 (-> src vector 3 z))
|
||||
)
|
||||
(set!
|
||||
(-> dst data 7)
|
||||
(-> dst vector 1 w)
|
||||
(/
|
||||
(-
|
||||
(+
|
||||
@ -1400,18 +1430,18 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((f9-16 (-> src data 1))
|
||||
(f2-16 (-> src data 2))
|
||||
(f5-16 (-> src data 3))
|
||||
(f3-8 (-> src data 5))
|
||||
(f6-8 (-> src data 6))
|
||||
(f10-8 (-> src data 7))
|
||||
(f4-24 (-> src data 13))
|
||||
(f7-16 (-> src data 14))
|
||||
(f1-52 (-> src data 15))
|
||||
(let ((f9-16 (-> src vector 0 y))
|
||||
(f2-16 (-> src vector 0 z))
|
||||
(f5-16 (-> src vector 0 w))
|
||||
(f3-8 (-> src vector 1 y))
|
||||
(f6-8 (-> src vector 1 z))
|
||||
(f10-8 (-> src vector 1 w))
|
||||
(f4-24 (-> src vector 3 y))
|
||||
(f7-16 (-> src vector 3 z))
|
||||
(f1-52 (-> src vector 3 w))
|
||||
)
|
||||
(set!
|
||||
(-> dst data 8)
|
||||
(-> dst vector 2 x)
|
||||
(/
|
||||
(-
|
||||
(+
|
||||
@ -1427,18 +1457,18 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((f9-18 (-> src data 0))
|
||||
(f2-18 (-> src data 2))
|
||||
(f5-18 (-> src data 3))
|
||||
(f3-9 (-> src data 4))
|
||||
(f6-9 (-> src data 6))
|
||||
(f10-9 (-> src data 7))
|
||||
(f4-27 (-> src data 12))
|
||||
(f7-18 (-> src data 14))
|
||||
(f1-58 (-> src data 15))
|
||||
(let ((f9-18 (-> src vector 0 x))
|
||||
(f2-18 (-> src vector 0 z))
|
||||
(f5-18 (-> src vector 0 w))
|
||||
(f3-9 (-> src vector 1 x))
|
||||
(f6-9 (-> src vector 1 z))
|
||||
(f10-9 (-> src vector 1 w))
|
||||
(f4-27 (-> src vector 3 x))
|
||||
(f7-18 (-> src vector 3 z))
|
||||
(f1-58 (-> src vector 3 w))
|
||||
)
|
||||
(set!
|
||||
(-> dst data 9)
|
||||
(-> dst vector 2 y)
|
||||
(-
|
||||
(/
|
||||
(-
|
||||
@ -1456,18 +1486,18 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((f9-20 (-> src data 0))
|
||||
(f2-20 (-> src data 1))
|
||||
(f5-20 (-> src data 3))
|
||||
(f3-10 (-> src data 4))
|
||||
(f6-10 (-> src data 5))
|
||||
(f10-10 (-> src data 7))
|
||||
(f4-30 (-> src data 12))
|
||||
(f7-20 (-> src data 13))
|
||||
(f1-65 (-> src data 15))
|
||||
(let ((f9-20 (-> src vector 0 x))
|
||||
(f2-20 (-> src vector 0 y))
|
||||
(f5-20 (-> src vector 0 w))
|
||||
(f3-10 (-> src vector 1 x))
|
||||
(f6-10 (-> src vector 1 y))
|
||||
(f10-10 (-> src vector 1 w))
|
||||
(f4-30 (-> src vector 3 x))
|
||||
(f7-20 (-> src vector 3 y))
|
||||
(f1-65 (-> src vector 3 w))
|
||||
)
|
||||
(set!
|
||||
(-> dst data 10)
|
||||
(-> dst vector 2 z)
|
||||
(/
|
||||
(-
|
||||
(+
|
||||
@ -1483,18 +1513,18 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((f9-22 (-> src data 0))
|
||||
(f2-22 (-> src data 1))
|
||||
(f5-22 (-> src data 2))
|
||||
(f3-11 (-> src data 4))
|
||||
(f6-11 (-> src data 5))
|
||||
(f10-11 (-> src data 6))
|
||||
(f4-33 (-> src data 12))
|
||||
(f7-22 (-> src data 13))
|
||||
(f1-71 (-> src data 14))
|
||||
(let ((f9-22 (-> src vector 0 x))
|
||||
(f2-22 (-> src vector 0 y))
|
||||
(f5-22 (-> src vector 0 z))
|
||||
(f3-11 (-> src vector 1 x))
|
||||
(f6-11 (-> src vector 1 y))
|
||||
(f10-11 (-> src vector 1 z))
|
||||
(f4-33 (-> src vector 3 x))
|
||||
(f7-22 (-> src vector 3 y))
|
||||
(f1-71 (-> src vector 3 z))
|
||||
)
|
||||
(set!
|
||||
(-> dst data 11)
|
||||
(-> dst vector 2 w)
|
||||
(-
|
||||
(/
|
||||
(-
|
||||
@ -1512,18 +1542,18 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((f9-24 (-> src data 1))
|
||||
(f2-24 (-> src data 2))
|
||||
(f5-24 (-> src data 3))
|
||||
(f3-12 (-> src data 5))
|
||||
(f6-12 (-> src data 6))
|
||||
(f10-12 (-> src data 7))
|
||||
(f4-36 (-> src data 9))
|
||||
(f7-24 (-> src data 10))
|
||||
(f1-78 (-> src data 11))
|
||||
(let ((f9-24 (-> src vector 0 y))
|
||||
(f2-24 (-> src vector 0 z))
|
||||
(f5-24 (-> src vector 0 w))
|
||||
(f3-12 (-> src vector 1 y))
|
||||
(f6-12 (-> src vector 1 z))
|
||||
(f10-12 (-> src vector 1 w))
|
||||
(f4-36 (-> src vector 2 y))
|
||||
(f7-24 (-> src vector 2 z))
|
||||
(f1-78 (-> src vector 2 w))
|
||||
)
|
||||
(set!
|
||||
(-> dst data 12)
|
||||
(-> dst vector 3 x)
|
||||
(-
|
||||
(/
|
||||
(-
|
||||
@ -1541,18 +1571,18 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((f9-26 (-> src data 0))
|
||||
(f2-26 (-> src data 2))
|
||||
(f5-26 (-> src data 3))
|
||||
(f3-13 (-> src data 4))
|
||||
(f6-13 (-> src data 6))
|
||||
(f10-13 (-> src data 7))
|
||||
(f4-39 (-> src data 8))
|
||||
(f7-26 (-> src data 10))
|
||||
(f1-85 (-> src data 11))
|
||||
(let ((f9-26 (-> src vector 0 x))
|
||||
(f2-26 (-> src vector 0 z))
|
||||
(f5-26 (-> src vector 0 w))
|
||||
(f3-13 (-> src vector 1 x))
|
||||
(f6-13 (-> src vector 1 z))
|
||||
(f10-13 (-> src vector 1 w))
|
||||
(f4-39 (-> src vector 2 x))
|
||||
(f7-26 (-> src vector 2 z))
|
||||
(f1-85 (-> src vector 2 w))
|
||||
)
|
||||
(set!
|
||||
(-> dst data 13)
|
||||
(-> dst vector 3 y)
|
||||
(/
|
||||
(-
|
||||
(+
|
||||
@ -1568,18 +1598,18 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((f9-28 (-> src data 0))
|
||||
(f2-28 (-> src data 1))
|
||||
(f5-28 (-> src data 3))
|
||||
(f3-14 (-> src data 4))
|
||||
(f6-14 (-> src data 5))
|
||||
(f10-14 (-> src data 7))
|
||||
(f4-42 (-> src data 8))
|
||||
(f7-28 (-> src data 9))
|
||||
(f1-91 (-> src data 11))
|
||||
(let ((f9-28 (-> src vector 0 x))
|
||||
(f2-28 (-> src vector 0 y))
|
||||
(f5-28 (-> src vector 0 w))
|
||||
(f3-14 (-> src vector 1 x))
|
||||
(f6-14 (-> src vector 1 y))
|
||||
(f10-14 (-> src vector 1 w))
|
||||
(f4-42 (-> src vector 2 x))
|
||||
(f7-28 (-> src vector 2 y))
|
||||
(f1-91 (-> src vector 2 w))
|
||||
)
|
||||
(set!
|
||||
(-> dst data 14)
|
||||
(-> dst vector 3 z)
|
||||
(-
|
||||
(/
|
||||
(-
|
||||
@ -1597,18 +1627,18 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((f8-60 (-> src data 0))
|
||||
(f1-98 (-> src data 1))
|
||||
(f5-30 (-> src data 2))
|
||||
(f2-30 (-> src data 4))
|
||||
(f6-15 (-> src data 5))
|
||||
(f9-30 (-> src data 6))
|
||||
(f4-45 (-> src data 8))
|
||||
(f7-30 (-> src data 9))
|
||||
(f3-15 (-> src data 10))
|
||||
(let ((f8-60 (-> src vector 0 x))
|
||||
(f1-98 (-> src vector 0 y))
|
||||
(f5-30 (-> src vector 0 z))
|
||||
(f2-30 (-> src vector 1 x))
|
||||
(f6-15 (-> src vector 1 y))
|
||||
(f9-30 (-> src vector 1 z))
|
||||
(f4-45 (-> src vector 2 x))
|
||||
(f7-30 (-> src vector 2 y))
|
||||
(f3-15 (-> src vector 2 z))
|
||||
)
|
||||
(set!
|
||||
(-> dst data 15)
|
||||
(-> dst vector 3 w)
|
||||
(/
|
||||
(-
|
||||
(+
|
||||
@ -1630,8 +1660,8 @@
|
||||
|
||||
;; definition for function matrix-y-angle
|
||||
(defun matrix-y-angle ((mat matrix))
|
||||
(let ((z-row (&-> mat data 8)))
|
||||
(atan (-> z-row 0) (-> z-row 2))
|
||||
(let ((z-row (-> mat vector 2)))
|
||||
(atan (-> z-row x) (-> z-row z))
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -365,22 +365,22 @@
|
||||
(f1-0 (-> arg1 z))
|
||||
(f0-0 (-> arg1 w))
|
||||
)
|
||||
(set! (-> arg0 data 0) f0-0)
|
||||
(set! (-> arg0 data 1) f1-0)
|
||||
(set! (-> arg0 data 2) (- f2-0))
|
||||
(set! (-> arg0 data 3) f3-0)
|
||||
(set! (-> arg0 data 4) (- f1-0))
|
||||
(set! (-> arg0 data 5) f0-0)
|
||||
(set! (-> arg0 data 6) f3-0)
|
||||
(set! (-> arg0 data 7) f2-0)
|
||||
(set! (-> arg0 data 8) f2-0)
|
||||
(set! (-> arg0 data 9) (- f3-0))
|
||||
(set! (-> arg0 data 10) f0-0)
|
||||
(set! (-> arg0 data 11) f1-0)
|
||||
(set! (-> arg0 data 12) (- f3-0))
|
||||
(set! (-> arg0 data 13) (- f2-0))
|
||||
(set! (-> arg0 data 14) (- f1-0))
|
||||
(set! (-> arg0 data 15) f0-0)
|
||||
(set! (-> arg0 vector 0 x) f0-0)
|
||||
(set! (-> arg0 vector 0 y) f1-0)
|
||||
(set! (-> arg0 vector 0 z) (- f2-0))
|
||||
(set! (-> arg0 vector 0 w) f3-0)
|
||||
(set! (-> arg0 vector 1 x) (- f1-0))
|
||||
(set! (-> arg0 vector 1 y) f0-0)
|
||||
(set! (-> arg0 vector 1 z) f3-0)
|
||||
(set! (-> arg0 vector 1 w) f2-0)
|
||||
(set! (-> arg0 vector 2 x) f2-0)
|
||||
(set! (-> arg0 vector 2 y) (- f3-0))
|
||||
(set! (-> arg0 vector 2 z) f0-0)
|
||||
(set! (-> arg0 vector 2 w) f1-0)
|
||||
(set! (-> arg0 vector 3 x) (- f3-0))
|
||||
(set! (-> arg0 vector 3 y) (- f2-0))
|
||||
(set! (-> arg0 vector 3 z) (- f1-0))
|
||||
(set! (-> arg0 vector 3 w) f0-0)
|
||||
)
|
||||
arg0
|
||||
)
|
||||
@ -392,23 +392,23 @@
|
||||
(f0-0 (-> arg1 z))
|
||||
)
|
||||
(let ((f3-0 (-> arg1 w)))
|
||||
(set! (-> arg0 data 0) f2-0)
|
||||
(set! (-> arg0 data 1) f3-0)
|
||||
(set! (-> arg0 data 2) (- f0-0))
|
||||
(set! (-> arg0 data 3) f1-0)
|
||||
(set! (-> arg0 data 4) f1-0)
|
||||
(set! (-> arg0 data 5) f0-0)
|
||||
(set! (-> arg0 data 6) f3-0)
|
||||
(set! (-> arg0 data 7) (- f3-0))
|
||||
(set! (-> arg0 data 8) f0-0)
|
||||
(set! (-> arg0 data 9) (- f1-0))
|
||||
(set! (-> arg0 data 10) f2-0)
|
||||
(set! (-> arg0 data 11) f3-0)
|
||||
(set! (-> arg0 data 12) f3-0)
|
||||
(set! (-> arg0 vector 0 x) f2-0)
|
||||
(set! (-> arg0 vector 0 y) f3-0)
|
||||
(set! (-> arg0 vector 0 z) (- f0-0))
|
||||
(set! (-> arg0 vector 0 w) f1-0)
|
||||
(set! (-> arg0 vector 1 x) f1-0)
|
||||
(set! (-> arg0 vector 1 y) f0-0)
|
||||
(set! (-> arg0 vector 1 z) f3-0)
|
||||
(set! (-> arg0 vector 1 w) (- f3-0))
|
||||
(set! (-> arg0 vector 2 x) f0-0)
|
||||
(set! (-> arg0 vector 2 y) (- f1-0))
|
||||
(set! (-> arg0 vector 2 z) f2-0)
|
||||
(set! (-> arg0 vector 2 w) f3-0)
|
||||
(set! (-> arg0 vector 3 x) f3-0)
|
||||
)
|
||||
(set! (-> arg0 data 13) (- f2-0))
|
||||
(set! (-> arg0 data 14) (- f1-0))
|
||||
(set! (-> arg0 data 15) (- f0-0))
|
||||
(set! (-> arg0 vector 3 y) (- f2-0))
|
||||
(set! (-> arg0 vector 3 z) (- f1-0))
|
||||
(set! (-> arg0 vector 3 w) (- f0-0))
|
||||
)
|
||||
arg0
|
||||
)
|
||||
@ -454,15 +454,19 @@
|
||||
|
||||
;; definition for function matrix->quaternion
|
||||
(defun matrix->quaternion ((arg0 quaternion) (arg1 matrix))
|
||||
(let ((f0-2 (+ (+ (-> arg1 data 0) (-> arg1 data 5)) (-> arg1 data 10))))
|
||||
(let
|
||||
((f0-2
|
||||
(+ (+ (-> arg1 vector 0 x) (-> arg1 vector 1 y)) (-> arg1 vector 2 z))
|
||||
)
|
||||
)
|
||||
(cond
|
||||
((< 0.0 f0-2)
|
||||
(let ((f0-4 (sqrtf (+ 1.0 f0-2))))
|
||||
(set! (-> arg0 w) (* 0.5 f0-4))
|
||||
(let ((f0-5 (/ 0.5 f0-4)))
|
||||
(set! (-> arg0 x) (* f0-5 (- (-> arg1 data 6) (-> arg1 data 9))))
|
||||
(set! (-> arg0 y) (* f0-5 (- (-> arg1 data 8) (-> arg1 data 2))))
|
||||
(set! (-> arg0 z) (* f0-5 (- (-> arg1 data 1) (-> arg1 data 4))))
|
||||
(set! (-> arg0 x) (* f0-5 (- (-> arg1 vector 1 z) (-> arg1 vector 2 y))))
|
||||
(set! (-> arg0 y) (* f0-5 (- (-> arg1 vector 2 x) (-> arg1 vector 0 z))))
|
||||
(set! (-> arg0 z) (* f0-5 (- (-> arg1 vector 0 y) (-> arg1 vector 1 x))))
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -471,7 +475,7 @@
|
||||
(a3-0 1)
|
||||
(v1-1 2)
|
||||
)
|
||||
(when (< (-> arg1 data 0) (-> arg1 data 5))
|
||||
(when (< (-> arg1 vector 0 x) (-> arg1 vector 1 y))
|
||||
(set! a2-0 1)
|
||||
(set! a3-0 2)
|
||||
(set! v1-1 0)
|
||||
@ -484,7 +488,7 @@
|
||||
(+ (+ (* a2-0 4) (* a2-0 16)) (the-as int arg1))
|
||||
)
|
||||
)
|
||||
(-> arg1 data 10)
|
||||
(-> arg1 vector 2 z)
|
||||
)
|
||||
(set! a2-0 2)
|
||||
(set! a3-0 0)
|
||||
@ -618,46 +622,30 @@
|
||||
(vf7 :class vf)
|
||||
)
|
||||
(let ((v1-0 (new-stack-matrix0)))
|
||||
(let* ((a3-0 (-> arg1 data))
|
||||
(a2-0 (-> arg1 data))
|
||||
(f0-0 (-> a3-0 0))
|
||||
(f1-0 (-> a3-0 1))
|
||||
(f2-0 (-> a3-0 2))
|
||||
(f3-0 (-> a2-0 0))
|
||||
(f4-0 (-> a2-0 1))
|
||||
(f5-0 (-> a2-0 2))
|
||||
(let* ((a3-0 (-> arg1 vector))
|
||||
(a2-0 (-> arg1 vector))
|
||||
(f0-0 (-> a3-0 0 x))
|
||||
(f1-0 (-> a3-0 0 y))
|
||||
(f2-0 (-> a3-0 0 z))
|
||||
(f3-0 (-> a2-0 0 x))
|
||||
(f4-0 (-> a2-0 0 y))
|
||||
(f5-0 (-> a2-0 0 z))
|
||||
)
|
||||
(.mula.s f0-0 f3-0)
|
||||
(.madda.s f1-0 f4-0)
|
||||
(.madd.s f0-1 f2-0 f5-0)
|
||||
)
|
||||
(let ((f0-2 f0-1))
|
||||
(let* ((a3-1 (&-> arg1 data 4))
|
||||
(a2-2 (&-> arg1 data 4))
|
||||
(f1-1 (-> a3-1 0))
|
||||
(f2-1 (-> a3-1 1))
|
||||
(f3-1 (-> a3-1 2))
|
||||
(f4-1 (-> a2-2 0))
|
||||
(f5-1 (-> a2-2 1))
|
||||
(f6-0 (-> a2-2 2))
|
||||
(let* ((a3-1 (-> arg1 vector 1))
|
||||
(a2-2 (-> arg1 vector 1))
|
||||
)
|
||||
(.mula.s f1-1 f4-1)
|
||||
(.madda.s f2-1 f5-1)
|
||||
(.madd.s f1-2 f3-1 f6-0)
|
||||
(set! f1-2 (vector-dot a3-1 a2-2))
|
||||
)
|
||||
(let ((f1-3 f1-2))
|
||||
(let* ((a3-2 (&-> arg1 data 8))
|
||||
(a2-4 (&-> arg1 data 8))
|
||||
(f2-2 (-> a3-2 0))
|
||||
(f3-2 (-> a3-2 1))
|
||||
(f4-2 (-> a3-2 2))
|
||||
(f5-2 (-> a2-4 0))
|
||||
(f6-1 (-> a2-4 1))
|
||||
(f7-0 (-> a2-4 2))
|
||||
(let* ((a3-2 (-> arg1 vector 2))
|
||||
(a2-4 (-> arg1 vector 2))
|
||||
)
|
||||
(.mula.s f2-2 f5-2)
|
||||
(.madda.s f3-2 f6-1)
|
||||
(.madd.s f2-3 f4-2 f7-0)
|
||||
(set! f2-3 (vector-dot a3-2 a2-4))
|
||||
)
|
||||
(let* ((f2-4 f2-3)
|
||||
(f0-4 (/ 1.0 (sqrtf f0-2)))
|
||||
@ -893,7 +881,7 @@
|
||||
(defun vector-x-quaternion! ((arg0 vector) (arg1 quaternion))
|
||||
(let ((s5-0 (new-stack-matrix0)))
|
||||
(quaternion->matrix s5-0 arg1)
|
||||
(set! (-> arg0 quad) (-> (the-as (pointer uint128) (-> s5-0 data)) 0))
|
||||
(set! (-> arg0 quad) (-> (the-as (pointer uint128) (-> s5-0 vector)) 0))
|
||||
)
|
||||
arg0
|
||||
)
|
||||
@ -903,7 +891,7 @@
|
||||
(defun vector-y-quaternion! ((arg0 vector) (arg1 quaternion))
|
||||
(let ((s5-0 (new-stack-matrix0)))
|
||||
(quaternion->matrix s5-0 arg1)
|
||||
(set! (-> arg0 quad) (-> (the-as (pointer uint128) (&-> s5-0 data 4)) 0))
|
||||
(set! (-> arg0 quad) (-> (the-as (pointer uint128) (-> s5-0 vector 1)) 0))
|
||||
)
|
||||
arg0
|
||||
)
|
||||
@ -913,7 +901,7 @@
|
||||
(defun vector-z-quaternion! ((arg0 vector) (arg1 quaternion))
|
||||
(let ((s5-0 (new-stack-matrix0)))
|
||||
(quaternion->matrix s5-0 arg1)
|
||||
(set! (-> arg0 quad) (-> (the-as (pointer uint128) (&-> s5-0 data 8)) 0))
|
||||
(set! (-> arg0 quad) (-> (the-as (pointer uint128) (-> s5-0 vector 2)) 0))
|
||||
)
|
||||
arg0
|
||||
)
|
||||
@ -1033,16 +1021,8 @@
|
||||
(let ((gp-0 acos))
|
||||
(let* ((s5-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) arg0))
|
||||
(v1-1 (vector-z-quaternion! (new 'stack-no-clear 'vector) arg1))
|
||||
(f0-0 (-> s5-0 x))
|
||||
(f1-0 (-> s5-0 y))
|
||||
(f2-0 (-> s5-0 z))
|
||||
(f3-0 (-> v1-1 x))
|
||||
(f4-0 (-> v1-1 y))
|
||||
(f5-0 (-> v1-1 z))
|
||||
)
|
||||
(.mula.s f0-0 f3-0)
|
||||
(.madda.s f1-0 f4-0)
|
||||
(.madd.s f0-1 f2-0 f5-0)
|
||||
(set! f0-1 (vector-dot s5-0 v1-1))
|
||||
)
|
||||
(gp-0 f0-1)
|
||||
)
|
||||
|
1375
test/decompiler/reference/engine/target/joint-mod-h_REF.gc
Normal file
1375
test/decompiler/reference/engine/target/joint-mod-h_REF.gc
Normal file
File diff suppressed because it is too large
Load Diff
@ -91,7 +91,7 @@ TEST_F(FormRegressionTest, VectorXQuaternionWithCast) {
|
||||
"(begin\n"
|
||||
" (let ((s5-0 (new-stack-matrix0)))\n"
|
||||
" (quaternion->matrix s5-0 arg1)\n"
|
||||
" (set! (-> arg0 vec quad) (-> (the-as (pointer uint128) (-> s5-0 data)) 0))\n"
|
||||
" (set! (-> arg0 vec quad) (-> (the-as (pointer uint128) (-> s5-0 vector)) 0))\n"
|
||||
" )\n"
|
||||
" arg0\n"
|
||||
" )";
|
||||
|
@ -119,9 +119,8 @@ const std::unordered_set<std::string> g_functions_to_skip_compiling = {
|
||||
"vector-dot", // fpu acc
|
||||
"vector4-dot", // fpu acc
|
||||
|
||||
// QUATERNION
|
||||
"matrix-with-scale->quaternion", // fpu acc
|
||||
"quaternion-delta-y", // fpu acc
|
||||
// quaternion
|
||||
"matrix-with-scale->quaternion", // fpu-acc
|
||||
|
||||
"(method 3 profile-frame)", // double definition.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user