mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-01-01 04:42:15 +00:00
endgameshit and shadows
This commit is contained in:
parent
8b1615ccae
commit
a94434778b
7 changed files with 46 additions and 11 deletions
|
|
@ -306,6 +306,7 @@ class DifBuilder {
|
|||
material = Material.create();
|
||||
}
|
||||
material.shadows = false;
|
||||
material.receiveShadows = true;
|
||||
// material.mainPass.addShader(new h3d.shader.pbr.PropsValues(1, 0, 0, 1));
|
||||
// material.mainPass.wireframe = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -347,6 +347,7 @@ class DtsObject extends GameObject {
|
|||
// }
|
||||
// TODO TRANSLUENCY SHIT
|
||||
}
|
||||
material.shadows = false;
|
||||
if (material.texture == null) {
|
||||
var dtsshader = new DtsTexture();
|
||||
dtsshader.currentOpacity = 1;
|
||||
|
|
@ -357,6 +358,7 @@ class DtsObject extends GameObject {
|
|||
texture.uploadBitmap(bitmap);
|
||||
dtsshader.texture = texture;
|
||||
material.mainPass.addShader(dtsshader);
|
||||
material.receiveShadows = true;
|
||||
}
|
||||
if (flags & 4 > 0) {
|
||||
material.blendMode = BlendMode.Alpha;
|
||||
|
|
@ -369,11 +371,13 @@ class DtsObject extends GameObject {
|
|||
// material.mainPass.setPassName("overlay");
|
||||
// material.textureShader.additive = true;
|
||||
}
|
||||
if (flags & 16 > 0)
|
||||
if (flags & 16 > 0) {
|
||||
material.blendMode = BlendMode.Sub;
|
||||
}
|
||||
|
||||
if (flags & 32 > 0) {
|
||||
material.mainPass.enableLights = false;
|
||||
// material.receiveShadows = false;
|
||||
// material.mainPass.setPassName("overlay");
|
||||
// var pbrprops = material.mainPass.getShader(h3d.shader.pbr.PropsValues);
|
||||
// pbrprops.emissiveValue = 1;
|
||||
|
|
@ -387,8 +391,6 @@ class DtsObject extends GameObject {
|
|||
// }
|
||||
// ((flags & 32) || environmentMaterial) ? new Materia
|
||||
|
||||
material.shadows = false;
|
||||
|
||||
// material.mainPass.addShader(new AlphaMult());
|
||||
|
||||
this.materials.push(material);
|
||||
|
|
|
|||
|
|
@ -165,6 +165,7 @@ class Marble extends GameObject {
|
|||
var marbleTexture = ResourceLoader.loader.load("data/shapes/balls/base.marble.png").toTexture();
|
||||
var marbleMaterial = Material.create(marbleTexture);
|
||||
marbleMaterial.shadows = false;
|
||||
marbleMaterial.castShadows = true;
|
||||
var obj = new Mesh(geom, marbleMaterial, this);
|
||||
obj.scale(_radius);
|
||||
|
||||
|
|
|
|||
|
|
@ -31,10 +31,14 @@ class MarbleGame {
|
|||
|
||||
public function update(dt:Float) {
|
||||
if (world != null) {
|
||||
if (world._disposed) {
|
||||
world = null;
|
||||
return;
|
||||
}
|
||||
if (!paused) {
|
||||
world.update(dt);
|
||||
}
|
||||
if (Key.isPressed(Key.ESCAPE)) {
|
||||
if (Key.isPressed(Key.ESCAPE) && world.finishTime == null) {
|
||||
paused = !paused;
|
||||
if (paused) {
|
||||
world.setCursorLock(false);
|
||||
|
|
@ -79,7 +83,7 @@ class MarbleGame {
|
|||
}
|
||||
|
||||
public function render(e:h3d.Engine) {
|
||||
if (world != null)
|
||||
if (world != null && !world._disposed)
|
||||
world.render(e);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package src;
|
||||
|
||||
import gui.PlayMissionGui;
|
||||
import src.MarbleGame;
|
||||
import gui.EndGameGui;
|
||||
import sdl.Cursor;
|
||||
|
|
@ -107,6 +108,8 @@ class MarbleWorld extends Scheduler {
|
|||
/** The new target camera orientation quat */
|
||||
public var newOrientationQuat = new Quat();
|
||||
|
||||
public var _disposed:Bool = false;
|
||||
|
||||
public function new(scene:Scene, scene2d:h2d.Scene, mission:Mission) {
|
||||
this.scene = scene;
|
||||
this.scene2d = scene2d;
|
||||
|
|
@ -170,6 +173,9 @@ class MarbleWorld extends Scheduler {
|
|||
|
||||
scene.lightSystem.ambientLight.load(ambientColor);
|
||||
|
||||
var shadow = scene.renderer.getPass(h3d.pass.DefaultShadowMap);
|
||||
shadow.power = 0.5;
|
||||
|
||||
var sunlight = new DirLight(sunDirection, scene);
|
||||
sunlight.color = directionalColor;
|
||||
}
|
||||
|
|
@ -221,6 +227,7 @@ class MarbleWorld extends Scheduler {
|
|||
this.marble.camera.CameraYaw = euler.z - Math.PI / 2;
|
||||
this.marble.camera.CameraPitch = -0.45;
|
||||
this.marble.camera.oob = false;
|
||||
this.marble.camera.finish = false;
|
||||
this.marble.mode = Start;
|
||||
this.marble.startPad = cast startquat.pad;
|
||||
sky.follow = marble;
|
||||
|
|
@ -789,7 +796,16 @@ class MarbleWorld extends Scheduler {
|
|||
}
|
||||
|
||||
function showFinishScreen() {
|
||||
MarbleGame.canvas.pushDialog(new EndGameGui());
|
||||
var egg:EndGameGui = null;
|
||||
egg = new EndGameGui((sender) -> {
|
||||
this.dispose();
|
||||
MarbleGame.canvas.setContent(new PlayMissionGui());
|
||||
}, (sender) -> {
|
||||
MarbleGame.canvas.popDialog(egg);
|
||||
this.setCursorLock(true);
|
||||
this.restart();
|
||||
});
|
||||
MarbleGame.canvas.pushDialog(egg);
|
||||
this.setCursorLock(false);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -888,6 +904,7 @@ class MarbleWorld extends Scheduler {
|
|||
public function dispose() {
|
||||
this.playGui.dispose();
|
||||
scene.removeChildren();
|
||||
this._disposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class Sky extends Object {
|
|||
// This is such a hack
|
||||
// skyMesh.material.mainPass.addShader(new h3d.shader.pbr.PropsValues(1, 0, 0, 1));
|
||||
skyMesh.material.mainPass.enableLights = false;
|
||||
skyMesh.material.receiveShadows = false;
|
||||
skyMesh.material.shadows = false;
|
||||
skyMesh.material.blendMode = None;
|
||||
// var pbrprops = skyMesh.material.mainPass.getShader(PropsValues);
|
||||
// pbrprops.emissiveValue = 1;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import h3d.Vector;
|
|||
import src.ResourceLoader;
|
||||
|
||||
class EndGameGui extends GuiControl {
|
||||
public function new() {
|
||||
public function new(continueFunc:GuiControl->Void, restartFunc:GuiControl->Void) {
|
||||
super();
|
||||
this.horizSizing = Width;
|
||||
this.vertSizing = Height;
|
||||
|
|
@ -31,12 +31,14 @@ class EndGameGui extends GuiControl {
|
|||
continueButton.vertSizing = Bottom;
|
||||
continueButton.position = new Vector(333, 386);
|
||||
continueButton.extent = new Vector(113, 47);
|
||||
continueButton.pressedAction = continueFunc;
|
||||
|
||||
var restartButton = new GuiButton(loadButtonImages("data/ui/endgame/replay"));
|
||||
restartButton.horizSizing = Right;
|
||||
restartButton.vertSizing = Bottom;
|
||||
restartButton.position = new Vector(51, 388);
|
||||
restartButton.extent = new Vector(104, 48);
|
||||
restartButton.pressedAction = restartFunc;
|
||||
|
||||
var arial14fontdata = ResourceLoader.loader.load("data/font/Arial14.fnt");
|
||||
var arial14 = new BitmapFont(arial14fontdata.entry);
|
||||
|
|
@ -65,12 +67,12 @@ class EndGameGui extends GuiControl {
|
|||
}
|
||||
}
|
||||
|
||||
var congrats = new GuiText(expo50);
|
||||
var congrats = new GuiMLText(expo50, mlFontLoader);
|
||||
congrats.text.textColor = 0xffff00;
|
||||
congrats.text.text = "Final Time:";
|
||||
congrats.text.text = 'Final Time: <font color="#FFF090">99:59.999</font>';
|
||||
congrats.text.filter = new DropShadow(1.414, 0.785, 0, 1, 0, 0.4, 1, true);
|
||||
congrats.position = new Vector(43, 17);
|
||||
congrats.extent = new Vector(208, 50);
|
||||
congrats.extent = new Vector(408, 50);
|
||||
pg.addChild(congrats);
|
||||
|
||||
var finishMessage = new GuiText(expo32);
|
||||
|
|
@ -90,6 +92,14 @@ class EndGameGui extends GuiControl {
|
|||
leftColumn.extent = new Vector(208, 50);
|
||||
pg.addChild(leftColumn);
|
||||
|
||||
var rightColumn = new GuiMLText(domcasual32, mlFontLoader);
|
||||
rightColumn.text.textColor = 0x000000;
|
||||
rightColumn.text.text = '99:59.999<br/>99:59.999<br/>99:59.999<br/>99:59.999<br/><font face="Arial14"><br/></font><br/>99:59.999<br/>99:59.999<br/>99:59.999';
|
||||
rightColumn.text.filter = new DropShadow(1.414, 0.785, 0xffffff, 1, 0, 0.4, 1, true);
|
||||
rightColumn.position = new Vector(274, 103);
|
||||
rightColumn.extent = new Vector(208, 50);
|
||||
pg.addChild(rightColumn);
|
||||
|
||||
pg.addChild(continueButton);
|
||||
pg.addChild(restartButton);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue