@quake2ts/engine 0.0.804 → 0.0.807
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/dist/browser/index.global.js +36 -33
- package/dist/browser/index.global.js.map +1 -1
- package/dist/cjs/index.cjs +521 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +519 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/render/logging/renderer.d.ts +61 -0
- package/dist/types/render/logging/renderer.d.ts.map +1 -0
- package/dist/types/render/null/renderer.d.ts +50 -0
- package/dist/types/render/null/renderer.d.ts.map +1 -0
- package/package.json +5 -5
package/dist/esm/index.js
CHANGED
|
@@ -17537,6 +17537,524 @@ async function captureRenderTarget(device, texture) {
|
|
|
17537
17537
|
outputBuffer.unmap();
|
|
17538
17538
|
return result;
|
|
17539
17539
|
}
|
|
17540
|
+
|
|
17541
|
+
// src/render/null/renderer.ts
|
|
17542
|
+
var NullRenderer = class {
|
|
17543
|
+
constructor(width = 800, height = 600) {
|
|
17544
|
+
this.width = 0;
|
|
17545
|
+
this.height = 0;
|
|
17546
|
+
this.collisionVis = null;
|
|
17547
|
+
this.debug = null;
|
|
17548
|
+
this.particleSystem = null;
|
|
17549
|
+
this.frameCount = 0;
|
|
17550
|
+
this.callLog = [];
|
|
17551
|
+
this.width = width;
|
|
17552
|
+
this.height = height;
|
|
17553
|
+
}
|
|
17554
|
+
renderFrame(options, entities = []) {
|
|
17555
|
+
this.frameCount++;
|
|
17556
|
+
this.callLog.push(`renderFrame(frame=${this.frameCount}, entities=${entities.length})`);
|
|
17557
|
+
const cameraState = options.cameraState ?? options.camera.toState();
|
|
17558
|
+
this.callLog.push(` camera: pos=${cameraState.position}, angles=${cameraState.angles}`);
|
|
17559
|
+
}
|
|
17560
|
+
// Stub implementations (all no-op)
|
|
17561
|
+
async registerPic(name, data) {
|
|
17562
|
+
this.callLog.push(`registerPic(${name})`);
|
|
17563
|
+
return { width: 256, height: 256 };
|
|
17564
|
+
}
|
|
17565
|
+
registerTexture(name, texture) {
|
|
17566
|
+
this.callLog.push(`registerTexture(${name})`);
|
|
17567
|
+
return { width: texture.width, height: texture.height };
|
|
17568
|
+
}
|
|
17569
|
+
begin2D() {
|
|
17570
|
+
this.callLog.push("begin2D()");
|
|
17571
|
+
}
|
|
17572
|
+
end2D() {
|
|
17573
|
+
this.callLog.push("end2D()");
|
|
17574
|
+
}
|
|
17575
|
+
drawPic(x, y, pic, color) {
|
|
17576
|
+
this.callLog.push(`drawPic(${x}, ${y})`);
|
|
17577
|
+
}
|
|
17578
|
+
drawString(x, y, text, color) {
|
|
17579
|
+
this.callLog.push(`drawString(${x}, ${y}, "${text}")`);
|
|
17580
|
+
}
|
|
17581
|
+
drawCenterString(y, text) {
|
|
17582
|
+
this.callLog.push(`drawCenterString(${y}, "${text}")`);
|
|
17583
|
+
}
|
|
17584
|
+
drawfillRect(x, y, width, height, color) {
|
|
17585
|
+
this.callLog.push(`drawfillRect(${x}, ${y}, ${width}, ${height})`);
|
|
17586
|
+
}
|
|
17587
|
+
setEntityHighlight(entityId, color) {
|
|
17588
|
+
}
|
|
17589
|
+
clearEntityHighlight(entityId) {
|
|
17590
|
+
}
|
|
17591
|
+
highlightSurface(faceIndex, color) {
|
|
17592
|
+
}
|
|
17593
|
+
removeSurfaceHighlight(faceIndex) {
|
|
17594
|
+
}
|
|
17595
|
+
setDebugMode(mode) {
|
|
17596
|
+
}
|
|
17597
|
+
setBrightness(value) {
|
|
17598
|
+
}
|
|
17599
|
+
setGamma(value) {
|
|
17600
|
+
}
|
|
17601
|
+
setFullbright(enabled) {
|
|
17602
|
+
}
|
|
17603
|
+
setAmbient(value) {
|
|
17604
|
+
}
|
|
17605
|
+
setLightStyle(index, pattern) {
|
|
17606
|
+
}
|
|
17607
|
+
setUnderwaterWarp(enabled) {
|
|
17608
|
+
}
|
|
17609
|
+
setBloom(enabled) {
|
|
17610
|
+
}
|
|
17611
|
+
setBloomIntensity(value) {
|
|
17612
|
+
}
|
|
17613
|
+
setLodBias(bias) {
|
|
17614
|
+
}
|
|
17615
|
+
renderInstanced(model, instances) {
|
|
17616
|
+
}
|
|
17617
|
+
getPerformanceReport() {
|
|
17618
|
+
return {
|
|
17619
|
+
frameTimeMs: 0,
|
|
17620
|
+
gpuTimeMs: 0,
|
|
17621
|
+
cpuFrameTimeMs: 0,
|
|
17622
|
+
drawCalls: 0,
|
|
17623
|
+
triangles: 0,
|
|
17624
|
+
vertices: 0,
|
|
17625
|
+
textureBinds: 0,
|
|
17626
|
+
shaderSwitches: 0,
|
|
17627
|
+
visibleSurfaces: 0,
|
|
17628
|
+
culledSurfaces: 0,
|
|
17629
|
+
visibleEntities: 0,
|
|
17630
|
+
culledEntities: 0,
|
|
17631
|
+
memoryUsageMB: { textures: 0, geometry: 0, total: 0 }
|
|
17632
|
+
};
|
|
17633
|
+
}
|
|
17634
|
+
getMemoryUsage() {
|
|
17635
|
+
return {
|
|
17636
|
+
texturesBytes: 0,
|
|
17637
|
+
geometryBytes: 0,
|
|
17638
|
+
shadersBytes: 0,
|
|
17639
|
+
buffersBytes: 0,
|
|
17640
|
+
totalBytes: 0
|
|
17641
|
+
};
|
|
17642
|
+
}
|
|
17643
|
+
dispose() {
|
|
17644
|
+
this.callLog.push("dispose()");
|
|
17645
|
+
}
|
|
17646
|
+
// Test utilities
|
|
17647
|
+
getCallLog() {
|
|
17648
|
+
return this.callLog;
|
|
17649
|
+
}
|
|
17650
|
+
resetCallLog() {
|
|
17651
|
+
this.callLog = [];
|
|
17652
|
+
}
|
|
17653
|
+
getFrameCount() {
|
|
17654
|
+
return this.frameCount;
|
|
17655
|
+
}
|
|
17656
|
+
};
|
|
17657
|
+
|
|
17658
|
+
// src/render/types/coordinates.ts
|
|
17659
|
+
var CoordinateSystem = /* @__PURE__ */ ((CoordinateSystem2) => {
|
|
17660
|
+
CoordinateSystem2["QUAKE"] = "quake";
|
|
17661
|
+
CoordinateSystem2["OPENGL"] = "opengl";
|
|
17662
|
+
CoordinateSystem2["WEBGPU"] = "webgpu";
|
|
17663
|
+
return CoordinateSystem2;
|
|
17664
|
+
})(CoordinateSystem || {});
|
|
17665
|
+
|
|
17666
|
+
// src/render/matrix/webgl.ts
|
|
17667
|
+
var WebGLMatrixBuilder = class {
|
|
17668
|
+
constructor() {
|
|
17669
|
+
this.coordinateSystem = "opengl" /* OPENGL */;
|
|
17670
|
+
}
|
|
17671
|
+
buildProjectionMatrix(camera) {
|
|
17672
|
+
const projection = mat4.create();
|
|
17673
|
+
mat4.perspective(
|
|
17674
|
+
projection,
|
|
17675
|
+
camera.fov * DEG2RAD,
|
|
17676
|
+
camera.aspect,
|
|
17677
|
+
camera.near,
|
|
17678
|
+
camera.far
|
|
17679
|
+
);
|
|
17680
|
+
return projection;
|
|
17681
|
+
}
|
|
17682
|
+
buildViewMatrix(camera) {
|
|
17683
|
+
const quakeToGl = mat4.fromValues(
|
|
17684
|
+
0,
|
|
17685
|
+
0,
|
|
17686
|
+
-1,
|
|
17687
|
+
0,
|
|
17688
|
+
// Quake +X (forward) → GL -Z
|
|
17689
|
+
-1,
|
|
17690
|
+
0,
|
|
17691
|
+
0,
|
|
17692
|
+
0,
|
|
17693
|
+
// Quake +Y (left) → GL -X
|
|
17694
|
+
0,
|
|
17695
|
+
1,
|
|
17696
|
+
0,
|
|
17697
|
+
0,
|
|
17698
|
+
// Quake +Z (up) → GL +Y
|
|
17699
|
+
0,
|
|
17700
|
+
0,
|
|
17701
|
+
0,
|
|
17702
|
+
1
|
|
17703
|
+
);
|
|
17704
|
+
const [pitch, yaw, roll] = camera.angles;
|
|
17705
|
+
const pitchRad = pitch * DEG2RAD;
|
|
17706
|
+
const yawRad = yaw * DEG2RAD;
|
|
17707
|
+
const rollRad = roll * DEG2RAD;
|
|
17708
|
+
const rotationQuake = mat4.create();
|
|
17709
|
+
mat4.identity(rotationQuake);
|
|
17710
|
+
mat4.rotateZ(rotationQuake, rotationQuake, -yawRad);
|
|
17711
|
+
mat4.rotateY(rotationQuake, rotationQuake, -pitchRad);
|
|
17712
|
+
mat4.rotateX(rotationQuake, rotationQuake, -rollRad);
|
|
17713
|
+
const rotationGl = mat4.create();
|
|
17714
|
+
mat4.multiply(rotationGl, quakeToGl, rotationQuake);
|
|
17715
|
+
const negativePosition = vec3.negate(vec3.create(), camera.position);
|
|
17716
|
+
const rotatedPosQuake = vec3.create();
|
|
17717
|
+
vec3.transformMat4(rotatedPosQuake, negativePosition, rotationQuake);
|
|
17718
|
+
const translationGl = vec3.fromValues(
|
|
17719
|
+
rotatedPosQuake[1] ? -rotatedPosQuake[1] : 0,
|
|
17720
|
+
// Y → -X
|
|
17721
|
+
rotatedPosQuake[2] || 0,
|
|
17722
|
+
// Z → Y
|
|
17723
|
+
rotatedPosQuake[0] ? -rotatedPosQuake[0] : 0
|
|
17724
|
+
// X → -Z
|
|
17725
|
+
);
|
|
17726
|
+
const view = mat4.clone(rotationGl);
|
|
17727
|
+
view[12] = translationGl[0];
|
|
17728
|
+
view[13] = translationGl[1];
|
|
17729
|
+
view[14] = translationGl[2];
|
|
17730
|
+
return view;
|
|
17731
|
+
}
|
|
17732
|
+
};
|
|
17733
|
+
var WebGPUMatrixBuilder = class {
|
|
17734
|
+
constructor() {
|
|
17735
|
+
this.coordinateSystem = "webgpu" /* WEBGPU */;
|
|
17736
|
+
}
|
|
17737
|
+
buildProjectionMatrix(camera) {
|
|
17738
|
+
const projection = mat4.create();
|
|
17739
|
+
const f = 1 / Math.tan(camera.fov * DEG2RAD / 2);
|
|
17740
|
+
const rangeInv = 1 / (camera.near - camera.far);
|
|
17741
|
+
projection[0] = f / camera.aspect;
|
|
17742
|
+
projection[5] = f;
|
|
17743
|
+
projection[10] = camera.far * rangeInv;
|
|
17744
|
+
projection[11] = -1;
|
|
17745
|
+
projection[14] = camera.near * camera.far * rangeInv;
|
|
17746
|
+
return projection;
|
|
17747
|
+
}
|
|
17748
|
+
buildViewMatrix(camera) {
|
|
17749
|
+
const [pitch, yaw, roll] = camera.angles;
|
|
17750
|
+
const pitchRad = pitch * DEG2RAD;
|
|
17751
|
+
const yawRad = yaw * DEG2RAD;
|
|
17752
|
+
const rollRad = roll * DEG2RAD;
|
|
17753
|
+
const rotationQuake = mat4.create();
|
|
17754
|
+
mat4.identity(rotationQuake);
|
|
17755
|
+
mat4.rotateZ(rotationQuake, rotationQuake, -yawRad);
|
|
17756
|
+
mat4.rotateY(rotationQuake, rotationQuake, -pitchRad);
|
|
17757
|
+
mat4.rotateX(rotationQuake, rotationQuake, -rollRad);
|
|
17758
|
+
mat4.fromValues(
|
|
17759
|
+
0,
|
|
17760
|
+
0,
|
|
17761
|
+
-1,
|
|
17762
|
+
0,
|
|
17763
|
+
// Column 0: Quake X maps to View Z? Wait.
|
|
17764
|
+
-1,
|
|
17765
|
+
0,
|
|
17766
|
+
0,
|
|
17767
|
+
0,
|
|
17768
|
+
// Column 1: Quake Y maps to View X?
|
|
17769
|
+
0,
|
|
17770
|
+
1,
|
|
17771
|
+
0,
|
|
17772
|
+
0,
|
|
17773
|
+
// Column 2: Quake Z maps to View Y?
|
|
17774
|
+
0,
|
|
17775
|
+
0,
|
|
17776
|
+
0,
|
|
17777
|
+
1
|
|
17778
|
+
);
|
|
17779
|
+
const quakeToWgpu = mat4.fromValues(
|
|
17780
|
+
0,
|
|
17781
|
+
0,
|
|
17782
|
+
-1,
|
|
17783
|
+
0,
|
|
17784
|
+
// Col 0: X -> -Z
|
|
17785
|
+
-1,
|
|
17786
|
+
0,
|
|
17787
|
+
0,
|
|
17788
|
+
0,
|
|
17789
|
+
// Col 1: Y -> -X
|
|
17790
|
+
0,
|
|
17791
|
+
1,
|
|
17792
|
+
0,
|
|
17793
|
+
0,
|
|
17794
|
+
// Col 2: Z -> Y
|
|
17795
|
+
0,
|
|
17796
|
+
0,
|
|
17797
|
+
0,
|
|
17798
|
+
1
|
|
17799
|
+
);
|
|
17800
|
+
const rotationView = mat4.create();
|
|
17801
|
+
mat4.multiply(rotationView, quakeToWgpu, rotationQuake);
|
|
17802
|
+
const cameraPos = vec3.fromValues(
|
|
17803
|
+
camera.position[0],
|
|
17804
|
+
camera.position[1],
|
|
17805
|
+
camera.position[2]
|
|
17806
|
+
);
|
|
17807
|
+
const t = vec3.transformMat4(vec3.create(), cameraPos, rotationView);
|
|
17808
|
+
vec3.negate(t, t);
|
|
17809
|
+
const view = mat4.clone(rotationView);
|
|
17810
|
+
view[12] = t[0];
|
|
17811
|
+
view[13] = t[1];
|
|
17812
|
+
view[14] = t[2];
|
|
17813
|
+
return view;
|
|
17814
|
+
}
|
|
17815
|
+
};
|
|
17816
|
+
var IdentityMatrixBuilder = class {
|
|
17817
|
+
constructor() {
|
|
17818
|
+
this.coordinateSystem = "quake" /* QUAKE */;
|
|
17819
|
+
}
|
|
17820
|
+
buildProjectionMatrix(camera) {
|
|
17821
|
+
const projection = mat4.create();
|
|
17822
|
+
mat4.perspective(
|
|
17823
|
+
projection,
|
|
17824
|
+
camera.fov * DEG2RAD,
|
|
17825
|
+
camera.aspect,
|
|
17826
|
+
camera.near,
|
|
17827
|
+
camera.far
|
|
17828
|
+
);
|
|
17829
|
+
return projection;
|
|
17830
|
+
}
|
|
17831
|
+
buildViewMatrix(camera) {
|
|
17832
|
+
const [pitch, yaw, roll] = camera.angles;
|
|
17833
|
+
const pitchRad = pitch * DEG2RAD;
|
|
17834
|
+
const yawRad = yaw * DEG2RAD;
|
|
17835
|
+
const rollRad = roll * DEG2RAD;
|
|
17836
|
+
const rotation = mat4.create();
|
|
17837
|
+
mat4.identity(rotation);
|
|
17838
|
+
mat4.rotateZ(rotation, rotation, yawRad);
|
|
17839
|
+
mat4.rotateX(rotation, rotation, pitchRad);
|
|
17840
|
+
mat4.rotateY(rotation, rotation, rollRad);
|
|
17841
|
+
const translation = mat4.create();
|
|
17842
|
+
mat4.fromTranslation(translation, [
|
|
17843
|
+
-camera.position[0],
|
|
17844
|
+
-camera.position[1],
|
|
17845
|
+
-camera.position[2]
|
|
17846
|
+
]);
|
|
17847
|
+
const view = mat4.create();
|
|
17848
|
+
mat4.multiply(view, rotation, translation);
|
|
17849
|
+
return view;
|
|
17850
|
+
}
|
|
17851
|
+
};
|
|
17852
|
+
function buildMatrices(builder, camera) {
|
|
17853
|
+
const view = builder.buildViewMatrix(camera);
|
|
17854
|
+
const projection = builder.buildProjectionMatrix(camera);
|
|
17855
|
+
const viewProjection = mat4.create();
|
|
17856
|
+
mat4.multiply(viewProjection, projection, view);
|
|
17857
|
+
return { view, projection, viewProjection };
|
|
17858
|
+
}
|
|
17859
|
+
function quakeToWebGL(v) {
|
|
17860
|
+
return vec3.fromValues(-v[1], v[2], -v[0]);
|
|
17861
|
+
}
|
|
17862
|
+
function quakeToWebGPU(v) {
|
|
17863
|
+
return vec3.fromValues(-v[1], v[2], -v[0]);
|
|
17864
|
+
}
|
|
17865
|
+
|
|
17866
|
+
// src/render/logging/renderer.ts
|
|
17867
|
+
var LoggingRenderer = class {
|
|
17868
|
+
constructor(options = {}) {
|
|
17869
|
+
this.width = 0;
|
|
17870
|
+
this.height = 0;
|
|
17871
|
+
this.collisionVis = null;
|
|
17872
|
+
this.debug = null;
|
|
17873
|
+
this.particleSystem = null;
|
|
17874
|
+
this.logs = [];
|
|
17875
|
+
this.options = {
|
|
17876
|
+
targetSystem: options.targetSystem ?? "quake" /* QUAKE */,
|
|
17877
|
+
verbose: options.verbose ?? true,
|
|
17878
|
+
validateTransforms: options.validateTransforms ?? true
|
|
17879
|
+
};
|
|
17880
|
+
switch (this.options.targetSystem) {
|
|
17881
|
+
case "opengl" /* OPENGL */:
|
|
17882
|
+
this.builder = new WebGLMatrixBuilder();
|
|
17883
|
+
break;
|
|
17884
|
+
case "webgpu" /* WEBGPU */:
|
|
17885
|
+
this.builder = new WebGPUMatrixBuilder();
|
|
17886
|
+
break;
|
|
17887
|
+
default:
|
|
17888
|
+
this.builder = new IdentityMatrixBuilder();
|
|
17889
|
+
}
|
|
17890
|
+
this.log(`LoggingRenderer initialized (target=${this.options.targetSystem})`);
|
|
17891
|
+
}
|
|
17892
|
+
renderFrame(options, entities = []) {
|
|
17893
|
+
this.log(`
|
|
17894
|
+
=== FRAME START ===`);
|
|
17895
|
+
const cameraState = options.cameraState ?? options.camera.toState();
|
|
17896
|
+
this.log(`Camera State:`);
|
|
17897
|
+
this.log(` Position: ${this.formatVec3(cameraState.position)} (Quake space)`);
|
|
17898
|
+
this.log(` Angles: ${this.formatVec3(cameraState.angles)} (degrees)`);
|
|
17899
|
+
this.log(` FOV: ${cameraState.fov}\xB0, Aspect: ${cameraState.aspect.toFixed(2)}`);
|
|
17900
|
+
const matrices = buildMatrices(this.builder, cameraState);
|
|
17901
|
+
this.log(`Matrices (${this.options.targetSystem}):`);
|
|
17902
|
+
if (this.options.verbose) {
|
|
17903
|
+
this.log(` View Matrix:`);
|
|
17904
|
+
this.logMatrix(matrices.view);
|
|
17905
|
+
this.log(` Projection Matrix:`);
|
|
17906
|
+
this.logMatrix(matrices.projection);
|
|
17907
|
+
}
|
|
17908
|
+
if (this.options.validateTransforms) {
|
|
17909
|
+
this.validateCoordinateTransforms(cameraState, matrices.view);
|
|
17910
|
+
}
|
|
17911
|
+
this.log(`Entities: ${entities.length}`);
|
|
17912
|
+
if (this.options.verbose && entities.length > 0) {
|
|
17913
|
+
entities.slice(0, 5).forEach((entity, i) => {
|
|
17914
|
+
this.log(` [${i}] type=${entity.type}, model=${entity.model ?? "none"}`);
|
|
17915
|
+
});
|
|
17916
|
+
if (entities.length > 5) {
|
|
17917
|
+
this.log(` ... and ${entities.length - 5} more`);
|
|
17918
|
+
}
|
|
17919
|
+
}
|
|
17920
|
+
this.log(`=== FRAME END ===
|
|
17921
|
+
`);
|
|
17922
|
+
}
|
|
17923
|
+
validateCoordinateTransforms(cameraState, viewMatrix) {
|
|
17924
|
+
const quakePos = cameraState.position;
|
|
17925
|
+
const expectedGL = quakeToWebGL(quakePos);
|
|
17926
|
+
const expectedGPU = quakeToWebGPU(quakePos);
|
|
17927
|
+
const matrixTranslation = [viewMatrix[12], viewMatrix[13], viewMatrix[14]];
|
|
17928
|
+
this.log(`Transform Validation:`);
|
|
17929
|
+
this.log(` Quake position: ${this.formatVec3(quakePos)}`);
|
|
17930
|
+
switch (this.options.targetSystem) {
|
|
17931
|
+
case "opengl" /* OPENGL */:
|
|
17932
|
+
this.log(` Expected GL transform: ${this.formatVec3(expectedGL)}`);
|
|
17933
|
+
break;
|
|
17934
|
+
case "webgpu" /* WEBGPU */:
|
|
17935
|
+
this.log(` Expected WebGPU transform: ${this.formatVec3(expectedGPU)}`);
|
|
17936
|
+
break;
|
|
17937
|
+
}
|
|
17938
|
+
this.log(` Matrix translation: [${matrixTranslation.map((v) => v.toFixed(2)).join(", ")}]`);
|
|
17939
|
+
const posSum = Math.abs(quakePos[0]) + Math.abs(quakePos[1]) + Math.abs(quakePos[2]);
|
|
17940
|
+
const matSum = Math.abs(matrixTranslation[0]) + Math.abs(matrixTranslation[1]) + Math.abs(matrixTranslation[2]);
|
|
17941
|
+
if (posSum > 0 && matSum / posSum > 2) {
|
|
17942
|
+
this.log(` \u26A0\uFE0F WARNING: Matrix translation seems large relative to input - possible double-transform!`);
|
|
17943
|
+
}
|
|
17944
|
+
}
|
|
17945
|
+
formatVec3(v) {
|
|
17946
|
+
return `[${v[0].toFixed(2)}, ${v[1].toFixed(2)}, ${v[2].toFixed(2)}]`;
|
|
17947
|
+
}
|
|
17948
|
+
logMatrix(m) {
|
|
17949
|
+
for (let row = 0; row < 4; row++) {
|
|
17950
|
+
const values = [m[row], m[row + 4], m[row + 8], m[row + 12]];
|
|
17951
|
+
this.log(` [${values.map((v) => v.toFixed(4).padStart(8)).join(" ")}]`);
|
|
17952
|
+
}
|
|
17953
|
+
}
|
|
17954
|
+
log(message) {
|
|
17955
|
+
this.logs.push(message);
|
|
17956
|
+
if (this.options.verbose) {
|
|
17957
|
+
console.log(`[LogRenderer] ${message}`);
|
|
17958
|
+
}
|
|
17959
|
+
}
|
|
17960
|
+
// Stub implementations (with logging)
|
|
17961
|
+
async registerPic(name, data) {
|
|
17962
|
+
this.log(`registerPic("${name}", ${data.byteLength} bytes)`);
|
|
17963
|
+
return { width: 256, height: 256 };
|
|
17964
|
+
}
|
|
17965
|
+
registerTexture(name, texture) {
|
|
17966
|
+
this.log(`registerTexture("${name}", ${texture.width}x${texture.height})`);
|
|
17967
|
+
return { width: texture.width, height: texture.height };
|
|
17968
|
+
}
|
|
17969
|
+
begin2D() {
|
|
17970
|
+
this.log("begin2D()");
|
|
17971
|
+
}
|
|
17972
|
+
end2D() {
|
|
17973
|
+
this.log("end2D()");
|
|
17974
|
+
}
|
|
17975
|
+
drawPic(x, y, pic, color) {
|
|
17976
|
+
this.log(`drawPic(${x}, ${y})`);
|
|
17977
|
+
}
|
|
17978
|
+
drawString(x, y, text, color) {
|
|
17979
|
+
this.log(`drawString(${x}, ${y}, "${text}")`);
|
|
17980
|
+
}
|
|
17981
|
+
drawCenterString(y, text) {
|
|
17982
|
+
this.log(`drawCenterString(${y}, "${text}")`);
|
|
17983
|
+
}
|
|
17984
|
+
drawfillRect(x, y, width, height, color) {
|
|
17985
|
+
this.log(`drawfillRect(${x}, ${y}, ${width}x${height})`);
|
|
17986
|
+
}
|
|
17987
|
+
// All other IRenderer methods as no-ops
|
|
17988
|
+
setEntityHighlight(entityId, color) {
|
|
17989
|
+
}
|
|
17990
|
+
clearEntityHighlight(entityId) {
|
|
17991
|
+
}
|
|
17992
|
+
highlightSurface(faceIndex, color) {
|
|
17993
|
+
}
|
|
17994
|
+
removeSurfaceHighlight(faceIndex) {
|
|
17995
|
+
}
|
|
17996
|
+
setDebugMode(mode) {
|
|
17997
|
+
}
|
|
17998
|
+
setBrightness(value) {
|
|
17999
|
+
}
|
|
18000
|
+
setGamma(value) {
|
|
18001
|
+
}
|
|
18002
|
+
setFullbright(enabled) {
|
|
18003
|
+
}
|
|
18004
|
+
setAmbient(value) {
|
|
18005
|
+
}
|
|
18006
|
+
setLightStyle(index, pattern) {
|
|
18007
|
+
}
|
|
18008
|
+
setUnderwaterWarp(enabled) {
|
|
18009
|
+
}
|
|
18010
|
+
setBloom(enabled) {
|
|
18011
|
+
}
|
|
18012
|
+
setBloomIntensity(value) {
|
|
18013
|
+
}
|
|
18014
|
+
setLodBias(bias) {
|
|
18015
|
+
}
|
|
18016
|
+
renderInstanced(model, instances) {
|
|
18017
|
+
}
|
|
18018
|
+
getPerformanceReport() {
|
|
18019
|
+
return {
|
|
18020
|
+
frameTimeMs: 0,
|
|
18021
|
+
gpuTimeMs: 0,
|
|
18022
|
+
cpuFrameTimeMs: 0,
|
|
18023
|
+
drawCalls: 0,
|
|
18024
|
+
triangles: 0,
|
|
18025
|
+
vertices: 0,
|
|
18026
|
+
textureBinds: 0,
|
|
18027
|
+
shaderSwitches: 0,
|
|
18028
|
+
visibleSurfaces: 0,
|
|
18029
|
+
culledSurfaces: 0,
|
|
18030
|
+
visibleEntities: 0,
|
|
18031
|
+
culledEntities: 0,
|
|
18032
|
+
memoryUsageMB: { textures: 0, geometry: 0, total: 0 }
|
|
18033
|
+
};
|
|
18034
|
+
}
|
|
18035
|
+
getMemoryUsage() {
|
|
18036
|
+
return {
|
|
18037
|
+
texturesBytes: 0,
|
|
18038
|
+
geometryBytes: 0,
|
|
18039
|
+
shadersBytes: 0,
|
|
18040
|
+
buffersBytes: 0,
|
|
18041
|
+
totalBytes: 0
|
|
18042
|
+
};
|
|
18043
|
+
}
|
|
18044
|
+
dispose() {
|
|
18045
|
+
this.log("dispose()");
|
|
18046
|
+
}
|
|
18047
|
+
// Test utilities
|
|
18048
|
+
getLogs() {
|
|
18049
|
+
return this.logs;
|
|
18050
|
+
}
|
|
18051
|
+
resetLogs() {
|
|
18052
|
+
this.logs = [];
|
|
18053
|
+
}
|
|
18054
|
+
printLogs() {
|
|
18055
|
+
console.log(this.logs.join("\n"));
|
|
18056
|
+
}
|
|
18057
|
+
};
|
|
17540
18058
|
var ConnectionState = /* @__PURE__ */ ((ConnectionState2) => {
|
|
17541
18059
|
ConnectionState2[ConnectionState2["Disconnected"] = 0] = "Disconnected";
|
|
17542
18060
|
ConnectionState2[ConnectionState2["Connecting"] = 1] = "Connecting";
|
|
@@ -17825,6 +18343,6 @@ pako/dist/pako.esm.mjs:
|
|
|
17825
18343
|
(*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) *)
|
|
17826
18344
|
*/
|
|
17827
18345
|
|
|
17828
|
-
export { AssetDependencyError, AssetDependencyTracker, AssetManager, AssetPreviewGenerator, AudioApi, AudioContextController, AudioOcclusion, AudioRegistry, AudioRegistryError, AudioSystem, BSP_SURFACE_FRAGMENT_SOURCE, BSP_SURFACE_VERTEX_SOURCE, BSP_VERTEX_LAYOUT, BspLoader, BspParseError, BspSurfacePipeline, Camera, ClientConnection, Command, CommandRegistry, ConfigStringRegistry, ConnectionState, Cvar, CvarRegistry, DemoAnalyzer, DemoCameraMode, DemoClipper, DemoEventType, DemoPlaybackController, DemoReader, DemoRecorder, DemoValidator, DynamicLightManager, EngineHost, EngineRuntime, FileType, FixedTimestepLoop, Framebuffer, IndexBuffer, LruCache, MD2_FRAGMENT_SHADER, MD2_VERTEX_SHADER, MD3_FRAGMENT_SHADER, MD3_VERTEX_SHADER, MapAnalyzer, Md2Loader, Md2MeshBuffers, Md2ParseError, Md2Pipeline, Md3Loader, Md3ModelMesh, Md3ParseError, Md3Pipeline, Md3SurfaceMesh, MessageWriter, MusicSystem, NetworkMessageParser, PARTICLE_FRAGMENT_SHADER, PARTICLE_VERTEX_SHADER, PROTOCOL_VERSION_RERELEASE, PakArchive, PakIndexStore, PakIngestionError, PakParseError, PakValidationError, PakValidator, PakWriter, ParticleRenderer, ParticleSystem, PlaybackState, RERELEASE_KNOWN_PAKS, ResourceLoadTracker, ResourceType, SKYBOX_FRAGMENT_SHADER, SKYBOX_VERTEX_SHADER, ShaderProgram, SkyboxPipeline, SoundPrecache, SoundRegistry, SpriteLoader, SpriteParseError, SpriteRenderer, StreamingPakArchive, Texture2D, TextureCache, TextureCubeMap, TgaParseError, VertexArray, VertexBuffer, VirtualFileSystem, advanceAnimation, applyEntityDelta, applySurfaceState, boxIntersectsFrustum, buildBspGeometry, buildMd2Geometry, buildMd2VertexData, buildMd3SurfaceGeometry, buildMd3VertexData, calculatePakChecksum, captureRenderTarget, computeFrameBlend, computeSkyScroll, createAnimationState, createAudioGraph, createBspSurfaces, createEmptyEntityState, createEmptyProtocolPlayerState, createEngine, createEngineRuntime, createFaceLightmap, createHeadlessRenderTarget, createInitialChannels, createOcclusionResolver, createProgramFromSources, createRenderer, createWebGLContext, createWebGPUContext, decodeOgg, deriveSurfaceRenderState, detectFileType, extractFrustumPlanes, filesToPakSources, findLeafForPoint, gatherVisibleFaces, groupMd2Animations, ingestPakFiles, ingestPaks, interpolateMd3Tag, interpolateVec3, isBinaryFile, isTextFile, parseBsp, parseEntLump, parseMd2, parseMd3, parsePcx, parseSprite, parseTga, parseWal, parseWalTexture, parseWav, pcxToRgba, pickChannel, preparePcxTexture, queryCapabilities, removeViewTranslation, resolveLightStyles, serializeEntLump, spawnBfgExplosion, spawnBlasterImpact, spawnBlood, spawnBulletImpact, spawnExplosion, spawnMuzzleFlash, spawnRailTrail, spawnSparks, spawnSplash, spawnSteam, spawnTeleportFlash, spawnTrail, validateEntity, walToRgba, wireDropTarget, wireFileInput };
|
|
18346
|
+
export { AssetDependencyError, AssetDependencyTracker, AssetManager, AssetPreviewGenerator, AudioApi, AudioContextController, AudioOcclusion, AudioRegistry, AudioRegistryError, AudioSystem, BSP_SURFACE_FRAGMENT_SOURCE, BSP_SURFACE_VERTEX_SOURCE, BSP_VERTEX_LAYOUT, BspLoader, BspParseError, BspSurfacePipeline, Camera, ClientConnection, Command, CommandRegistry, ConfigStringRegistry, ConnectionState, CoordinateSystem, Cvar, CvarRegistry, DemoAnalyzer, DemoCameraMode, DemoClipper, DemoEventType, DemoPlaybackController, DemoReader, DemoRecorder, DemoValidator, DynamicLightManager, EngineHost, EngineRuntime, FileType, FixedTimestepLoop, Framebuffer, IndexBuffer, LoggingRenderer, LruCache, MD2_FRAGMENT_SHADER, MD2_VERTEX_SHADER, MD3_FRAGMENT_SHADER, MD3_VERTEX_SHADER, MapAnalyzer, Md2Loader, Md2MeshBuffers, Md2ParseError, Md2Pipeline, Md3Loader, Md3ModelMesh, Md3ParseError, Md3Pipeline, Md3SurfaceMesh, MessageWriter, MusicSystem, NetworkMessageParser, NullRenderer, PARTICLE_FRAGMENT_SHADER, PARTICLE_VERTEX_SHADER, PROTOCOL_VERSION_RERELEASE, PakArchive, PakIndexStore, PakIngestionError, PakParseError, PakValidationError, PakValidator, PakWriter, ParticleRenderer, ParticleSystem, PlaybackState, RERELEASE_KNOWN_PAKS, ResourceLoadTracker, ResourceType, SKYBOX_FRAGMENT_SHADER, SKYBOX_VERTEX_SHADER, ShaderProgram, SkyboxPipeline, SoundPrecache, SoundRegistry, SpriteLoader, SpriteParseError, SpriteRenderer, StreamingPakArchive, Texture2D, TextureCache, TextureCubeMap, TgaParseError, VertexArray, VertexBuffer, VirtualFileSystem, advanceAnimation, applyEntityDelta, applySurfaceState, boxIntersectsFrustum, buildBspGeometry, buildMd2Geometry, buildMd2VertexData, buildMd3SurfaceGeometry, buildMd3VertexData, calculatePakChecksum, captureRenderTarget, computeFrameBlend, computeSkyScroll, createAnimationState, createAudioGraph, createBspSurfaces, createEmptyEntityState, createEmptyProtocolPlayerState, createEngine, createEngineRuntime, createFaceLightmap, createHeadlessRenderTarget, createInitialChannels, createOcclusionResolver, createProgramFromSources, createRenderer, createWebGLContext, createWebGPUContext, decodeOgg, deriveSurfaceRenderState, detectFileType, extractFrustumPlanes, filesToPakSources, findLeafForPoint, gatherVisibleFaces, groupMd2Animations, ingestPakFiles, ingestPaks, interpolateMd3Tag, interpolateVec3, isBinaryFile, isTextFile, parseBsp, parseEntLump, parseMd2, parseMd3, parsePcx, parseSprite, parseTga, parseWal, parseWalTexture, parseWav, pcxToRgba, pickChannel, preparePcxTexture, queryCapabilities, removeViewTranslation, resolveLightStyles, serializeEntLump, spawnBfgExplosion, spawnBlasterImpact, spawnBlood, spawnBulletImpact, spawnExplosion, spawnMuzzleFlash, spawnRailTrail, spawnSparks, spawnSplash, spawnSteam, spawnTeleportFlash, spawnTrail, validateEntity, walToRgba, wireDropTarget, wireFileInput };
|
|
17829
18347
|
//# sourceMappingURL=index.js.map
|
|
17830
18348
|
//# sourceMappingURL=index.js.map
|