2023-08-22 20:10:09 +02:00
|
|
|
function __3dPlane() : __3dObject() constructor {
|
|
|
|
VF = global.VF_POS_NORM_TEX_COL;
|
|
|
|
render_type = pr_trianglelist;
|
|
|
|
|
2023-08-23 20:01:09 +02:00
|
|
|
self.normal = 0;
|
2023-08-22 20:10:09 +02:00
|
|
|
|
2023-11-09 07:59:03 +01:00
|
|
|
two_side = false;
|
|
|
|
|
2023-08-23 20:01:09 +02:00
|
|
|
static initModel = function() {
|
|
|
|
var _nor = [ 0, 0, 1 ];
|
2023-11-09 07:59:03 +01:00
|
|
|
vertex = [];
|
|
|
|
object_counts = 1 + two_side;
|
|
|
|
|
2023-08-23 20:01:09 +02:00
|
|
|
switch(normal) {
|
|
|
|
case 0 :
|
2023-11-09 07:59:03 +01:00
|
|
|
vertex[0] = [
|
2024-10-20 09:05:33 +02:00
|
|
|
new __vertex(0, -.5, -.5).setNormal(1, 0, 0).setUV(0, 1),
|
|
|
|
new __vertex(0, .5, .5).setNormal(1, 0, 0).setUV(1, 0),
|
|
|
|
new __vertex(0, .5, -.5).setNormal(1, 0, 0).setUV(1, 1),
|
2023-08-23 20:01:09 +02:00
|
|
|
|
2024-10-20 09:05:33 +02:00
|
|
|
new __vertex(0, -.5, -.5).setNormal(1, 0, 0).setUV(0, 1),
|
|
|
|
new __vertex(0, -.5, .5).setNormal(1, 0, 0).setUV(0, 0),
|
|
|
|
new __vertex(0, .5, .5).setNormal(1, 0, 0).setUV(1, 0),
|
2023-11-09 07:59:03 +01:00
|
|
|
];
|
2023-08-23 20:01:09 +02:00
|
|
|
break;
|
2024-10-20 09:05:33 +02:00
|
|
|
|
2023-08-23 20:01:09 +02:00
|
|
|
case 1 :
|
2023-11-09 07:59:03 +01:00
|
|
|
vertex[0] = [
|
2024-10-20 09:05:33 +02:00
|
|
|
new __vertex(-.5, 0, -.5).setNormal(0, 1, 0).setUV(1, 1),
|
|
|
|
new __vertex( .5, 0, -.5).setNormal(0, 1, 0).setUV(0, 1),
|
|
|
|
new __vertex( .5, 0, .5).setNormal(0, 1, 0).setUV(0, 0),
|
2023-08-23 20:01:09 +02:00
|
|
|
|
2024-10-20 09:05:33 +02:00
|
|
|
new __vertex(-.5, 0, -.5).setNormal(0, 1, 0).setUV(1, 1),
|
|
|
|
new __vertex( .5, 0, .5).setNormal(0, 1, 0).setUV(0, 0),
|
|
|
|
new __vertex(-.5, 0, .5).setNormal(0, 1, 0).setUV(1, 0),
|
2023-11-09 07:59:03 +01:00
|
|
|
];
|
2023-08-23 20:01:09 +02:00
|
|
|
break;
|
2024-10-20 09:05:33 +02:00
|
|
|
|
2023-08-23 20:01:09 +02:00
|
|
|
case 2 :
|
2023-11-09 07:59:03 +01:00
|
|
|
vertex[0] = [
|
2024-10-20 09:05:33 +02:00
|
|
|
new __vertex(-.5, -.5, 0).setNormal(0, 0, 1).setUV(0, 0),
|
|
|
|
new __vertex( .5, .5, 0).setNormal(0, 0, 1).setUV(1, 1),
|
|
|
|
new __vertex( .5, -.5, 0).setNormal(0, 0, 1).setUV(0, 1),
|
2023-11-09 13:27:16 +01:00
|
|
|
|
2024-10-20 09:05:33 +02:00
|
|
|
new __vertex(-.5, -.5, 0).setNormal(0, 0, 1).setUV(0, 0),
|
|
|
|
new __vertex(-.5, .5, 0).setNormal(0, 0, 1).setUV(1, 0),
|
|
|
|
new __vertex( .5, .5, 0).setNormal(0, 0, 1).setUV(1, 1),
|
2023-11-09 07:59:03 +01:00
|
|
|
];
|
2023-08-23 20:01:09 +02:00
|
|
|
break;
|
|
|
|
}
|
2023-08-22 20:10:09 +02:00
|
|
|
|
2023-11-09 07:59:03 +01:00
|
|
|
if(two_side) {
|
|
|
|
vertex[1] = array_create(6);
|
|
|
|
for( var i = 0; i < 6; i++ ) {
|
|
|
|
var _v0 = vertex[0][5 - i];
|
|
|
|
vertex[1][i] = new __vertex(_v0.x, _v0.y, _v0.z).setNormal(-_v0.nx, -_v0.ny, -_v0.nz).setUV(_v0.u, _v0.v);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-22 20:10:09 +02:00
|
|
|
VB = build();
|
2023-08-23 20:01:09 +02:00
|
|
|
} initModel();
|
|
|
|
|
|
|
|
onParameterUpdate = initModel;
|
2023-08-22 20:10:09 +02:00
|
|
|
}
|