action-engine-js 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +45 -0
- package/README.md +348 -0
- package/actionengine/3rdparty/goblin/goblin.js +9609 -0
- package/actionengine/3rdparty/goblin/goblin.min.js +5 -0
- package/actionengine/camera/actioncamera.js +90 -0
- package/actionengine/camera/cameracollisionhandler.js +69 -0
- package/actionengine/character/actioncharacter.js +360 -0
- package/actionengine/character/actioncharacter3D.js +61 -0
- package/actionengine/core/app.js +430 -0
- package/actionengine/debug/basedebugpanel.js +858 -0
- package/actionengine/display/canvasmanager.js +75 -0
- package/actionengine/display/gl/programmanager.js +570 -0
- package/actionengine/display/gl/shaders/lineshader.js +118 -0
- package/actionengine/display/gl/shaders/objectshader.js +1756 -0
- package/actionengine/display/gl/shaders/particleshader.js +43 -0
- package/actionengine/display/gl/shaders/shadowshader.js +319 -0
- package/actionengine/display/gl/shaders/spriteshader.js +100 -0
- package/actionengine/display/gl/shaders/watershader.js +67 -0
- package/actionengine/display/graphics/actionmodel3D.js +191 -0
- package/actionengine/display/graphics/actionsprite3D.js +230 -0
- package/actionengine/display/graphics/lighting/actiondirectionalshadowlight.js +864 -0
- package/actionengine/display/graphics/lighting/actionlight.js +211 -0
- package/actionengine/display/graphics/lighting/actionomnidirectionalshadowlight.js +862 -0
- package/actionengine/display/graphics/lighting/lightingconstants.js +263 -0
- package/actionengine/display/graphics/lighting/lightmanager.js +789 -0
- package/actionengine/display/graphics/renderableobject.js +44 -0
- package/actionengine/display/graphics/renderers/actionrenderer2D.js +341 -0
- package/actionengine/display/graphics/renderers/actionrenderer3D/actionrenderer3D.js +655 -0
- package/actionengine/display/graphics/renderers/actionrenderer3D/canvasmanager3D.js +82 -0
- package/actionengine/display/graphics/renderers/actionrenderer3D/debugrenderer3D.js +493 -0
- package/actionengine/display/graphics/renderers/actionrenderer3D/objectrenderer3D.js +790 -0
- package/actionengine/display/graphics/renderers/actionrenderer3D/spriteRenderer3D.js +266 -0
- package/actionengine/display/graphics/renderers/actionrenderer3D/sunrenderer3D.js +140 -0
- package/actionengine/display/graphics/renderers/actionrenderer3D/waterrenderer3D.js +173 -0
- package/actionengine/display/graphics/renderers/actionrenderer3D/weatherrenderer3D.js +87 -0
- package/actionengine/display/graphics/texture/proceduraltexture.js +192 -0
- package/actionengine/display/graphics/texture/texturemanager.js +242 -0
- package/actionengine/display/graphics/texture/textureregistry.js +177 -0
- package/actionengine/input/actionscrollablearea.js +1405 -0
- package/actionengine/input/inputhandler.js +1647 -0
- package/actionengine/math/geometry/geometrybuilder.js +161 -0
- package/actionengine/math/geometry/glbexporter.js +364 -0
- package/actionengine/math/geometry/glbloader.js +722 -0
- package/actionengine/math/geometry/modelcodegenerator.js +97 -0
- package/actionengine/math/geometry/triangle.js +33 -0
- package/actionengine/math/geometry/triangleutils.js +34 -0
- package/actionengine/math/mathutils.js +25 -0
- package/actionengine/math/matrix4.js +785 -0
- package/actionengine/math/physics/actionphysics.js +108 -0
- package/actionengine/math/physics/actionphysicsobject3D.js +164 -0
- package/actionengine/math/physics/actionphysicsworld3D.js +238 -0
- package/actionengine/math/physics/actionraycast.js +129 -0
- package/actionengine/math/physics/shapes/actionphysicsbox3D.js +158 -0
- package/actionengine/math/physics/shapes/actionphysicscapsule3D.js +200 -0
- package/actionengine/math/physics/shapes/actionphysicscompoundshape3D.js +147 -0
- package/actionengine/math/physics/shapes/actionphysicscone3D.js +126 -0
- package/actionengine/math/physics/shapes/actionphysicsconvexshape3D.js +72 -0
- package/actionengine/math/physics/shapes/actionphysicscylinder3D.js +117 -0
- package/actionengine/math/physics/shapes/actionphysicsmesh3D.js +74 -0
- package/actionengine/math/physics/shapes/actionphysicsplane3D.js +100 -0
- package/actionengine/math/physics/shapes/actionphysicssphere3D.js +95 -0
- package/actionengine/math/quaternion.js +61 -0
- package/actionengine/math/vector2.js +277 -0
- package/actionengine/math/vector3.js +318 -0
- package/actionengine/math/viewfrustum.js +136 -0
- package/actionengine/network/ACTIONNETREADME.md +810 -0
- package/actionengine/network/client/ActionNetManager.js +802 -0
- package/actionengine/network/client/ActionNetManagerGUI.js +1709 -0
- package/actionengine/network/client/ActionNetManagerP2P.js +1537 -0
- package/actionengine/network/client/SyncSystem.js +422 -0
- package/actionengine/network/p2p/ActionNetPeer.js +142 -0
- package/actionengine/network/p2p/ActionNetTrackerClient.js +623 -0
- package/actionengine/network/p2p/DataConnection.js +282 -0
- package/actionengine/network/p2p/README.md +510 -0
- package/actionengine/network/p2p/example.html +502 -0
- package/actionengine/network/server/ActionNetServer.js +577 -0
- package/actionengine/network/server/ActionNetServerSSL.js +579 -0
- package/actionengine/network/server/ActionNetServerUtils.js +458 -0
- package/actionengine/network/server/SERVERREADME.md +314 -0
- package/actionengine/network/server/package-lock.json +35 -0
- package/actionengine/network/server/package.json +13 -0
- package/actionengine/network/server/start.bat +27 -0
- package/actionengine/network/server/start.sh +25 -0
- package/actionengine/network/server/startwss.bat +27 -0
- package/actionengine/sound/audiomanager.js +1589 -0
- package/actionengine/sound/soundfont/ACTIONSOUNDFONT_README.md +205 -0
- package/actionengine/sound/soundfont/actionparser.js +718 -0
- package/actionengine/sound/soundfont/actionreverb.js +252 -0
- package/actionengine/sound/soundfont/actionsoundfont.js +543 -0
- package/actionengine/sound/soundfont/sf2playerlicence.txt +29 -0
- package/actionengine/sound/soundfont/soundfont.js +2 -0
- package/dist/action-engine.min.js +328 -0
- package/package.json +35 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// actionengine/display/gl/shaders/lineshader.js
|
|
2
|
+
|
|
3
|
+
class LineShader {
|
|
4
|
+
constructor() {
|
|
5
|
+
// Store references to different line shader variants
|
|
6
|
+
this.variants = {
|
|
7
|
+
default: {
|
|
8
|
+
getVertexShader: this.getDefaultVertexShader,
|
|
9
|
+
getFragmentShader: this.getDefaultFragmentShader
|
|
10
|
+
},
|
|
11
|
+
virtualboy: {
|
|
12
|
+
getVertexShader: this.getVirtualBoyVertexShader,
|
|
13
|
+
getFragmentShader: this.getVirtualBoyFragmentShader
|
|
14
|
+
}
|
|
15
|
+
// Additional variants can be added here
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// Current active variant (default to 'default')
|
|
19
|
+
this.currentVariant = 'default';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Set the current line shader variant
|
|
24
|
+
* @param {string} variantName - Name of the variant to use
|
|
25
|
+
*/
|
|
26
|
+
setVariant(variantName) {
|
|
27
|
+
if (this.variants[variantName]) {
|
|
28
|
+
this.currentVariant = variantName;
|
|
29
|
+
console.log(`[LineShader] Set line shader variant to: ${variantName}`);
|
|
30
|
+
} else {
|
|
31
|
+
console.warn(`[LineShader] Unknown variant: ${variantName}, using default`);
|
|
32
|
+
this.currentVariant = 'default';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Get the current variant's vertex shader
|
|
38
|
+
* @param {boolean} isWebGL2 - Whether WebGL2 is being used
|
|
39
|
+
* @returns {string} - Vertex shader source code
|
|
40
|
+
*/
|
|
41
|
+
getVertexShader(isWebGL2) {
|
|
42
|
+
return this.variants[this.currentVariant].getVertexShader.call(this, isWebGL2);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Get the current variant's fragment shader
|
|
47
|
+
* @param {boolean} isWebGL2 - Whether WebGL2 is being used
|
|
48
|
+
* @returns {string} - Fragment shader source code
|
|
49
|
+
*/
|
|
50
|
+
getFragmentShader(isWebGL2) {
|
|
51
|
+
return this.variants[this.currentVariant].getFragmentShader.call(this, isWebGL2);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Default line vertex shader
|
|
56
|
+
* @param {boolean} isWebGL2 - Whether WebGL2 is being used
|
|
57
|
+
* @returns {string} - Vertex shader source code
|
|
58
|
+
*/
|
|
59
|
+
getDefaultVertexShader(isWebGL2) {
|
|
60
|
+
return `${isWebGL2 ? "#version 300 es\n" : ""}
|
|
61
|
+
${isWebGL2 ? "in" : "attribute"} vec3 aPosition;
|
|
62
|
+
uniform mat4 uProjectionMatrix;
|
|
63
|
+
uniform mat4 uViewMatrix;
|
|
64
|
+
uniform float uTime;
|
|
65
|
+
|
|
66
|
+
void main() {
|
|
67
|
+
gl_Position = uProjectionMatrix * uViewMatrix * vec4(aPosition, 1.0);
|
|
68
|
+
}`;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Default line fragment shader
|
|
73
|
+
* @param {boolean} isWebGL2 - Whether WebGL2 is being used
|
|
74
|
+
* @returns {string} - Fragment shader source code
|
|
75
|
+
*/
|
|
76
|
+
getDefaultFragmentShader(isWebGL2) {
|
|
77
|
+
return `${isWebGL2 ? "#version 300 es\n" : ""}
|
|
78
|
+
precision mediump float;
|
|
79
|
+
${isWebGL2 ? "out vec4 fragColor;\n" : ""}
|
|
80
|
+
|
|
81
|
+
uniform vec3 uColor;
|
|
82
|
+
|
|
83
|
+
void main() {
|
|
84
|
+
${isWebGL2 ? "fragColor" : "gl_FragColor"} = vec4(uColor, 1.0);
|
|
85
|
+
}`;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* VirtualBoy line vertex shader
|
|
90
|
+
* @param {boolean} isWebGL2 - Whether WebGL2 is being used
|
|
91
|
+
* @returns {string} - Vertex shader source code
|
|
92
|
+
*/
|
|
93
|
+
getVirtualBoyVertexShader(isWebGL2) {
|
|
94
|
+
return `${isWebGL2 ? "#version 300 es\n" : ""}
|
|
95
|
+
${isWebGL2 ? "in" : "attribute"} vec3 aPosition;
|
|
96
|
+
uniform mat4 uProjectionMatrix;
|
|
97
|
+
uniform mat4 uViewMatrix;
|
|
98
|
+
|
|
99
|
+
void main() {
|
|
100
|
+
gl_Position = uProjectionMatrix * uViewMatrix * vec4(aPosition, 1.0);
|
|
101
|
+
}`;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* VirtualBoy line fragment shader
|
|
106
|
+
* @param {boolean} isWebGL2 - Whether WebGL2 is being used
|
|
107
|
+
* @returns {string} - Fragment shader source code
|
|
108
|
+
*/
|
|
109
|
+
getVirtualBoyFragmentShader(isWebGL2) {
|
|
110
|
+
return `${isWebGL2 ? "#version 300 es\n" : ""}
|
|
111
|
+
precision mediump float;
|
|
112
|
+
${isWebGL2 ? "out vec4 fragColor;\n" : ""}
|
|
113
|
+
|
|
114
|
+
void main() {
|
|
115
|
+
${isWebGL2 ? "fragColor" : "gl_FragColor"} = vec4(1.0, 0.0, 0.0, 1.0);
|
|
116
|
+
}`;
|
|
117
|
+
}
|
|
118
|
+
}
|