holy shit finally nuke shadows out of the engine

This commit is contained in:
RandomityGuy 2024-07-12 00:54:54 +05:30
parent e216be4ec9
commit 602e662503
6 changed files with 26 additions and 6 deletions

View file

@ -27,6 +27,8 @@ class Debug {
debugTriangles.remove(); debugTriangles.remove();
} }
debugTriangles = new h3d.scene.Mesh(prim, h3d.mat.Material.create()); debugTriangles = new h3d.scene.Mesh(prim, h3d.mat.Material.create());
debugTriangles.material.receiveShadows = false;
debugTriangles.material.castShadows = false;
prim.addUVs(); prim.addUVs();
prim.addNormals(); prim.addNormals();
MarbleGame.instance.scene.addChild(debugTriangles); MarbleGame.instance.scene.addChild(debugTriangles);

View file

@ -832,20 +832,20 @@ class DifBuilder {
thisprops.light = false; // We will calculate our own lighting thisprops.light = false; // We will calculate our own lighting
material.props = thisprops; material.props = thisprops;
material.shadows = false; material.shadows = false;
material.receiveShadows = true; material.receiveShadows = false;
fwd(); fwd();
}); });
}); });
prim.addTangents(); prim.addTangents();
} else { } else {
material.shadows = false; material.shadows = false;
material.receiveShadows = true; material.receiveShadows = false;
} }
} else { } else {
Console.warn('Unable to load ${grp} texture for dif ${path}'); Console.warn('Unable to load ${grp} texture for dif ${path}');
material = Material.create(); material = Material.create();
material.shadows = false; material.shadows = false;
material.receiveShadows = true; material.receiveShadows = false;
} }
// material.mainPass.addShader(new h3d.shader.pbr.PropsValues(1, 0, 0, 1)); // material.mainPass.addShader(new h3d.shader.pbr.PropsValues(1, 0, 0, 1));
if (Debug.wireFrame) if (Debug.wireFrame)

View file

