2023-08-15 11:36:26 +02:00
|
|
|
function __3dCamera_object() : __3dObject() constructor {
|
|
|
|
ivw = 0.2; //innerViewWidth
|
|
|
|
ivh = 0.2; //innerViewHeight
|
|
|
|
ovw = 0.5; //outerViewWidth
|
|
|
|
ovh = 0.5; //outerViewHeight
|
|
|
|
len = 0.5; //cameraLength
|
|
|
|
|
2023-08-23 20:01:09 +02:00
|
|
|
vertex = [[
|
2023-08-29 14:33:44 +02:00
|
|
|
new __vertex( -len, -ivw, ivh ), new __vertex( -len, ivw, ivh ),
|
|
|
|
new __vertex( -len, ivw, ivh ), new __vertex( -len, ivw, -ivh ),
|
|
|
|
new __vertex( -len, ivw, -ivh ), new __vertex( -len, -ivw, -ivh ),
|
|
|
|
new __vertex( -len, -ivw, -ivh ), new __vertex( -len, -ivw, ivh ),
|
2023-08-15 11:36:26 +02:00
|
|
|
|
2023-08-29 14:33:44 +02:00
|
|
|
new __vertex( len, -ovw, ovh ), new __vertex( len, ovw, ovh ),
|
|
|
|
new __vertex( len, ovw, ovh ), new __vertex( len, ovw, -ovh ),
|
|
|
|
new __vertex( len, ovw, -ovh ), new __vertex( len, -ovw, -ovh ),
|
|
|
|
new __vertex( len, -ovw, -ovh ), new __vertex( len, -ovw, ovh ),
|
2023-08-16 20:16:31 +02:00
|
|
|
|
2023-08-29 14:33:44 +02:00
|
|
|
new __vertex( -len, -ivw, ivh ), new __vertex( len, -ovw, ovh ),
|
|
|
|
new __vertex( -len, ivw, ivh ), new __vertex( len, ovw, ovh ),
|
|
|
|
new __vertex( -len, ivw, -ivh ), new __vertex( len, ovw, -ovh ),
|
|
|
|
new __vertex( -len, -ivw, -ivh ), new __vertex( len, -ovw, -ovh ),
|
2023-08-15 11:36:26 +02:00
|
|
|
|
2023-08-29 14:33:44 +02:00
|
|
|
new __vertex( len, -ovw * 0.5, ovh + 0.2 ), new __vertex( len, ovw * 0.5, ovh + 0.2 ),
|
|
|
|
new __vertex( len, 0, ovh + 0.6 ), new __vertex( len, ovw * 0.5, ovh + 0.2 ),
|
|
|
|
new __vertex( len, -ovw * 0.5, ovh + 0.2 ), new __vertex( len, 0, ovh + 0.6 ),
|
2023-08-23 20:01:09 +02:00
|
|
|
]];
|
2023-08-15 11:36:26 +02:00
|
|
|
|
|
|
|
VF = global.VF_POS_COL;
|
|
|
|
render_type = pr_linelist;
|
|
|
|
VB = build();
|
|
|
|
|
2023-08-30 16:40:45 +02:00
|
|
|
transform.position.set(-5, -5, 5);
|
2023-09-28 06:31:34 +02:00
|
|
|
transform.rotation.FromEuler(0, 30, 135);
|
2023-08-30 16:40:45 +02:00
|
|
|
transform.scale.set(1, room_width / room_height, 1);
|
2023-08-16 20:16:31 +02:00
|
|
|
|
|
|
|
static submitSel = function(params = {}) {
|
|
|
|
shader_set(sh_d3d_wireframe);
|
2023-11-15 02:35:30 +01:00
|
|
|
shader_set_color("blend", c_white);
|
2023-08-16 20:16:31 +02:00
|
|
|
submitVertex(params);
|
|
|
|
shader_reset();
|
|
|
|
}
|
2023-08-15 11:36:26 +02:00
|
|
|
}
|
|
|
|
|
2023-11-21 02:53:15 +01:00
|
|
|
function d3d_PolarToCart(camFx, camFy, camFz, camAx, camAy, camDist) {
|
2023-08-15 11:36:26 +02:00
|
|
|
var pos = new __vec3();
|
|
|
|
|
2023-11-21 11:54:45 +01:00
|
|
|
if(camAy % 90 == 0) camAy += 0.1;
|
|
|
|
if(camAx % 90 == 0) camAx += 0.1;
|
|
|
|
|
2023-08-15 11:36:26 +02:00
|
|
|
var radAx = degtorad(camAx);
|
|
|
|
var radAy = degtorad(camAy);
|
|
|
|
|
|
|
|
pos.x = camFx + (cos(radAy) * sin(radAx)) * camDist;
|
|
|
|
pos.y = camFy + (cos(radAy) * cos(radAx)) * camDist;
|
|
|
|
pos.z = camFz + (sin(radAy)) * camDist;
|
|
|
|
|
|
|
|
return pos;
|
|
|
|
}
|