marble reflection things and platform icons

This commit is contained in:
RandomityGuy 2024-07-03 21:45:24 +05:30
parent 87ff14b6b8
commit da12b521db
17 changed files with 76 additions and 21 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 889 B

View file

@ -389,15 +389,18 @@ class Marble extends GameObject {
this.netCorrected = false;
var marbleDts = new DtsObject();
var marbleShader = "";
if (connection == null) {
Console.log("Marble: " + Settings.optionsSettings.marbleModel + " (" + Settings.optionsSettings.marbleSkin + ")");
marbleDts.dtsPath = Settings.optionsSettings.marbleModel;
marbleDts.matNameOverride.set("base.marble", Settings.optionsSettings.marbleSkin + ".marble");
marbleShader = Settings.optionsSettings.marbleShader;
} else {
var marbleData = MarbleSelectGui.marbleData[connection.getMarbleCatId()][connection.getMarbleId()]; // FIXME category support
Console.log("Marble: " + marbleData.dts + " (" + marbleData.skin + ")");
marbleDts.dtsPath = marbleData.dts;
marbleDts.matNameOverride.set("base.marble", marbleData.skin + ".marble");
marbleShader = marbleData.shader;
}
marbleDts.identifier = "Marble";
marbleDts.showSequences = false;
@ -410,12 +413,9 @@ class Marble extends GameObject {
// mat.mainPass.culling = None;
if (Settings.optionsSettings.reflectiveMarble) {
this.cubemapRenderer = new CubemapRenderer(level.scene, level.sky);
this.cubemapRenderer = new CubemapRenderer(level.scene, level.sky, !this.controllable && level != null);
if (Settings.optionsSettings.marbleShader == null
|| Settings.optionsSettings.marbleShader == "Default"
|| Settings.optionsSettings.marbleShader == ""
|| !isUltra) { // Use this shit everywhere except ultra
if (marbleShader == null || marbleShader == "Default" || marbleShader == "" || !isUltra) { // Use this shit everywhere except ultra
mat.mainPass.addShader(new MarbleReflection(this.cubemapRenderer.cubemap));
} else {
// Generate tangents for next shaders, only for Ultra
@ -429,26 +429,26 @@ class Marble extends GameObject {
mat.mainPass.removeShader(mat.textureShader);
if (Settings.optionsSettings.marbleShader == "ClassicGlassPureSphere") {
if (marbleShader == "ClassicGlassPureSphere") {
var marbleNormal = ResourceLoader.getTexture("data/shapes/balls/pack1/marble01.normal.png").resource;
var classicGlassShader = new ClassicGlassPureSphere(mat.texture, marbleNormal, this.cubemapRenderer.cubemap, 12,
new Vector(0.6, 0.6, 0.6, 0.6), this.level.ambient, this.level.dirLight, this.level.dirLightDir, 1);
mat.mainPass.addShader(classicGlassShader);
}
if (Settings.optionsSettings.marbleShader == "ClassicMarb2") {
if (marbleShader == "ClassicMarb2") {
var classicMarb2 = new ClassicMarb2(mat.texture, this.cubemapRenderer.cubemap, 12, new Vector(0.6, 0.6, 0.6, 0.6), this.level.ambient,
this.level.dirLight, this.level.dirLightDir, 1);
mat.mainPass.addShader(classicMarb2);
}
if (Settings.optionsSettings.marbleShader == "ClassicMarb3") {
if (marbleShader == "ClassicMarb3") {
var classicMarb3 = new ClassicMarb3(mat.texture, this.cubemapRenderer.cubemap, 12, new Vector(0.6, 0.6, 0.6, 0.6), this.level.ambient,
this.level.dirLight, this.level.dirLightDir, 1);
mat.mainPass.addShader(classicMarb3);
}
if (Settings.optionsSettings.marbleShader == "ClassicMetal") {
if (marbleShader == "ClassicMetal") {
var marbleNormal = ResourceLoader.getTexture("data/shapes/balls/pack1/marble18.normal.png").resource;
marbleNormal.wrap = Repeat;
var classicMetalShader = new ClassicMetal(mat.texture, marbleNormal, this.cubemapRenderer.cubemap, 12, new Vector(0.6, 0.6, 0.6, 0.6),
@ -456,7 +456,7 @@ class Marble extends GameObject {
mat.mainPass.addShader(classicMetalShader);
}
if (Settings.optionsSettings.marbleShader == "ClassicMarbGlass20") {
if (marbleShader == "ClassicMarbGlass20") {
var marbleNormal = ResourceLoader.getTexture("data/shapes/balls/pack1/marble20.normal.png").resource;
marbleNormal.wrap = Repeat;
var classicGlassShader = new ClassicGlass(mat.texture, marbleNormal, this.cubemapRenderer.cubemap, 12, new Vector(0.6, 0.6, 0.6, 0.6),
@ -464,7 +464,7 @@ class Marble extends GameObject {
mat.mainPass.addShader(classicGlassShader);
}
if (Settings.optionsSettings.marbleShader == "ClassicMarbGlass18") {
if (marbleShader == "ClassicMarbGlass18") {
var marbleNormal = ResourceLoader.getTexture("data/shapes/balls/pack1/marble18.normal.png").resource;
marbleNormal.wrap = Repeat;
var classicGlassShader = new ClassicGlass(mat.texture, marbleNormal, this.cubemapRenderer.cubemap, 12, new Vector(0.6, 0.6, 0.6, 0.6),
@ -2325,7 +2325,7 @@ class Marble extends GameObject {
public function updatePowerupStates(timeState:TimeState) {
this.shadowVolume.setPosition(x, y, z);
this.shadowVolume.setScale(marbleDts.scaleX);
this.shadowVolume.setScale(this._radius / 0.2);
if (this.level == null)
return;
var shockEnabled = isShockAbsorberEnabled(timeState);

View file

@ -128,7 +128,7 @@ class Settings {
fovX: 90,
frameRateVis: true,
oobInsults: true,
reflectiveMarble: true,
reflectiveMarble: false,
marbleIndex: 0,
marbleCategoryIndex: 0,
marbleSkin: "base",

View file

@ -60,6 +60,7 @@ class GuiMLTextListCtrl extends GuiControl {
for (text in texts) {
var tobj = new HtmlText(font);
tobj.lineHeightMode = TextOnly;
tobj.imageVerticalAlign = Top;
tobj.loadImage = imageLoader;
tobj.text = text;
tobj.textColor = 0;
@ -79,6 +80,7 @@ class GuiMLTextListCtrl extends GuiControl {
for (text in texts) {
var tobj = new HtmlText(font);
tobj.loadImage = this._imageLoader;
tobj.imageVerticalAlign = Top;
tobj.lineHeightMode = TextOnly;
tobj.text = text;
tobj.textColor = 0;

View file

@ -147,10 +147,34 @@ class JoinServerGui extends GuiImage {
serverListContainer.extent = new Vector(475, 290);
window.addChild(serverListContainer);
function imgLoader(path:String) {
var t = switch (path) {
case "ready":
ResourceLoader.getResource("data/ui/mp/play/Ready.png", ResourceLoader.getImage, this.imageResources).toTile();
case "notready":
ResourceLoader.getResource("data/ui/mp/play/NotReady.png", ResourceLoader.getImage, this.imageResources).toTile();
case "pc":
ResourceLoader.getResource("data/ui/mp/play/platform_desktop_white.png", ResourceLoader.getImage, this.imageResources).toTile();
case "mac":
ResourceLoader.getResource("data/ui/mp/play/platform_mac_white.png", ResourceLoader.getImage, this.imageResources).toTile();
case "web":
ResourceLoader.getResource("data/ui/mp/play/platform_web_white.png", ResourceLoader.getImage, this.imageResources).toTile();
case "android":
ResourceLoader.getResource("data/ui/mp/play/platform_android_white.png", ResourceLoader.getImage, this.imageResources).toTile();
case "unknown":
ResourceLoader.getResource("data/ui/mp/play/platform_unknown_white.png", ResourceLoader.getImage, this.imageResources).toTile();
case _:
return null;
};
if (t != null)
t.scaleToSize(t.width * (Settings.uiScale), t.height * (Settings.uiScale));
return t;
}
var ourServerList:Array<RemoteServerInfo> = [];
var curSelection = -1;
var serverList = new GuiTextListCtrl(markerFelt18, [], 0xFFFFFF);
var serverList = new GuiMLTextListCtrl(markerFelt18, [], imgLoader);
serverList.position = new Vector(0, 0);
serverList.extent = new Vector(475, 63);
serverList.scrollable = true;
@ -172,7 +196,7 @@ class JoinServerGui extends GuiImage {
var platformToString = ["unknown", "pc", "mac", "web", "android"];
function updateServerListDisplay() {
serverDisplays = ourServerList.map(x -> '${x.name}');
serverDisplays = ourServerList.map(x -> '<img src="${platformToString[x.platform]}"></img><font color="#FFFFFF">${x.name}</font>');
serverList.setTexts(serverDisplays);
}

View file

@ -48,7 +48,7 @@ class MPPlayMissionGui extends GuiImage {
var previewToken:Int = 0;
#end
var playerListCtrl:GuiTextListCtrl;
var playerListCtrl:GuiMLTextListCtrl;
var chatInput:GuiTextInput;
var chatScroll:GuiScrollCtrl;
var chatBox:GuiMLText;
@ -341,12 +341,36 @@ class MPPlayMissionGui extends GuiImage {
parTime.text.lineSpacing = -1;
window.addChild(parTime);
function imgLoader(path:String) {
var t = switch (path) {
case "ready":
ResourceLoader.getResource("data/ui/mp/play/Ready.png", ResourceLoader.getImage, this.imageResources).toTile();
case "notready":
ResourceLoader.getResource("data/ui/mp/play/NotReady.png", ResourceLoader.getImage, this.imageResources).toTile();
case "pc":
ResourceLoader.getResource("data/ui/mp/play/platform_desktop_white.png", ResourceLoader.getImage, this.imageResources).toTile();
case "mac":
ResourceLoader.getResource("data/ui/mp/play/platform_mac_white.png", ResourceLoader.getImage, this.imageResources).toTile();
case "web":
ResourceLoader.getResource("data/ui/mp/play/platform_web_white.png", ResourceLoader.getImage, this.imageResources).toTile();
case "android":
ResourceLoader.getResource("data/ui/mp/play/platform_android_white.png", ResourceLoader.getImage, this.imageResources).toTile();
case "unknown":
ResourceLoader.getResource("data/ui/mp/play/platform_unknown_white.png", ResourceLoader.getImage, this.imageResources).toTile();
case _:
return null;
};
if (t != null)
t.scaleToSize(t.width * (Settings.uiScale), t.height * (Settings.uiScale));
return t;
}
var playersBox = new GuiControl();
playersBox.position = new Vector(463, 279);
playersBox.extent = new Vector(305, 229);
window.addChild(playersBox);
playerListCtrl = new GuiTextListCtrl(markerFelt18, [], 0xFFFFFF);
playerListCtrl = new GuiMLTextListCtrl(markerFelt18, [], imgLoader);
playerListCtrl.position = new Vector(0, 26);
playerListCtrl.extent = new Vector(305, 203);
playerListCtrl.scrollable = true;
@ -671,7 +695,8 @@ class MPPlayMissionGui extends GuiImage {
}
}
var playerListCompiled = playerListArr.map(player -> player.name);
var playerListCompiled = playerListArr.map(player ->
'<img src="${platformToString(player.platform)}"></img><font color="#FFFFFF">${player.name}</font>');
playerListCtrl.setTexts(playerListCompiled);
// if (!showingCustoms)

View file

@ -21,11 +21,15 @@ class CubemapRenderer {
var lastRenderTime:Float = 0;
var usingSky:Bool = false;
public function new(scene:Scene, sky:Sky) {
public function new(scene:Scene, sky:Sky, useSky = false) {
this.scene = scene;
this.sky = sky;
this.cubemap = new Texture(128, 128, [Cube, Dynamic, Target], h3d.mat.Data.TextureFormat.RGB8);
this.cubemap.depthBuffer = new h3d.mat.DepthBuffer(128, 128, h3d.mat.DepthBuffer.DepthFormat.Depth16);
if (useSky)
this.cubemap = sky.cubemap;
else {
this.cubemap = new Texture(128, 128, [Cube, Dynamic, Target], h3d.mat.Data.TextureFormat.RGBA);
this.cubemap.depthBuffer = new h3d.mat.DepthBuffer(128, 128, h3d.mat.DepthBuffer.DepthFormat.Depth16);
}
this.camera = new Camera(90, 1, 1, 0.02, scene.camera.zFar);
this.position = new Vector();
this.nextFaceToRender = 0;