Merge platform+quality into a single quality value
Added another quality setting (VERY HIGH) and mapped all combinations of platform + the old quality value to the new 4 value quality option, as follows: desktop + mid/high quality => 3 mobile + high quality => 2 mobile + mid quality, desktop + low quality => 1 mobile + low quality => 0 All choice points in the code which enabled/disabled graphics features, based on platform + quality, were mapped onto a table. This showed which features were disabled or enabled depending on the platform/quality combination. It turned out that mid and high quality resulted in the same settings on desktop, so they could be captured in a single value (3). The only change made to the decision points was that desktop + low quality previously turned off the booster lighting effect, whereas that effect is now on for desktop + low quality. This was done so that mobile + mid quality was equivalent to desktop + low quality. By doing this, the "mobile" property can be removed. I also removed the "half" property, and set it based on quality in the HexGL class (basically, it's enabled for mobile + low quality, which is new quality value 0).
This commit is contained in:
+14
-23
@@ -23,12 +23,6 @@ bkcore.hexgl.HexGL = function(opts)
|
||||
this.displayHUD = opts.hud == undefined ? true : opts.hud;
|
||||
this.width = opts.width == undefined ? window.innerWidth : opts.width;
|
||||
this.height = opts.height == undefined ? window.innerHeight : opts.height;
|
||||
|
||||
this.quality = opts.quality == undefined ? 2 : opts.quality;
|
||||
|
||||
// TODO remove mobile variable
|
||||
var mobile = true;
|
||||
this.half = mobile && this.quality < 1;
|
||||
|
||||
this.difficulty = opts.difficulty == undefined ? 0 : opts.difficulty;
|
||||
this.player = opts.player == undefined ? "Anonym" : opts.player;
|
||||
@@ -38,8 +32,17 @@ bkcore.hexgl.HexGL = function(opts)
|
||||
this.mode = opts.mode == undefined ? 'timeattack' : opts.mode;
|
||||
|
||||
this.controlType = opts.controlType == undefined ? 1 : opts.controlType;
|
||||
|
||||
// 0 == low, 1 == mid, 2 == high, 3 == very high
|
||||
// the old platform+quality combinations map to these new quality values
|
||||
// as follows:
|
||||
// mobile + low quality => 0 (LOW)
|
||||
// mobile + mid quality OR desktop + low quality => 1 (MID)
|
||||
// mobile + high quality => 2 (HIGH)
|
||||
// desktop + mid or high quality => 3 (VERY HIGH)
|
||||
this.quality = opts.quality == undefined ? 3 : opts.quality;
|
||||
|
||||
if(this.half)
|
||||
if(this.quality === 0)
|
||||
{
|
||||
this.width /= 2;
|
||||
this.height /=2;
|
||||
@@ -274,11 +277,8 @@ bkcore.hexgl.HexGL.prototype.initRenderer = function()
|
||||
clearColor: 0x000000
|
||||
});
|
||||
|
||||
// TODO remove mobile var
|
||||
var mobile = true;
|
||||
|
||||
// desktop + quality mid or high
|
||||
if(this.quality > 0 && !mobile)
|
||||
if(this.quality > 2)
|
||||
{
|
||||
renderer.physicallyBasedShading = true;
|
||||
renderer.gammaInput = true;
|
||||
@@ -352,11 +352,8 @@ bkcore.hexgl.HexGL.prototype.initGameComposer = function()
|
||||
|
||||
// }
|
||||
|
||||
// TODO remove mobile var
|
||||
var mobile = true;
|
||||
|
||||
// desktop + quality mid or high
|
||||
if(this.quality > 1 && !mobile)
|
||||
if(this.quality > 2)
|
||||
{
|
||||
var effectBloom = new THREE.BloomPass( 0.8, 25, 4 , 256);
|
||||
|
||||
@@ -365,16 +362,13 @@ bkcore.hexgl.HexGL.prototype.initGameComposer = function()
|
||||
this.extras.bloom = effectBloom;
|
||||
}
|
||||
|
||||
// TODO remove mobile var
|
||||
// desktop + quality low, mid or high
|
||||
// OR
|
||||
// mobile + quality mid or high
|
||||
if(!mobile || this.quality > 0)
|
||||
if(this.quality > 0)
|
||||
this.composers.game.addPass( effectHex );
|
||||
else
|
||||
this.composers.game.addPass( effectScreen );
|
||||
|
||||
|
||||
}
|
||||
|
||||
bkcore.hexgl.HexGL.prototype.createMesh = function(parent, geometry, x, y, z, mat)
|
||||
@@ -385,11 +379,8 @@ bkcore.hexgl.HexGL.prototype.createMesh = function(parent, geometry, x, y, z, ma
|
||||
mesh.position.set( x, y, z );
|
||||
parent.add(mesh);
|
||||
|
||||
// TODO remove mobile var
|
||||
var mobile = true;
|
||||
|
||||
// desktop + quality mid or high
|
||||
if(this.quality > 0 && !mobile)
|
||||
if(this.quality > 2)
|
||||
{
|
||||
mesh.castShadow = true;
|
||||
mesh.receiveShadow = true;
|
||||
|
||||
@@ -39,15 +39,12 @@ bkcore.hexgl.tracks.Cityscape = {
|
||||
|
||||
load: function(opts, quality)
|
||||
{
|
||||
// TODO remove mobile var
|
||||
var mobile = true;
|
||||
|
||||
this.lib = new bkcore.threejs.Loader(opts);
|
||||
|
||||
// desktop + quality low
|
||||
// OR
|
||||
// mobile + quality low or mid
|
||||
if((quality < 1 && !mobile) || quality < 2) // LOW
|
||||
if(quality < 2) // LOW
|
||||
{
|
||||
this.lib.load({
|
||||
textures: {
|
||||
@@ -150,13 +147,10 @@ bkcore.hexgl.tracks.Cityscape = {
|
||||
|
||||
buildMaterials: function(quality)
|
||||
{
|
||||
// TODO remove mobile var
|
||||
var mobile = true;
|
||||
|
||||
// desktop + quality low
|
||||
// OR
|
||||
// mobile + quality low or mid
|
||||
if((quality < 1 && !mobile) || quality < 2) // LOW
|
||||
if(quality < 2) // LOW
|
||||
{
|
||||
this.materials.track = new THREE.MeshBasicMaterial({
|
||||
map: this.lib.get("textures", "track.cityscape.diffuse"),
|
||||
@@ -290,9 +284,6 @@ bkcore.hexgl.tracks.Cityscape = {
|
||||
|
||||
buildScenes: function(ctx, quality)
|
||||
{
|
||||
// TODO remove mobile var
|
||||
var mobile = true;
|
||||
|
||||
// IMPORTANT
|
||||
this.analyser = this.lib.get("analysers", "track.cityscape.collision");
|
||||
|
||||
@@ -335,7 +326,7 @@ bkcore.hexgl.tracks.Cityscape = {
|
||||
sun.lookAt(new THREE.Vector3());
|
||||
|
||||
// desktop + quality mid or high
|
||||
if(quality > 0 && !mobile)
|
||||
if(quality > 2)
|
||||
{
|
||||
sun.castShadow = true;
|
||||
sun.shadowCameraNear = 50;
|
||||
@@ -371,7 +362,13 @@ bkcore.hexgl.tracks.Cityscape = {
|
||||
var boosterLight = new THREE.PointLight(0x00a2ff, 4.0, 60);
|
||||
boosterLight.position.set(0, 0.665, -4);
|
||||
|
||||
// desktop or mobile + quality mid or high
|
||||
// desktop + quality low, mid or high
|
||||
// OR
|
||||
// mobile + quality mid or high
|
||||
// NB booster is now enabled on desktop + low quality,
|
||||
// when it wasn't before; this is because this booster setting
|
||||
// is the only difference between mobile + mid quality
|
||||
// and desktop + low quality, so I merged them for convenience
|
||||
if(quality > 0)
|
||||
ship.add(boosterLight);
|
||||
|
||||
@@ -399,7 +396,7 @@ bkcore.hexgl.tracks.Cityscape = {
|
||||
};
|
||||
|
||||
// desktop + quality mid or high
|
||||
if(quality > 0 && !mobile)
|
||||
if(quality > 2)
|
||||
{
|
||||
fxParams.textureCloud = this.lib.get("textures", "cloud");
|
||||
fxParams.textureSpark = this.lib.get("textures", "spark");
|
||||
|
||||
Reference in New Issue
Block a user