Android support
This commit is contained in:
@@ -51,13 +51,20 @@ class Config {
|
||||
raw.rp_bloom = false;
|
||||
raw.rp_gi = false;
|
||||
raw.rp_motionblur = false;
|
||||
#if krom_android
|
||||
raw.rp_ssgi = false;
|
||||
#else
|
||||
raw.rp_ssgi = true;
|
||||
#end
|
||||
raw.rp_ssr = false;
|
||||
raw.rp_supersample = 1.0;
|
||||
var disp = Display.primary;
|
||||
if (disp != null && disp.width >= 3000 && disp.height >= 2000) {
|
||||
raw.window_scale = 2.0;
|
||||
}
|
||||
#if krom_android
|
||||
raw.window_scale = 2.0;
|
||||
#end
|
||||
}
|
||||
|
||||
#if arm_painter
|
||||
|
||||
@@ -269,15 +269,16 @@ class MakePaint {
|
||||
if (UITrait.inst.pickerMaskHandle.position == MaskMaterial) {
|
||||
matid = UITrait.inst.materialIdPicked / 255; // Keep existing material id in place when mask is set
|
||||
}
|
||||
frag.write('float matid = $matid;');
|
||||
var matidString = Material.vec1(matid);
|
||||
frag.write('float matid = $matidString;');
|
||||
|
||||
// TODO: Use emission/subsurface matid
|
||||
// matid % 3 == 0 - normal, 1 - emission, 2 - subsurface
|
||||
if (Context.material.paintSubs) {
|
||||
frag.write('if (subs > 0) { matid = 254 / 255; }');
|
||||
frag.write('if (subs > 0.0) { matid = float(254) / float(255); }');
|
||||
}
|
||||
if (Context.material.paintEmis) {
|
||||
frag.write('if (emis > 0) { matid = 255 / 255; }');
|
||||
frag.write('if (emis > 0.0) { matid = float(255) / float(255); }');
|
||||
}
|
||||
|
||||
if (layered) {
|
||||
|
||||
@@ -1450,23 +1450,23 @@ class Material {
|
||||
sample_bump = false;
|
||||
}
|
||||
|
||||
static function vec1(v: Float): String {
|
||||
#if kha_webgl
|
||||
public static inline function vec1(v: Float): String {
|
||||
#if (kha_webgl ||krom_android)
|
||||
return 'float($v)';
|
||||
#else
|
||||
return '$v';
|
||||
#end
|
||||
}
|
||||
|
||||
static function vec3(v: Array<Float>): String {
|
||||
#if kha_webgl
|
||||
public static inline function vec3(v: Array<Float>): String {
|
||||
#if (kha_webgl ||krom_android)
|
||||
return 'vec3(float(${v[0]}), float(${v[1]}), float(${v[2]}))';
|
||||
#else
|
||||
return 'vec3(${v[0]}, ${v[1]}, ${v[2]})';
|
||||
#end
|
||||
}
|
||||
|
||||
static function to_vec3(s: String): String {
|
||||
public static inline function to_vec3(s: String): String {
|
||||
#if (kha_direct3d11 || kha_direct3d12)
|
||||
return '($s).xxx';
|
||||
#else
|
||||
|
||||
@@ -481,10 +481,10 @@ class MaterialShader {
|
||||
|
||||
#else // kha_opengl
|
||||
|
||||
#if kha_webgl
|
||||
#if (kha_webgl || krom_android)
|
||||
var s = '#version 300 es\n';
|
||||
if (shader_type == 'frag') {
|
||||
s += 'precision mediump float;\n';
|
||||
s += 'precision highp float;\n';
|
||||
s += 'precision mediump int;\n';
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -18,7 +18,7 @@ class File {
|
||||
#end
|
||||
|
||||
public static function readDirectory(path: String, foldersOnly = false): Array<String> {
|
||||
#if (krom_windows || krom_linux)
|
||||
#if (krom_windows || krom_linux || krom_android)
|
||||
return Krom.readDirectory(path, foldersOnly).split("\n");
|
||||
#else
|
||||
var save = Path.data() + Path.sep + "tmp.txt";
|
||||
|
||||
@@ -217,10 +217,18 @@ class BoxExport {
|
||||
}
|
||||
|
||||
static function fetchPresets() {
|
||||
#if krom_android
|
||||
|
||||
files = ["generic"];
|
||||
|
||||
#else
|
||||
|
||||
files = File.readDirectory(Path.data() + Path.sep + "export_presets");
|
||||
for (i in 0...files.length) {
|
||||
files[i] = files[i].substr(0, files[i].length - 5); // Strip .json
|
||||
}
|
||||
|
||||
#end
|
||||
}
|
||||
|
||||
static function parsePreset() {
|
||||
|
||||
@@ -54,7 +54,9 @@ class BoxPreferences {
|
||||
UITrait.inst.tagUIRedraw();
|
||||
}
|
||||
|
||||
#if (!krom_android)
|
||||
UITrait.inst.nativeBrowser = ui.check(Id.handle({selected: UITrait.inst.nativeBrowser}), "Native File Browser");
|
||||
#end
|
||||
|
||||
UITrait.inst.cacheDraws = ui.check(Id.handle({selected: UITrait.inst.cacheDraws}), "Cache UI Draws");
|
||||
if (ui.isHovered) ui.tooltip("Enabling may reduce GPU usage");
|
||||
@@ -150,7 +152,7 @@ class BoxPreferences {
|
||||
Config.raw.window_vsync = ui.check(vsyncHandle, "VSync");
|
||||
if (vsyncHandle.changed) Config.save();
|
||||
|
||||
#if (!kha_direct3d12)
|
||||
#if rp_voxelao
|
||||
ui.check(UITrait.inst.hvxao, "Voxel AO");
|
||||
if (ui.isHovered) ui.tooltip("Cone-traced AO and shadows");
|
||||
if (UITrait.inst.hvxao.changed) {
|
||||
|
||||
@@ -201,6 +201,8 @@ class UIFiles {
|
||||
#if krom_windows
|
||||
handle.text = "C:\\Users";
|
||||
// %HOMEDRIVE% + %HomePath%
|
||||
#elseif krom_android
|
||||
handle.text = "/sdcard";
|
||||
#else
|
||||
handle.text = "/";
|
||||
// ~
|
||||
|
||||
@@ -132,7 +132,11 @@ class UITrait {
|
||||
public var viewportMode = ViewRender;
|
||||
public var hscaleWasChanged = false;
|
||||
public var exportMeshFormat = FormatObj;
|
||||
#if krom_android
|
||||
public var nativeBrowser = false;
|
||||
#else
|
||||
public var nativeBrowser = true;
|
||||
#end
|
||||
public var cacheDraws = false;
|
||||
public var showAssetNames = false;
|
||||
|
||||
|
||||
+21
-7
@@ -1,4 +1,5 @@
|
||||
let project = new Project('ArmorPaint');
|
||||
let android = false; // Temp
|
||||
|
||||
project.addSources('Sources');
|
||||
project.addLibrary("iron");
|
||||
@@ -13,10 +14,15 @@ project.addAssets("Assets/themes/*", { notinlist: true, destination: "data/theme
|
||||
project.addDefine('arm_taa');
|
||||
project.addDefine('arm_veloc');
|
||||
project.addDefine('arm_particles');
|
||||
project.addDefine('arm_data_dir');
|
||||
// project.addDefine('arm_noembed');
|
||||
if (!android) {
|
||||
project.addDefine('arm_data_dir');
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
if (android) {
|
||||
project.addDefine('krom_android');
|
||||
}
|
||||
else if (process.platform === 'win32') {
|
||||
project.addDefine('krom_windows');
|
||||
}
|
||||
else if (process.platform === 'linux') {
|
||||
@@ -48,15 +54,20 @@ if (raytrace) {
|
||||
}
|
||||
else {
|
||||
project.addAssets("Assets/readme/readme.txt", { notinlist: true, destination: "{name}" });
|
||||
project.addDefine('rp_voxelao');
|
||||
project.addDefine('arm_voxelgi_revox');
|
||||
if (!android) {
|
||||
project.addDefine('rp_voxelao');
|
||||
project.addDefine('arm_voxelgi_revox');
|
||||
}
|
||||
}
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
project.addAssets("Assets/readme/readme_macos.txt", { notinlist: true, destination: "INSTRUCTIONS.txt" });
|
||||
}
|
||||
|
||||
if (process.platform === 'win32' && win_hlsl) {
|
||||
if (android) {
|
||||
|
||||
}
|
||||
else if (process.platform === 'win32' && win_hlsl) {
|
||||
project.addShaders("Shaders/voxel_hlsl/*.glsl", { noprocessing: true, noembed: false });
|
||||
}
|
||||
else {
|
||||
@@ -73,7 +84,10 @@ else { // painter, creator
|
||||
project.addDefine('arm_skip_envmap');
|
||||
project.addDefine('arm_resizable');
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
if (android) {
|
||||
|
||||
}
|
||||
else if (process.platform === 'win32') {
|
||||
project.addAssets("Assets/bin/cmft.exe", { notinlist: true, destination: "data/{name}" });
|
||||
}
|
||||
else if (process.platform === 'linux') {
|
||||
@@ -89,7 +103,7 @@ else { // painter, creator
|
||||
|
||||
project.addAssets("Assets/painter/export_presets/*", { notinlist: true, destination: "data/export_presets/{name}" });
|
||||
project.addAssets("Assets/painter/keymap_presets/*", { notinlist: true, destination: "data/keymap_presets/{name}" });
|
||||
if (process.platform === 'win32' && win_hlsl) {
|
||||
if (process.platform === 'win32' && win_hlsl && !android) {
|
||||
project.addShaders("Shaders/painter/hlsl/*.glsl", { noprocessing: true, noembed: false });
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user