Android Open Source - TinyVoxel Config






From Project

Back to project page TinyVoxel.

License

The source code is released under:

GNU General Public License

If you think the Android project TinyVoxel listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor./*  w  w  w  .  j a v  a  2  s . c o  m*/
 */

package com.toet.TinyVoxel;

import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.math.Vector3;
import com.toet.TinyVoxel.Renderer.BlockBuilder;
import com.toet.TinyVoxel.Renderer.Tools.BrushUtils;

/**
 *
 * @author Kajos
 */
public abstract class Config {
    private static Config instance;

    public static Config get() {
        return instance;
    }

    // Set platform dependent config
    public static void set(Config config) {
        instance = config;
    }

    // If debug is on, a debug textfield is shown for HTML version
    public static final boolean IS_DEBUG = true;

    // OpenGL error handling - only to be used for debugging of course
    public static final boolean ENABLE_ERROR_HANDLER = false;

    // Whether to save the shadows in the file
    public static final boolean SAVE_SHADE = false;

    // For debug purposes
    public static final boolean NO_CLIPPING = false;

    // How often to render the shadows
    public static final float SHADOW_FRAMES = 1f;

    // These functions are to be implemented platform specific.
    // Writing to textures (in a fast manner) needs to happen in a different way for
    // WebGL.
    public abstract void putPalette(int color);
    public abstract void putSinglePalette(int color);
    public abstract void uploadPalette(int width, int height);
    public abstract void uploadSinglePalette(int paletteId);
    public abstract void rewindPalette();
    public abstract void rewindSinglePalette();

    // Grid hover color
    public static Color SELECTED_GRID_COLOR = new Color(1f, 0f, 0f, 0.15f);
    // Selected grid color
    public static Color HOVER_GRID_COLOR = new Color(0f, 0f, 1f, 0.25f);

    // Times for how often to do culling etc.
    public static final float FRUSTRUM_IN_RANGE = .5f;
    public static final float FRUSTRUM_IN_RANGE_LARGE = 4f;

    public static final float FRUSTRUM_IN_SIGHT = .1f;

    // Tools
    public static final float TOOLS_DISTANCE = 5f;
    public static final float PLACE_GRID_DISTANCE = .5f;
    public static final int MAX_TOOLS_SIZE = BrushUtils.SIZE / 2;
    public int TOOLS_SIZE = MAX_TOOLS_SIZE / 2;
    public Vector3 TOOLS_COLOR = new Vector3(.5f,.5f,.5f);

    // Debug

    public static final Vector3 LIGHT_DIRECTION = new Vector3(1,2,1).nor();

    // Only used in initialization of manager
    public static final int BUNDLES = 32;
    public static final int BUNDLE_SPACING = 16;

    // Grid size
    /*
    Make sure that TINY_GRID_TOTAL < 1024 and GRID_TOTAL < 1024. OpenGL has maximum texture sizes, too be safe I kept below 1024x1024.
    The 3D voxel data is mapped to a 2D texture, as 3D textures are not supported in GLES and alike.
    If this structure is changed - for instance 16x16 (X*Z) in width and GRID_TOAL * 16 (Y) in height - it is easily accomplished to have 16x16x16 tiny grids.
     */
    public static final int GRID_SIZE = 12; // 16 tiny data size y * 4*4*4 (64) = 1024 is max size of texture and fbo (for palette)
    public static final float GRID_SIZE_F = (float)GRID_SIZE;           // fbo will be 1024 (16 * 64) * 32 (16 * 16)

    public static final int GRID_TOTAL = GRID_SIZE * GRID_SIZE * GRID_SIZE;
    public static final float GRID_CORNER_LENGTH = new Vector3(Config.GRID_SIZE / 2, Config.GRID_SIZE / 2, Config.GRID_SIZE / 2).len();

    // Tiny grid size
    public static final int TINY_GRID_SIZE = 8;
    public static final int TINY_GRID_TOTAL = TINY_GRID_SIZE * TINY_GRID_SIZE * TINY_GRID_SIZE;

    // Grid rotate tool
    public static final float GRID_ROTATE_SPEED = 100f;

    public static final float LOD_SPEED = 0.5f;

    // First .. grids are using the DDA shader. If set to 0 then DDA is deactivated.
    public static final int OFFSET_DETAIL = 2;

    public abstract int getLOD();
    public abstract boolean getPostFBOShader();
    public abstract boolean getTransparentTools();

    public static final short VERSION = 5;

    // Resolution scaler; higher is lower resolution
    public static int INTERNAL_RESOLUTION_PRESCALER = 1;

    // Camera field of view
    public float FOV = 65f;

