-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp-Examples.js
193 lines (180 loc) · 8.18 KB
/
App-Examples.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
import * as matrixEngine from './index';
import {runThis as cube_tex_arrays} from './apps/cube_tex_arrays';
import {runThis as adding_color_cube} from './apps/adding_color_cube';
import {runThis as adding_color_piramyde} from './apps/adding_color_piramyde';
import {runThis as adding_color_triangle} from './apps/adding_color_triangle';
import {runThis as adding_tex_square_raycast} from './apps/adding_tex_square_raycast';
import {runThis as adding_more_texture_samplers} from './apps/adding_more_texture_samplers';
import {runThis as adding_square_texture} from './apps/adding_square_texture';
import {runThis as all_variant_of_blending} from './apps/all_variant_of_blending';
import {runThis as audio_manipulation} from './apps/audio_manipulation';
import {runThis as audio_manipulation2} from './apps/audio_manipulation2';
import {runThis as camera_texture} from './apps/camera_texture';
import {runThis as cube_experimental} from './apps/cube_experimental';
import {runThis as cube_geometry} from './apps/cube_geometry';
import {runThis as cube_light_and_texture} from './apps/cube_light_and_texture';
import {runThis as cube_light_dinamic} from './apps/cube_light_dinamic';
import {runThis as custom_texture} from './apps/custom_texture';
import {runThis as first_person_controller} from './apps/first_person_controller';
import {runThis as load_obj_file} from './apps/load_obj_file';
import {runThis as my_world} from './apps/my_world';
import {runThis as obj_animation} from './apps/obj_animation';
import {runThis as obj_animation_build_mesh_effect} from './apps/obj_animation_build_mesh_effect';
import {runThis as one_kilo} from './apps/one-kilo';
import {runThis as porting2d} from './apps/porting2d';
import {runThis as porting2d_particle} from './apps/porting2d_particle';
import {runThis as porting2d_text} from './apps/porting2d_text';
import {runThis as sphere_geometry} from './apps/sphere_geometry';
import {runThis as texture_dinamic_manipulation} from './apps/texture_dinamic_manipulation';
import {runThis as video_texture} from './apps/video_texture';
import {runThis as adding_color_square} from './apps/adding_color_square';
import {runThis as bvh_loader} from './apps/bvh-loader';
import {runThis as bvh_animation_class} from './apps/bvh-animation-class';
import {runThis as active_editor} from './apps/active_editor';
import {runThis as porting2d_micro_draw} from './apps/porting2d_micro_draw';
import {runThis as physics_cube} from './apps/physics_cube';
import {runThis as physics_sphere} from './apps/physics_sphere';
import {runThis as spot_light_basic} from './apps/spot_light_basic';
import {runThis as networking_basic} from './apps/networking_basic';
import {runThis as load_obj_sequence} from './apps/load_obj_sequence';
import {runThis as opengles_native_cubemap} from './apps/opengles_native_cubemap';
import {runThis as opengles_native_cubemap_images} from './apps/opengles_native_cubemap_images';
import {runThis as lens_effect} from './apps/lens_effect';
import {runThis as fps_player_controller} from './apps/fps_player_controller';
import {runThis as basic_fbo} from './apps/basic_fbo';
import {runThis as video_texture_lava} from './apps/video_texture_lava';
import {runThis as matrix_chat_room} from './apps/matrix_chat_room';
import {runThis as torus_geometry} from './apps/torus_geometry';
import {runThis as physics_cube_active_textures} from './apps/physics_cube_active_textures';
import {runThis as fbo_manipulation} from './apps/fbo_manipulation';
import {runThis as welcome_gui_editor} from './apps/welcome-gui-editor';
import {runThis as rolling_the_dice} from './apps/rolling_the_dice';
import {runThis as shader1_direct} from './apps/shader1_direct';
import {runThis as shaders} from './apps/shaders';
import {runThis as shader2_direct} from './apps/shader2_direct';
import {runThis as basic_timeline} from './apps/basic_timeline';
import {runThis as networking2_basic} from './apps/networking2_basic';
import {runThis as public_3d_video_chat} from './apps/public_3d_video_chat';
import {runThis as custom_geometry} from './apps/custom_geometry';
import {runThis as load_obj_file_groups} from './apps/load_obj_file_groups';
import {runThis as maps} from './apps/maps';
import {runThis as matrix_skeletal} from './apps/matrix_skeletal';
import {runThis as sprite_animation_2d} from './apps/sprite_animation_2d';
/**
* @description
* All examples instances.
* This schema can be used for any website.
* It is good for switching big independent parts of app.
* @example for query-build.html?u=NAME_OF_EXAMPLE
* public/query-build.html?u=spot_light_shadows
*/
var Examples = {
sprite_animation_2d: sprite_animation_2d,
matrix_skeletal: matrix_skeletal,
maps: maps,
load_obj_file_groups: load_obj_file_groups,
custom_geometry: custom_geometry,
public_3d_video_chat: public_3d_video_chat,
networking2_basic: networking2_basic,
basic_timeline: basic_timeline,
shaders: shaders,
shader1_direct: shader1_direct,
shader2_direct: shader2_direct,
rolling_the_dice: rolling_the_dice,
fbo_manipulation: fbo_manipulation,
physics_cube_active_textures: physics_cube_active_textures,
torus_geometry: torus_geometry,
matrix_chat_room: matrix_chat_room,
video_texture_lava: video_texture_lava,
basic_fbo: basic_fbo,
fps_player_controller: fps_player_controller,
lens_effect: lens_effect,
opengles_native_cubemap_images: opengles_native_cubemap_images,
opengles_native_cubemap: opengles_native_cubemap,
load_obj_sequence: load_obj_sequence,
networking_basic: networking_basic,
spot_light_basic: spot_light_basic,
physics_sphere: physics_sphere,
physics_cube: physics_cube,
porting2d_micro_draw: porting2d_micro_draw,
active_editor: active_editor,
bvh_animation_class: bvh_animation_class,
bvh_loader: bvh_loader,
adding_tex_square_raycast: adding_tex_square_raycast,
cube_tex_arrays: cube_tex_arrays,
adding_color_cube: adding_color_cube,
adding_color_piramyde: adding_color_piramyde,
adding_color_triangle: adding_color_triangle,
adding_color_square: adding_color_square,
adding_more_texture_samplers: adding_more_texture_samplers,
adding_square_texture: adding_square_texture,
all_variant_of_blending: all_variant_of_blending,
audio_manipulation: audio_manipulation,
audio_manipulation2: audio_manipulation2,
camera_texture: camera_texture,
cube_experimental: cube_experimental,
cube_geometry: cube_geometry,
cube_light_and_texture: cube_light_and_texture,
cube_light_dinamic: cube_light_dinamic,
custom_texture: custom_texture,
first_person_controller: first_person_controller,
load_obj_file: load_obj_file,
my_world: my_world,
obj_animation: obj_animation,
obj_animation_build_mesh_effect: obj_animation_build_mesh_effect,
one_kilo: one_kilo,
porting2d: porting2d,
porting2d_particle: porting2d_particle,
porting2d_text: porting2d_text,
sphere_geometry: sphere_geometry,
texture_dinamic_manipulation: texture_dinamic_manipulation,
video_texture: video_texture,
welcome_gui_editor: welcome_gui_editor
};
/**
* @description
* Little help func.
*/
const QueryString = matrixEngine.utility.QueryString;
const scriptManager = matrixEngine.utility.scriptManager;
//https://webglfundamentals.org/webgl/resources/m4.js
var world;
var App = matrixEngine.App;
if('serviceWorker' in navigator) {
// navigator.serviceWorker.register('worker.js');
} else {
console.warn('Matrix Engine: No support for web workers in this browser.');
}
window.addEventListener('load', function() {
setTimeout(() => {matrixEngine.Engine.initApp(webGLStart);}, 1000)
});
function webGLStart() {
world = matrixEngine.matrixWorld.defineworld(canvas);
if(world) {
world.callReDraw();
if(typeof QueryString.u != 'undefined' &&
typeof Examples[QueryString.u] != 'undefined') {
setTimeout(() => {
try {
Examples[QueryString.u](world);
} catch(err) {
// Examples['adding_color_cube'](world);
}
}, 100);
} else {
setTimeout(() => {
Examples['adding_color_cube'](world);
}, 100);
}
} else {
console.error(' Canvas has not been initialized, contact your programmer... ');
}
// Make it global for console easy access.
// Remove this line for final prodc.
window.App = App;
}
// Make it global for console easy access.
// Remove this line for final prodc.
window.matrixEngine = matrixEngine;
var App = matrixEngine.App;
export default App;