mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
[ts][player][webgl] Closes #2227, instead of disabling culling automatically, make it configurable via PolygonBatcher.disableCulling. Off by default.
This commit is contained in:
parent
0042015e7c
commit
83a8e5d66b
@ -143,7 +143,7 @@
|
||||
* `VertexEffect` has been removed.
|
||||
|
||||
### WebGL backend
|
||||
* `PolygonBatcher.start()` now disables culling and restores the previous state on `PolygonBatcher.end()`.
|
||||
* `PolygonBatcher` can now disable culling automatically if the static variable `PolygonBatcher.disableCulling` is set to true.
|
||||
* Added `SpineCanvas`, a simpler way to render a scene via spine-webgl. See `spine-ts/spine-webgl/examples/barebones.html` and `spine-ts/spine-webgl/examples/mix-and-match.html`.
|
||||
|
||||
### Canvas backend
|
||||
|
||||
@ -34,6 +34,8 @@ import { Shader } from "./Shader";
|
||||
import { ManagedWebGLRenderingContext } from "./WebGL";
|
||||
|
||||
export class PolygonBatcher implements Disposable {
|
||||
public static disableCulling = false;
|
||||
|
||||
private context: ManagedWebGLRenderingContext;
|
||||
private drawCalls = 0;
|
||||
private static globalDrawCalls = 0;
|
||||
@ -72,8 +74,10 @@ export class PolygonBatcher implements Disposable {
|
||||
gl.enable(gl.BLEND);
|
||||
gl.blendFuncSeparate(this.srcColorBlend, this.dstBlend, this.srcAlphaBlend, this.dstBlend);
|
||||
|
||||
this.cullWasEnabled = gl.isEnabled(gl.CULL_FACE);
|
||||
if (this.cullWasEnabled) gl.disable(gl.CULL_FACE);
|
||||
if (PolygonBatcher.disableCulling) {
|
||||
this.cullWasEnabled = gl.isEnabled(gl.CULL_FACE);
|
||||
if (this.cullWasEnabled) gl.disable(gl.CULL_FACE);
|
||||
}
|
||||
}
|
||||
|
||||
setBlendMode (srcColorBlend: number, srcAlphaBlend: number, dstBlend: number) {
|
||||
@ -133,7 +137,9 @@ export class PolygonBatcher implements Disposable {
|
||||
|
||||
let gl = this.context.gl;
|
||||
gl.disable(gl.BLEND);
|
||||
if (this.cullWasEnabled) gl.enable(gl.CULL_FACE);
|
||||
if (PolygonBatcher.disableCulling) {
|
||||
if(this.cullWasEnabled) gl.enable(gl.CULL_FACE);
|
||||
}
|
||||
}
|
||||
|
||||
getDrawCalls () {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user