    // Maximum far distance (can change by LOD)
    public static final float FAR = 150f;
    // Near distance (fixed)
    public static final float NEAR = .4f;

    public static boolean INVERSE_MOUSE = true;
    public float DRAG_SPEED = 350f;

    // Background color
    public Color BACKGROUND_COLOR = new Color(.7f,.7f,1f,0f);

    // Vertex constants
    public static final int MAX_BLOCK_SIZE = Config.GRID_SIZE * Config.GRID_SIZE * Config.GRID_SIZE;
    public static final int MAX_VERTEX_SIZE = MAX_BLOCK_SIZE * BlockBuilder.CUBE.length / 3; // 4 vertices per each of 6 fullSides
    public static final int ATTRIBUTES_SIZE = 5;
    public static final int MAX_FLOAT_SIZE = MAX_VERTEX_SIZE * ATTRIBUTES_SIZE; // 4 floats per vertex
}




Java Source Code List

com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration.java
com.badlogic.gdx.backends.gwt.GwtApplication.java
com.badlogic.gdx.backends.gwt.GwtGL20.java
com.badlogic.gdx.backends.gwt.GwtInput.java
com.badlogic.gdx.backends.gwt.GwtNet.java
com.badlogic.gdx.graphics.Pixmap.java
com.toet.TinyVoxel.Config.java
com.toet.TinyVoxel.Game.java
com.toet.TinyVoxel.IOSConfig.java
com.toet.TinyVoxel.IOSLauncher.java
com.toet.TinyVoxel.OuyaController.java
com.toet.TinyVoxel.Time.java
com.toet.TinyVoxel.Character.Character.java
com.toet.TinyVoxel.Debug.LogHandler.java
com.toet.TinyVoxel.GameControllers.CharacterController.java
com.toet.TinyVoxel.GameControllers.CustomTouchPad.java
com.toet.TinyVoxel.GameControllers.KeyBoardController.java
com.toet.TinyVoxel.GameControllers.TouchPadController.java
com.toet.TinyVoxel.Importer.BinvoxImporter.java
com.toet.TinyVoxel.Importer.DataInputStream.java
com.toet.TinyVoxel.Importer.MeshImporter.java
com.toet.TinyVoxel.Renderer.BlockBuilder.java
com.toet.TinyVoxel.Renderer.Floor.java
com.toet.TinyVoxel.Renderer.Manager.java
com.toet.TinyVoxel.Renderer.Bundles.ArrayBundle.java
com.toet.TinyVoxel.Renderer.Bundles.Bundle.java
com.toet.TinyVoxel.Renderer.Bundles.GridBundle.java
com.toet.TinyVoxel.Renderer.Bundles.GridInterface.java
com.toet.TinyVoxel.Renderer.Bundles.Grid.java
com.toet.TinyVoxel.Renderer.Bundles.GroundBundle.java
com.toet.TinyVoxel.Renderer.Bundles.SingleBundle.java
com.toet.TinyVoxel.Renderer.Bundles.TinyGrid.java
com.toet.TinyVoxel.Renderer.Tools.BrushUtils.java
com.toet.TinyVoxel.Renderer.Tools.GridUtils.java
com.toet.TinyVoxel.Renderer.Wrapped.WrappedBoolean.java
com.toet.TinyVoxel.Renderer.Wrapped.WrappedInteger.java
com.toet.TinyVoxel.Screens.GUI.java
com.toet.TinyVoxel.Screens.Menu.java
com.toet.TinyVoxel.Shaders.ShaderManager.java
com.toet.TinyVoxel.Shadow.ShadowManager.java
com.toet.TinyVoxel.Util.Box.java
com.toet.TinyVoxel.Util.FullscreenQuad.java
com.toet.TinyVoxel.Util.JobManager.java
com.toet.TinyVoxel.Util.NonBackedTexture.java
com.toet.TinyVoxel.Util.Position.java
com.toet.TinyVoxel.Util.RLEInputStream.java
com.toet.TinyVoxel.Util.RLEOutputStream.java
com.toet.TinyVoxel.Util.SimpleMath.java
com.toet.TinyVoxel.Util.StreamUtil.java
com.toet.TinyVoxel.android.AndroidConfig.java
com.toet.TinyVoxel.android.AndroidConfig.java
com.toet.TinyVoxel.android.AndroidLauncher.java
com.toet.TinyVoxel.android.AndroidLauncher.java
com.toet.TinyVoxel.client.GwtConfig.java
com.toet.TinyVoxel.client.HtmlLauncher.java
com.toet.TinyVoxel.desktop.DesktopConfig.java
com.toet.TinyVoxel.desktop.DesktopLauncher.java