Skip to content

Commit 3b2a2b3

Browse files
committed
update
1 parent c52031c commit 3b2a2b3

File tree

21 files changed

+2496
-124
lines changed

21 files changed

+2496
-124
lines changed

bin/WARME-Blender-Exporter.zip

114 Bytes
Binary file not shown.
12.2 KB
Binary file not shown.

bin/WARME-Blender-Exporter/WARME-Blender-Exporter/__init__.py

Lines changed: 2285 additions & 0 deletions
Large diffs are not rendered by default.
276 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
368 Bytes
Binary file not shown.
1.16 KB
Binary file not shown.

src/lib/gfx3/gfx3_drawable.ts

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ import { Gfx3Transformable } from './gfx3_transformable';
55
import { Gfx3BoundingBox } from './gfx3_bounding_box';
66
import { Quaternion } from '../core/quaternion';
77

8+
enum MeshEffect {
9+
NONE = 0,
10+
PIXELATION = 2,
11+
COLOR_LIMITATION = 4,
12+
DITHER = 8,
13+
OUTLINE = 16,
14+
SHADOW_VOLUME = 32,
15+
CHANNEL1 = 64
16+
};
17+
818
/**
919
* A 3D drawable object.
1020
*/
@@ -21,7 +31,7 @@ class Gfx3Drawable extends Gfx3Transformable implements Poolable<Gfx3Drawable> {
2131
*/
2232
constructor(vertexStride: number) {
2333
super();
24-
this.id = [0, 0, 0, 0];
34+
this.id = [0, 0, 0, 1];
2535
this.vertexSubBuffer = gfx3Manager.createVertexBuffer(0);
2636
this.vertices = [];
2737
this.vertexCount = 0;
@@ -126,33 +136,34 @@ class Gfx3Drawable extends Gfx3Transformable implements Poolable<Gfx3Drawable> {
126136

127137
/**
128138
* Set an identifier based on three components.
129-
* Note: WARME use some specials ID's in its internal pipeline, check the table below:
130-
* ■ decals group: g = n
131-
* ■ lights group: b = n
132-
* ■ pixelation: a = 1
133-
* ■ color limitation: a = 2
134-
* ■ dither: a = 4
135-
* ■ outline: a = 8
136-
* ■ shadow volume: a = 16
137-
* ■ channel 1: a = 32 (channel 1 is a rendering texture used by post process unit for many different things, it is invisible by default)
139+
* Note: SWGPU use some specials ID's in its internal pipeline, check the table below:
140+
* ■ R: The red channel.
141+
* ■ G: The green channel.
142+
* ■ A: The alpha channel [0, 1]
143+
* ■ B: The blue channel for effects
144+
* ■ pixelation: 2
145+
* ■ color limitation: 4
146+
* ■ dither: 8
147+
* ■ outline: 16
148+
* ■ shadow volume: 32
149+
* ■ channel1: 64
138150
*
139-
* @param {number} r - The pur identifier you can use for custom stuff.
140-
* @param {number} g - The decals group.
141-
* @param {number} b - The lights group.
142-
* @param {number} a - The flags value for specials effects.
151+
* @param {number} r - The red channel.
152+
* @param {number} g - The green channel.
153+
* @param {MeshEffect|number} b - The blue channel for effects.
154+
* @param {number} a - The alpha channel.
143155
*/
144-
setId(r: number, g: number = 0, b: number = 0, a: number = 0): void {
156+
setId(r: number, g: number = 0, b: MeshEffect = 0, a: number = 1): void {
145157
this.id = [r, g, b, a];
146158
}
147159

148160
/**
149-
* Set a single identifier component.
161+
* Set the effects.
150162
*
151-
* @param {number} index - The component index.
152-
* @param {number} value - The identifier value.
163+
* @param {MeshEffecta|number} effects - The effects.
153164
*/
154-
setSingleId(index: number, value: number): void {
155-
this.id[index] = value;
165+
setEffects(effects: number): void {
166+
this.id[2] = effects;
156167
}
157168

158169
/**
@@ -218,4 +229,4 @@ class Gfx3Drawable extends Gfx3Transformable implements Poolable<Gfx3Drawable> {
218229
}
219230
}
220231

221-
export { Gfx3Drawable };
232+
export { Gfx3Drawable, MeshEffect };

src/lib/gfx3_mesh/gfx3_mesh_light.ts

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Gfx3MeshLight extends Gfx3Transformable {
1818
linear: number;
1919
exp: number;
2020
radius: number;
21-
meshId: number;
21+
group: number;
2222
/* spot */
2323
cutoff: number;
2424
direction: vec3;
@@ -33,7 +33,7 @@ class Gfx3MeshLight extends Gfx3Transformable {
3333
this.linear = 0;
3434
this.exp = 0;
3535
this.radius = 10;
36-
this.meshId = 0;
36+
this.group = 0;
3737
this.cutoff = 12.5;
3838
this.direction = [0, -1, 0];
3939
}
@@ -60,7 +60,7 @@ class Gfx3MeshLight extends Gfx3Transformable {
6060
this.linear = json['Linear'];
6161
this.exp = json['Exp'];
6262
this.radius = json['Radius'];
63-
this.meshId = json['MeshID'];
63+
this.group = json['Group'];
6464
this.cutoff = json['Cutoff'];
6565
this.direction = json['Direction'];
6666
}
@@ -75,7 +75,7 @@ class Gfx3MeshLight extends Gfx3Transformable {
7575
this.diffuse,
7676
this.specular,
7777
this.intensity,
78-
this.meshId,
78+
this.group,
7979
this.constant,
8080
this.linear,
8181
this.exp
@@ -89,7 +89,7 @@ class Gfx3MeshLight extends Gfx3Transformable {
8989
this.diffuse,
9090
this.specular,
9191
this.intensity,
92-
this.meshId,
92+
this.group,
9393
this.constant,
9494
this.linear,
9595
this.exp
@@ -180,13 +180,13 @@ class Gfx3MeshLight extends Gfx3Transformable {
180180
}
181181

182182
/**
183-
* Set mesh id targeted.
184-
* Note: 0 affect all mesh
183+
* Set group light identifier.
184+
* Note: 0 is the default group and will affect all mesh
185185
*
186-
* @param {number} meshId - The mesh id.
186+
* @param {number} group - The group id.
187187
*/
188-
setMeshId(meshId: number): void {
189-
this.meshId = meshId;
188+
setGroup(group: number): void {
189+
this.group = group;
190190
}
191191

192192
/**
@@ -268,11 +268,10 @@ class Gfx3MeshLight extends Gfx3Transformable {
268268
}
269269

270270
/**
271-
* Returns the mesh id affected by the light.
272-
* Note: 0 affect all mesh
271+
* Returns the group id.
273272
*/
274-
getMeshId(): number {
275-
return this.meshId;
273+
getGroup(): number {
274+
return this.group;
276275
}
277276

278277
/**

0 commit comments

Comments
 (0)