@ -425,7 +425,7 @@ class DtsObject extends GameObject {
} }
material.shadows = false; material.shadows = false;
if (this.isCollideable) if (this.isCollideable)
material.receiveShadows = true; material.receiveShadows = false;
if (material.texture == null && !iflMaterial) { if (material.texture == null && !iflMaterial) {
var dtsshader = new DtsTexture(); var dtsshader = new DtsTexture();
dtsshader.currentOpacity = 1; dtsshader.currentOpacity = 1;

View file

@ -1,5 +1,6 @@
package src; package src;
import h3d.Vector;
import src.Console; import src.Console;
class Renderer extends h3d.scene.Renderer { class Renderer extends h3d.scene.Renderer {
@ -29,8 +30,18 @@ class Renderer extends h3d.scene.Renderer {
} }
override function render() { override function render() {
if (has("shadow")) // if (has("shadow"))
renderPass(shadow, get("shadow")); // renderPass(shadow, get("shadow"));
// The shadow bullshit
ctx.setGlobalID(@:privateAccess shadow.shadowMapId, {
texture: @:privateAccess shadow.dshader.shadowMap,
channel: @:privateAccess shadow.format == h3d.mat.Texture.nativeFormat ? hxsl.Channel.PackedFloat : hxsl.Channel.R
});
ctx.setGlobalID(@:privateAccess shadow.shadowProjId, @:privateAccess shadow.getShadowProj());
ctx.setGlobalID(@:privateAccess shadow.shadowColorId, new Vector(0, 0, 0, 0));
ctx.setGlobalID(@:privateAccess shadow.shadowPowerId, 0.0);
ctx.setGlobalID(@:privateAccess shadow.shadowBiasId, 0.0);
renderPass(defaultPass, get("skyshape")); renderPass(defaultPass, get("skyshape"));
renderPass(defaultPass, get("default")); renderPass(defaultPass, get("default"));

View file

@ -27,10 +27,12 @@ class BoxCollisionEntity extends CollisionEntity implements IBVHObject {
if (Debug.drawBounds) { if (Debug.drawBounds) {
if (_dbgEntity == null) { if (_dbgEntity == null) {
_dbgEntity = cast this.boundingBox.makeDebugObj(); _dbgEntity = cast this.boundingBox.makeDebugObj();
_dbgEntity.getMaterials()[0].castShadows = false;
_dbgEntity.getMaterials()[0].mainPass.wireframe = true; _dbgEntity.getMaterials()[0].mainPass.wireframe = true;
MarbleGame.instance.scene.addChild(_dbgEntity); MarbleGame.instance.scene.addChild(_dbgEntity);
} else { } else {
_dbgEntity = cast this.boundingBox.makeDebugObj(); _dbgEntity = cast this.boundingBox.makeDebugObj();
_dbgEntity.getMaterials()[0].castShadows = false;
_dbgEntity.getMaterials()[0].mainPass.wireframe = true; _dbgEntity.getMaterials()[0].mainPass.wireframe = true;
MarbleGame.instance.scene.addChild(_dbgEntity); MarbleGame.instance.scene.addChild(_dbgEntity);
} }
@ -42,6 +44,7 @@ class BoxCollisionEntity extends CollisionEntity implements IBVHObject {
if (Debug.drawBounds) { if (Debug.drawBounds) {
if (_dbgEntity != null) { if (_dbgEntity != null) {
_dbgEntity = cast this.boundingBox.makeDebugObj(); _dbgEntity = cast this.boundingBox.makeDebugObj();
_dbgEntity.getMaterials()[0].castShadows = false;
_dbgEntity.getMaterials()[0].mainPass.wireframe = true; _dbgEntity.getMaterials()[0].mainPass.wireframe = true;
MarbleGame.instance.scene.addChild(_dbgEntity); MarbleGame.instance.scene.addChild(_dbgEntity);
} }

View file

@ -114,11 +114,13 @@ class CollisionEntity implements IOctreeObject implements IBVHObject {
if (Debug.drawBounds) { if (Debug.drawBounds) {
if (_dbgEntity == null) { if (_dbgEntity == null) {
_dbgEntity = cast this.boundingBox.makeDebugObj(); _dbgEntity = cast this.boundingBox.makeDebugObj();
_dbgEntity.getMaterials()[0].castShadows = false;
_dbgEntity.getMaterials()[0].mainPass.wireframe = true; _dbgEntity.getMaterials()[0].mainPass.wireframe = true;
MarbleGame.instance.scene.addChild(_dbgEntity); MarbleGame.instance.scene.addChild(_dbgEntity);
} else { } else {
_dbgEntity.remove(); _dbgEntity.remove();
_dbgEntity = cast this.boundingBox.makeDebugObj(); _dbgEntity = cast this.boundingBox.makeDebugObj();
_dbgEntity.getMaterials()[0].castShadows = false;
_dbgEntity.getMaterials()[0].mainPass.wireframe = true; _dbgEntity.getMaterials()[0].mainPass.wireframe = true;
MarbleGame.instance.scene.addChild(_dbgEntity); MarbleGame.instance.scene.addChild(_dbgEntity);
} }
@ -143,11 +145,13 @@ class CollisionEntity implements IOctreeObject implements IBVHObject {
if (Debug.drawBounds) { if (Debug.drawBounds) {
if (_dbgEntity == null) { if (_dbgEntity == null) {
_dbgEntity = cast this.boundingBox.makeDebugObj(); _dbgEntity = cast this.boundingBox.makeDebugObj();
_dbgEntity.getMaterials()[0].castShadows = false;
_dbgEntity.getMaterials()[0].mainPass.wireframe = true; _dbgEntity.getMaterials()[0].mainPass.wireframe = true;
MarbleGame.instance.scene.addChild(_dbgEntity); MarbleGame.instance.scene.addChild(_dbgEntity);
} else { } else {
_dbgEntity.remove(); _dbgEntity.remove();
_dbgEntity = cast this.boundingBox.makeDebugObj(); _dbgEntity = cast this.boundingBox.makeDebugObj();
_dbgEntity.getMaterials()[0].castShadows = false;
_dbgEntity.getMaterials()[0].mainPass.wireframe = true; _dbgEntity.getMaterials()[0].mainPass.wireframe = true;
MarbleGame.instance.scene.addChild(_dbgEntity); MarbleGame.instance.scene.addChild(_dbgEntity);
} }