Cleaning up.

This commit is contained in:
Lubos Lenco 2016-10-12 17:52:27 +02:00
parent 0bbd0a59a3
commit 85ea9845f2
107 changed files with 359 additions and 421 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -103,7 +103,7 @@ class HosekWilkieRadianceData {
Z.x /= dotS; Z.x /= dotS;
Z.y /= dotS; Z.y /= dotS;
Z.z /= dotS; Z.z /= dotS;
Z.mult(normalizedSunY); Z = Z.mult(normalizedSunY);
} }
// Store in a single float array for shader access // Store in a single float array for shader access

View file

@ -6,6 +6,7 @@ import iron.system.Input;
import iron.math.Vec4; import iron.math.Vec4;
import iron.math.Quat; import iron.math.Quat;
@:keep
class ArcBall extends Trait { class ArcBall extends Trait {
public function new() { public function new() {

View file

@ -6,6 +6,7 @@ import iron.object.Object;
import armory.trait.internal.PhysicsWorld; import armory.trait.internal.PhysicsWorld;
import armory.trait.internal.CameraController; import armory.trait.internal.CameraController;
@:keep
class FirstPersonController extends CameraController { class FirstPersonController extends CameraController {
#if (!WITH_PHYSICS) #if (!WITH_PHYSICS)

View file

@ -11,6 +11,7 @@ import iron.object.CameraObject;
import armory.trait.internal.RigidBody; import armory.trait.internal.RigidBody;
import armory.system.Keymap; import armory.system.Keymap;
@:keep
class GunController extends Trait { class GunController extends Trait {
#if (!WITH_PHYSICS) #if (!WITH_PHYSICS)

View file

@ -3,6 +3,7 @@ package armory.trait;
import iron.Trait; import iron.Trait;
import iron.object.MeshObject; import iron.object.MeshObject;
@:keep
class MirrorTexture extends Trait { class MirrorTexture extends Trait {
var cameraName:String; var cameraName:String;

View file

@ -2,6 +2,7 @@ package armory.trait;
import iron.Trait; import iron.Trait;
@:keep
class NavAgent extends Trait { class NavAgent extends Trait {
// nav mesh // nav mesh

View file

@ -2,6 +2,7 @@ package armory.trait;
import iron.Trait; import iron.Trait;
@:keep
class NavCrowd extends Trait { class NavCrowd extends Trait {
public function new() { public function new() {

View file

@ -2,6 +2,7 @@ package armory.trait;
import iron.Trait; import iron.Trait;
@:keep
class NavMesh extends Trait { class NavMesh extends Trait {
public function new() { public function new() {

View file

@ -8,6 +8,7 @@ import armory.trait.internal.PhysicsWorld;
import haxebullet.Bullet; import haxebullet.Bullet;
#end #end
@:keep
class PhysicsDrag extends Trait { class PhysicsDrag extends Trait {
#if (!WITH_PHYSICS) #if (!WITH_PHYSICS)

View file

@ -2,6 +2,7 @@ package armory.trait;
import iron.Trait; import iron.Trait;
@:keep
class SceneInstance extends Trait { class SceneInstance extends Trait {
function safeFilename(s:String) { function safeFilename(s:String) {

View file

@ -3,6 +3,7 @@ package armory.trait;
import iron.math.Vec4; import iron.math.Vec4;
import armory.trait.internal.CameraController; import armory.trait.internal.CameraController;
@:keep
class SidescrollerController extends CameraController { class SidescrollerController extends CameraController {
#if (!WITH_PHYSICS) #if (!WITH_PHYSICS)

View file

@ -5,6 +5,7 @@ import iron.system.Input;
import armory.trait.internal.PhysicsWorld; import armory.trait.internal.PhysicsWorld;
import armory.trait.internal.CameraController; import armory.trait.internal.CameraController;
@:keep
class ThirdPersonController extends CameraController { class ThirdPersonController extends CameraController {
#if (!WITH_PHYSICS) #if (!WITH_PHYSICS)

View file

@ -11,6 +11,7 @@ import armory.system.Keymap;
import haxebullet.Bullet; import haxebullet.Bullet;
#end #end
@:keep
class VehicleBody extends Trait { class VehicleBody extends Trait {
#if (!WITH_PHYSICS) #if (!WITH_PHYSICS)

View file

@ -9,6 +9,7 @@ import iron.math.Vec4;
import iron.math.Quat; import iron.math.Quat;
import armory.system.Keymap; import armory.system.Keymap;
@:keep
class WalkNavigation extends Trait { class WalkNavigation extends Trait {
static inline var speed = 5.0; static inline var speed = 5.0;
@ -52,11 +53,11 @@ class WalkNavigation extends Trait {
} }
if (strafeUp) { if (strafeUp) {
var dir = new Vec4(0, 0, 1); var dir = new Vec4(0, 0, 1);
camera.move(dir, -d); camera.move(dir, d);
} }
else if (strafeDown) { else if (strafeDown) {
var dir = new Vec4(0, 0, 1); var dir = new Vec4(0, 0, 1);
camera.move(dir, d); camera.move(dir, -d);
} }
if (Input.touch) { if (Input.touch) {

View file

@ -1,47 +0,0 @@
package armory.trait.internal;
import iron.Trait;
class Animation extends Trait {
var startTrack:String;
var names:Array<String>;
var starts:Array<Int>;
var ends:Array<Int>;
var speeds:Array<Float>;
var loops:Array<Bool>;
var reflects:Array<Bool>;
static var maxBones:Int;
public function new(startTrack:String, names:Array<String>, starts:Array<Int>, ends:Array<Int>, speeds:Array<Float>, loops:Array<Bool>, reflects:Array<Bool>, _maxBones:Int) {
super();
this.startTrack = startTrack;
this.names = names;
this.starts = starts;
this.ends = ends;
this.speeds = speeds;
this.loops = loops;
this.reflects = reflects;
maxBones = _maxBones;
notifyOnAdd(add);
notifyOnUpdate(update);
}
function add() {
object.setupAnimation(startTrack, names, starts, ends, speeds, loops, reflects, maxBones);
}
function update() {
object.setAnimationParams(iron.system.Time.delta);
}
public function play(trackName:String, onTrackComplete:Void->Void = null) {
object.animation.player.play(trackName, onTrackComplete);
}
public function pause() {
object.animation.player.pause();
}
}

View file

@ -6,6 +6,7 @@ import iron.object.Transform;
import iron.object.CameraObject; import iron.object.CameraObject;
import armory.system.Keymap; import armory.system.Keymap;
@:keep
class CameraController extends Trait { class CameraController extends Trait {
#if (!WITH_PHYSICS) #if (!WITH_PHYSICS)

View file

@ -9,6 +9,7 @@ import zui.Zui;
import zui.Id; import zui.Id;
#end #end
@:keep
class Console extends Trait { class Console extends Trait {
#if (!WITH_PROFILE) #if (!WITH_PROFILE)

View file

@ -6,6 +6,7 @@ import iron.object.Transform;
import iron.system.Input; import iron.system.Input;
import iron.math.RayCaster; import iron.math.RayCaster;
@:keep
class EditorSpace extends Trait { class EditorSpace extends Trait {
var gizmo:Object; var gizmo:Object;

View file

@ -2,6 +2,7 @@ package armory.trait.internal;
import iron.Trait; import iron.Trait;
@:keep
class JSScript extends Trait { class JSScript extends Trait {
static var api:JSScriptAPI = null; static var api:JSScriptAPI = null;

View file

@ -8,6 +8,7 @@ package armory.trait.internal;
// #include <duktape.h> // #include <duktape.h>
// ') // ')
@:keep
class JSScriptAPI { class JSScriptAPI {
/* /*
static var ctx:haxeduktape.DukContext; static var ctx:haxeduktape.DukContext;

View file

@ -5,6 +5,7 @@ import kha.Video;
import iron.Trait; import iron.Trait;
import iron.object.MeshObject; import iron.object.MeshObject;
@:keep
class MovieTexture extends Trait { class MovieTexture extends Trait {
var video:Video; var video:Video;

View file

@ -2,6 +2,7 @@ package armory.trait.internal;
import iron.Trait; import iron.Trait;
@:keep
class NodeExecutor extends Trait { class NodeExecutor extends Trait {
var baseNode:armory.logicnode.Node; var baseNode:armory.logicnode.Node;

View file

@ -9,6 +9,7 @@ import iron.data.Data;
import iron.data.MaterialData; import iron.data.MaterialData;
import iron.data.MaterialData.MaterialContext; import iron.data.MaterialData.MaterialContext;
@:keep
class PathTracer extends Trait { class PathTracer extends Trait {
var context:MaterialContext; var context:MaterialContext;

View file

@ -17,6 +17,7 @@ class ContactPair {
} }
} }
@:keep
class PhysicsWorld extends Trait { class PhysicsWorld extends Trait {
#if (!WITH_PHYSICS) #if (!WITH_PHYSICS)

View file

@ -9,6 +9,7 @@ import iron.math.Vec4;
import iron.object.Transform; import iron.object.Transform;
import iron.object.MeshObject; import iron.object.MeshObject;
@:keep
class RigidBody extends Trait { class RigidBody extends Trait {
#if (!WITH_PHYSICS) #if (!WITH_PHYSICS)

Binary file not shown.

View file

@ -2596,6 +2596,43 @@ class ArmoryExporter(bpy.types.Operator, ExportHelper):
break break
def cb_export_object(self, bobject, o, type): def cb_export_object(self, bobject, o, type):
# Animation setup
if self.is_bone_animation_enabled(bobject) or self.is_object_animation_enabled(bobject):
x = {}
if len(bobject.my_cliptraitlist) > 0:
# Edit clips enabled
x['names'] = []
x['starts'] = []
x['ends'] = []
x['speeds'] = []
x['loops'] = []
x['reflects'] = []
for at in bobject.my_cliptraitlist:
if at.enabled_prop:
x['names'].append(at.name)
x['starts'].append(at.start_prop)
x['ends'].append(at.end_prop)
x['speeds'].append(at.speed_prop)
x['loops'].append(at.loop_prop)
x['reflects'].append(at.reflect_prop)
x['start_track'] = bobject.start_track_name_prop
x['max_bones'] = bpy.data.worlds['Arm'].generate_gpu_skin_max_bones
else:
# Export default clip, taking full action
if self.is_bone_animation_enabled(bobject):
begin_frame, end_frame = self.get_action_framerange(bobject.parent.animation_data.action)
else:
begin_frame, end_frame = self.get_action_framerange(bobject.animation_data.action)
x['start_track'] = 'default'
x['names'] = ['default']
x['starts'] = [begin_frame]
x['ends'] = [end_frame]
x['speeds'] = [1.0]
x['loops'] = [True]
x['reflects'] = [False]
x['max_bones'] = bpy.data.worlds['Arm'].generate_gpu_skin_max_bones
o['animation_setup'] = x
# Export traits # Export traits
o['traits'] = [] o['traits'] = []
for t in bobject.my_traitlist: for t in bobject.my_traitlist:
@ -2606,17 +2643,18 @@ class ArmoryExporter(bpy.types.Operator, ExportHelper):
x['type'] = 'Script' x['type'] = 'Script'
x['class_name'] = bpy.data.worlds['Arm'].ArmProjectPackage + '.node.' + utils.safe_filename(t.nodes_name_prop) x['class_name'] = bpy.data.worlds['Arm'].ArmProjectPackage + '.node.' + utils.safe_filename(t.nodes_name_prop)
elif t.type_prop == 'JS Script' or t.type_prop == 'Python Script': elif t.type_prop == 'JS Script' or t.type_prop == 'Python Script':
basename = t.jsscript_prop.split('.')[0]
x['type'] = 'Script' x['type'] = 'Script'
x['class_name'] = 'armory.trait.internal.JSScript' x['class_name'] = 'armory.trait.internal.JSScript'
x['parameters'] = [utils.safe_filename(t.jsscript_prop)] x['parameters'] = [utils.safe_filename(basename)]
scriptspath = utils.get_fp() + '/build/compiled/scripts/' scriptspath = utils.get_fp() + '/build/compiled/scripts/'
if not os.path.exists(scriptspath): if not os.path.exists(scriptspath):
os.makedirs(scriptspath) os.makedirs(scriptspath)
# Compile to JS # Compile to JS
if t.type_prop == 'Python Script': if t.type_prop == 'Python Script':
# Write py to file # Write py to file
pyname = t.jsscript_prop + '.py' basename_ext = basename + '.py'
targetpath = scriptspath + pyname targetpath = scriptspath + basename_ext
with open(targetpath, 'w') as f: with open(targetpath, 'w') as f:
f.write(bpy.data.texts[t.jsscript_prop].as_string()) f.write(bpy.data.texts[t.jsscript_prop].as_string())
sdk_path = utils.get_sdk_path() sdk_path = utils.get_sdk_path()
@ -2631,10 +2669,10 @@ class ArmoryExporter(bpy.types.Operator, ExportHelper):
cwd = os.getcwd() cwd = os.getcwd()
os.chdir(scriptspath) os.chdir(scriptspath)
# Disable minification for now, too slow # Disable minification for now, too slow
transproc = subprocess.Popen([python_path + ' ' + sdk_path + '/lib/transcrypt/__main__.py' + ' ' + pyname + ' --nomin'], shell=True) transproc = subprocess.Popen([python_path + ' ' + sdk_path + '/lib/transcrypt/__main__.py' + ' ' + basename_ext + ' --nomin'], shell=True)
transproc.wait() transproc.wait()
if transproc.poll() != 0: if transproc.poll() != 0:
make.armory_log('Compiling ' + pyname + ' failed, check console') make.armory_log('Compiling ' + t.jsscript_prop + ' failed, check console')
os.chdir(cwd) os.chdir(cwd)
# Compiled file # Compiled file
assets.add('build/compiled/scripts/__javascript__/' + t.jsscript_prop + '.js') assets.add('build/compiled/scripts/__javascript__/' + t.jsscript_prop + '.js')
@ -2660,37 +2698,6 @@ class ArmoryExporter(bpy.types.Operator, ExportHelper):
x['parameters'].append(ast.literal_eval(pt.name)) x['parameters'].append(ast.literal_eval(pt.name))
o['traits'].append(x) o['traits'].append(x)
# Animation trait
if self.is_bone_animation_enabled(bobject) or self.is_object_animation_enabled(bobject):
x = {}
x['type'] = 'Script'
x['class_name'] = 'armory.trait.internal.Animation'
if len(bobject.my_cliptraitlist) > 0:
# Edit clips enabled
names = []
starts = []
ends = []
speeds = []
loops = []
reflects = []
for at in bobject.my_cliptraitlist:
if at.enabled_prop:
names.append(at.name)
starts.append(at.start_prop)
ends.append(at.end_prop)
speeds.append(at.speed_prop)
loops.append(at.loop_prop)
reflects.append(at.reflect_prop)
x['parameters'] = [bobject.start_track_name_prop, names, starts, ends, speeds, loops, reflects, bpy.data.worlds['Arm'].generate_gpu_skin_max_bones]
else:
# Export default clip, taking full action
if self.is_bone_animation_enabled(bobject):
begin_frame, end_frame = self.get_action_framerange(bobject.parent.animation_data.action)
else:
begin_frame, end_frame = self.get_action_framerange(bobject.animation_data.action)
x['parameters'] = ['default', ['default'], [begin_frame], [end_frame], [1.0], [True], [False], bpy.data.worlds['Arm'].generate_gpu_skin_max_bones]
o['traits'].append(x)
# Rigid body trait # Rigid body trait
if bobject.rigid_body != None: if bobject.rigid_body != None:
ArmoryExporter.export_physics = True ArmoryExporter.export_physics = True

View file

@ -200,15 +200,31 @@ def parse_shader(sres, c, con, defs, lines, parse_attributes):
for l in c['links']: for l in c['links']:
if l['name'] == cid: if l['name'] == cid:
valid_link = True valid_link = True
if 'ifdef' in l: if 'ifdef' in l:
valid_link = False def_found = False
for d in defs: for d in defs:
for link_def in l['ifdef']: for link_def in l['ifdef']:
if d == link_def: if d == link_def:
valid_link = True def_found = True
break break
if valid_link: if def_found:
break break
if not def_found:
valid_link = False
if 'ifndef' in l:
def_found = False
for d in defs:
for link_def in l['ifdef']:
if d == link_def:
def_found = True
break
if def_found:
break
if def_found:
valid_link = False
if valid_link: if valid_link:
tu['link'] = l['link'] tu['link'] = l['link']
break break
@ -229,15 +245,31 @@ def parse_shader(sres, c, con, defs, lines, parse_attributes):
for l in c['links']: for l in c['links']:
if l['name'] == cid: if l['name'] == cid:
valid_link = True valid_link = True
if 'ifdef' in l: if 'ifdef' in l:
valid_link = False def_found = False
for d in defs: for d in defs:
for lifdef in l['ifdef']: for link_def in l['ifdef']:
if d == lifdef: if d == link_def:
valid_link = True def_found = True
break break
if valid_link: if def_found:
break break
if not def_found:
valid_link = False
if 'ifndef' in l:
def_found = False
for d in defs:
for link_def in l['ifdef']:
if d == link_def:
def_found = True
break
if def_found:
break
if def_found:
valid_link = False
if valid_link: if valid_link:
const['link'] = l['link'] const['link'] = l['link']
break break

View file

@ -19,6 +19,7 @@ import lib.make_datas
import lib.make_variants import lib.make_variants
import utils import utils
import assets import assets
import props
# Server # Server
import http.server import http.server
import socketserver import socketserver
@ -84,7 +85,7 @@ def def_strings_to_array(strdefs):
defs = ['_' + d for d in defs] # Restore _ defs = ['_' + d for d in defs] # Restore _
return defs return defs
def export_data(fp, sdk_path, is_play=False, is_publish=False): def export_data(fp, sdk_path, is_play=False, is_publish=False, in_viewport=False):
raw_path = sdk_path + 'armory/raw/' raw_path = sdk_path + 'armory/raw/'
assets_path = sdk_path + 'armory/Assets/' assets_path = sdk_path + 'armory/Assets/'
export_physics = bpy.data.worlds['Arm'].ArmPhysics != 'Disabled' export_physics = bpy.data.worlds['Arm'].ArmPhysics != 'Disabled'
@ -154,7 +155,7 @@ def export_data(fp, sdk_path, is_play=False, is_publish=False):
write_data.write_khafilejs(is_play, export_physics, dce_full=is_publish) write_data.write_khafilejs(is_play, export_physics, dce_full=is_publish)
# Write Main.hx # Write Main.hx
write_data.write_main(is_play, play_project.in_viewport) write_data.write_main(is_play, in_viewport)
# Copy ammo.js if necessary # Copy ammo.js if necessary
#if target_name == 'html5': #if target_name == 'html5':
@ -193,10 +194,11 @@ def get_kha_target(target_name): # TODO: remove
def compile_project(target_name=None, is_publish=False, watch=False): def compile_project(target_name=None, is_publish=False, watch=False):
sdk_path = utils.get_sdk_path() sdk_path = utils.get_sdk_path()
ffmpeg_path = utils.get_ffmpeg_path() ffmpeg_path = utils.get_ffmpeg_path()
wrd = bpy.data.worlds['Arm']
# Set build command # Set build command
if target_name == None: if target_name == None:
target_name = bpy.data.worlds['Arm'].ArmProjectTarget target_name = wrd.ArmProjectTarget
if utils.get_os() == 'win': if utils.get_os() == 'win':
node_path = sdk_path + '/nodejs/node.exe' node_path = sdk_path + '/nodejs/node.exe'
@ -219,6 +221,12 @@ def compile_project(target_name=None, is_publish=False, watch=False):
cmd.append('-g') cmd.append('-g')
cmd.append('opengl2') cmd.append('opengl2')
# User defined commands
cmd_text = wrd.ArmCommandLine
if cmd_text != '':
for s in bpy.data.texts[cmd_text].as_string().split(' '):
cmd.append(s)
# armory_log("Building, see console...") # armory_log("Building, see console...")
if make.play_project.chromium_running: if make.play_project.chromium_running:
@ -248,7 +256,7 @@ def patch_project():
os.chdir(fp) os.chdir(fp)
export_data(fp, sdk_path, is_play=True) export_data(fp, sdk_path, is_play=True)
def build_project(is_play=False, is_publish=False): def build_project(is_play=False, is_publish=False, in_viewport=False):
# Clear flag # Clear flag
play_project.in_viewport = False play_project.in_viewport = False
@ -314,7 +322,7 @@ def build_project(is_play=False, is_publish=False):
# Save internal assets # Save internal assets
# Export data # Export data
export_data(fp, sdk_path, is_play=is_play, is_publish=is_publish) export_data(fp, sdk_path, is_play=is_play, is_publish=is_publish, in_viewport=in_viewport)
if play_project.playproc == None: if play_project.playproc == None:
armory_progress(50) armory_progress(50)
@ -357,7 +365,7 @@ def watch_compile(mode):
def watch_patch(): def watch_patch():
play_project.compileproc.wait() play_project.compileproc.wait()
result = play_project.compileproc.poll() # result = play_project.compileproc.poll()
play_project.compileproc = None play_project.compileproc = None
play_project.compileproc_finished = True play_project.compileproc_finished = True
@ -366,7 +374,7 @@ def play_project(self, in_viewport):
play_project.play_area = bpy.context.area play_project.play_area = bpy.context.area
# Build data # Build data
build_project(is_play=True) build_project(is_play=True, in_viewport=in_viewport)
play_project.in_viewport = in_viewport play_project.in_viewport = in_viewport
wrd = bpy.data.worlds['Arm'] wrd = bpy.data.worlds['Arm']
@ -516,6 +524,7 @@ def clean_project():
def publish_project(): def publish_project():
# Force minimize data # Force minimize data
props.invalidate_compiled_data.enabled = False
minimize = bpy.data.worlds['Arm'].ArmMinimize minimize = bpy.data.worlds['Arm'].ArmMinimize
bpy.data.worlds['Arm'].ArmMinimize = True bpy.data.worlds['Arm'].ArmMinimize = True
clean_project() clean_project()
@ -523,6 +532,7 @@ def publish_project():
play_project.compileproc = compile_project(target_name=bpy.data.worlds['Arm'].ArmPublishTarget, is_publish=True) play_project.compileproc = compile_project(target_name=bpy.data.worlds['Arm'].ArmPublishTarget, is_publish=True)
threading.Timer(0.1, watch_compile, ['publish']).start() threading.Timer(0.1, watch_compile, ['publish']).start()
bpy.data.worlds['Arm'].ArmMinimize = minimize bpy.data.worlds['Arm'].ArmMinimize = minimize
props.invalidate_compiled_data.enabled = True
# Registration # Registration
def register(): def register():

View file

@ -20,20 +20,21 @@ def reload_blend_data():
def load_library(): def load_library():
sdk_path = utils.get_sdk_path() sdk_path = utils.get_sdk_path()
data_path = sdk_path + '/armory/blender/data/data.blend' data_path = sdk_path + '/armory/blender/data/data.blend'
data_names = ['forward_path', 'forward_path_low', 'deferred_path', 'deferred_path_low', 'deferred_path_high', 'hybrid_path', 'vr_path', 'pathtrace_path', 'Armory PBR']
# Remove old
for name in data_names:
if name in bpy.data.node_groups and name != 'Armory PBR':
bpy.data.node_groups.remove(bpy.data.node_groups[name], do_unlink=True)
# Import
data_refs = data_names.copy()
with bpy.data.libraries.load(data_path, link=False) as (data_from, data_to): with bpy.data.libraries.load(data_path, link=False) as (data_from, data_to):
data_to.node_groups = ['forward_path', 'forward_path_low', 'deferred_path', 'deferred_path_low', 'deferred_path_high', 'hybrid_path', 'vr_path', 'pathtrace_path', 'Armory PBR'] data_to.node_groups = data_refs
# TODO: cannot use for loop for ref in data_refs:
bpy.data.node_groups['forward_path'].use_fake_user = True ref.use_fake_user = True
bpy.data.node_groups['forward_path_low'].use_fake_user = True # bpy.data.node_groups[name].use_fake_user = True
bpy.data.node_groups['deferred_path'].use_fake_user = True
bpy.data.node_groups['deferred_path_low'].use_fake_user = True
bpy.data.node_groups['deferred_path_high'].use_fake_user = True
bpy.data.node_groups['hybrid_path'].use_fake_user = True
bpy.data.node_groups['vr_path'].use_fake_user = True
bpy.data.node_groups['pathtrace_path'].use_fake_user = True
bpy.data.node_groups['Armory PBR'].use_fake_user = True
def buildNodeTrees(assets_path): def buildNodeTrees(assets_path):
s = bpy.data.filepath.split(os.path.sep) s = bpy.data.filepath.split(os.path.sep)

View file

@ -140,6 +140,8 @@ def parse_surface(world, node, context):
def parse_color(world, node, context, envmap_strength_const): def parse_color(world, node, context, envmap_strength_const):
# Env map included # Env map included
if node.type == 'TEX_ENVIRONMENT': if node.type == 'TEX_ENVIRONMENT':
envmap_strength_const['float'] *= 2.0 # Match to cycles
texture = {} texture = {}
context['bind_textures'].append(texture) context['bind_textures'].append(texture)
texture['name'] = 'envmap' texture['name'] = 'envmap'
@ -187,6 +189,8 @@ def parse_color(world, node, context, envmap_strength_const):
# Append sky define # Append sky define
elif node.type == 'TEX_SKY': elif node.type == 'TEX_SKY':
envmap_strength_const['float'] *= 0.25 # Match to Cycles
bpy.data.worlds['Arm'].world_defs += '_EnvSky' bpy.data.worlds['Arm'].world_defs += '_EnvSky'
# Append sky properties to material # Append sky properties to material
const = {} const = {}
@ -209,12 +213,10 @@ def parse_color(world, node, context, envmap_strength_const):
bpy.data.worlds['Arm'].world_defs += '_Rad' bpy.data.worlds['Arm'].world_defs += '_Rad'
sdk_path = utils.get_sdk_path() sdk_path = utils.get_sdk_path()
# Use fake maps for now
assets.add(sdk_path + 'armory/Assets/hosek/hosek_radiance.hdr') assets.add(sdk_path + 'armory/Assets/hosek/hosek_radiance.hdr')
for i in range(0, 8): for i in range(0, 8):
assets.add(sdk_path + 'armory/Assets/hosek/hosek_radiance_' + str(i) + '.hdr') assets.add(sdk_path + 'armory/Assets/hosek/hosek_radiance_' + str(i) + '.hdr')
world.world_envtex_name = 'hosek' world.world_envtex_name = 'hosek'
world.world_envtex_num_mips = 8 world.world_envtex_num_mips = 8
# Adjust strength to match Cycles
envmap_strength_const['float'] *= 0.25

View file

@ -35,7 +35,7 @@ precision mediump float;
#endif #endif
in vec3 initialRay; in vec3 initialRay;
in vec2 texCoord; in vec2 texCoord;
out vec4 outColor; out vec4 fragColor;
uniform vec3 eye; uniform vec3 eye;
//uniform float textureWeight; //uniform float textureWeight;
uniform float timeSinceStart; uniform float timeSinceStart;
@ -321,8 +321,8 @@ void main() {
""" """
//} //}
outColor = vec4(vec3(col / samples), 1.0); fragColor = vec4(vec3(col / samples), 1.0);
outColor.rgb = pow(outColor.rgb * 0.7, vec3(1.0 / 2.2)); fragColor.rgb = pow(fragColor.rgb * 0.7, vec3(1.0 / 2.2));
} }
""" """

View file

@ -148,18 +148,22 @@ def on_load_pre(context):
def invalidate_shader_cache(self, context): def invalidate_shader_cache(self, context):
# compiled.glsl changed, recompile all shaders next time # compiled.glsl changed, recompile all shaders next time
if invalidate_shader_cache.enabled: if invalidate_shader_cache.enabled == False:
fp = utils.get_fp() return
if os.path.isdir(fp + '/build/compiled/ShaderDatas'): fp = utils.get_fp()
shutil.rmtree(fp + '/build/compiled/ShaderDatas') if os.path.isdir(fp + '/build/compiled/ShaderDatas'):
shutil.rmtree(fp + '/build/compiled/ShaderDatas')
invalidate_shader_cache.enabled = True # Disable invalidating during build process invalidate_shader_cache.enabled = True # Disable invalidating during build process
def invalidate_compiled_data(self, context): def invalidate_compiled_data(self, context):
if invalidate_compiled_data.enabled == False:
return
fp = utils.get_fp() fp = utils.get_fp()
if os.path.isdir(fp + '/build/compiled/Assets'): if os.path.isdir(fp + '/build/compiled/Assets'):
shutil.rmtree(fp + '/build/compiled/Assets') shutil.rmtree(fp + '/build/compiled/Assets')
if os.path.isdir(fp + '/build/compiled/ShaderDatas'): if os.path.isdir(fp + '/build/compiled/ShaderDatas'):
shutil.rmtree(fp + '/build/compiled/ShaderDatas') shutil.rmtree(fp + '/build/compiled/ShaderDatas')
invalidate_compiled_data.enabled = True
def invalidate_mesh_data(self, context): def invalidate_mesh_data(self, context):
fp = utils.get_fp() fp = utils.get_fp()
@ -198,6 +202,7 @@ def initProperties():
('Recast', 'Recast', 'Recast')], ('Recast', 'Recast', 'Recast')],
name = "Navigation", default='Disabled') name = "Navigation", default='Disabled')
bpy.types.World.ArmKhafile = StringProperty(name = "Khafile", description="Source appended to khafile.js") bpy.types.World.ArmKhafile = StringProperty(name = "Khafile", description="Source appended to khafile.js")
bpy.types.World.ArmCommandLine = StringProperty(name = "Command Line", description="Commands appended to khamake")
bpy.types.World.ArmMinimize = BoolProperty(name="Minimize Data", description="Export scene data in binary", default=True, update=invalidate_compiled_data) bpy.types.World.ArmMinimize = BoolProperty(name="Minimize Data", description="Export scene data in binary", default=True, update=invalidate_compiled_data)
bpy.types.World.ArmOptimizeMesh = BoolProperty(name="Optimize Meshes", description="Export more efficient geometry indices, can prolong build times", default=False, update=invalidate_mesh_data) bpy.types.World.ArmOptimizeMesh = BoolProperty(name="Optimize Meshes", description="Export more efficient geometry indices, can prolong build times", default=False, update=invalidate_mesh_data)
bpy.types.World.ArmSampledAnimation = BoolProperty(name="Sampled Animation", description="Export object animation as raw matrices", default=False, update=invalidate_compiled_data) bpy.types.World.ArmSampledAnimation = BoolProperty(name="Sampled Animation", description="Export object animation as raw matrices", default=False, update=invalidate_compiled_data)
@ -855,6 +860,7 @@ class ArmoryProjectPanel(bpy.types.Panel):
layout.prop(wrd, 'ArmProjectName') layout.prop(wrd, 'ArmProjectName')
layout.prop(wrd, 'ArmProjectPackage') layout.prop(wrd, 'ArmProjectPackage')
layout.prop_search(wrd, 'ArmKhafile', bpy.data, 'texts', 'Khafile') layout.prop_search(wrd, 'ArmKhafile', bpy.data, 'texts', 'Khafile')
layout.prop_search(wrd, 'ArmCommandLine', bpy.data, 'texts', 'Command Line')
layout.operator('arm.publish') layout.operator('arm.publish')
layout.prop(wrd, 'ArmPublishTarget') layout.prop(wrd, 'ArmPublishTarget')

View file

@ -15,11 +15,12 @@ def write_khafilejs(is_play, export_physics, dce_full=False):
shader_references = sorted(list(set(assets.shaders))) shader_references = sorted(list(set(assets.shaders)))
shader_data_references = sorted(list(set(assets.shader_datas))) shader_data_references = sorted(list(set(assets.shader_datas)))
asset_references = sorted(list(set(assets.assets))) asset_references = sorted(list(set(assets.assets)))
wrd = bpy.data.worlds['Arm']
with open('khafile.js', 'w') as f: with open('khafile.js', 'w') as f:
f.write( f.write(
"""// Auto-generated """// Auto-generated
let project = new Project('""" + bpy.data.worlds['Arm'].ArmProjectName + """'); let project = new Project('""" + wrd.ArmProjectName + """');
project.addSources('Sources'); project.addSources('Sources');
""") """)
@ -35,7 +36,7 @@ project.addSources('Sources');
f.write("project.addParameter('-dce full');") f.write("project.addParameter('-dce full');")
# Electron live patching # Electron live patching
# if is_play and bpy.data.worlds['Arm'].ArmPlayLivePatch == True and bpy.data.worlds['Arm'].ArmPlayRuntime == 'Electron': # if is_play and wrd.ArmPlayLivePatch == True and wrd.ArmPlayRuntime == 'Electron':
# f.write("project.addDefine('WITH_PATCH_ELECTRON');\n") # f.write("project.addDefine('WITH_PATCH_ELECTRON');\n")
# Native scripting # Native scripting
@ -52,7 +53,7 @@ project.addSources('Sources');
ref = ref.replace('\\', '/') ref = ref.replace('\\', '/')
f.write("project.addAssets('" + ref + "');\n") f.write("project.addAssets('" + ref + "');\n")
if bpy.data.worlds['Arm'].ArmPlayConsole: if wrd.ArmPlayConsole:
f.write("project.addDefine('WITH_PROFILE');\n") f.write("project.addDefine('WITH_PROFILE');\n")
f.write(add_armory_library(sdk_path, 'lib/zui')) f.write(add_armory_library(sdk_path, 'lib/zui'))
font_path = sdk_path + '/armory/Assets/droid_sans.ttf' font_path = sdk_path + '/armory/Assets/droid_sans.ttf'
@ -63,19 +64,19 @@ project.addSources('Sources');
# f.write(add_armory_library(sdk_path, 'lib/haxeui/haxeui-kha')) # f.write(add_armory_library(sdk_path, 'lib/haxeui/haxeui-kha'))
# f.write(add_armory_library(sdk_path, 'lib/haxeui/hscript')) # f.write(add_armory_library(sdk_path, 'lib/haxeui/hscript'))
if bpy.data.worlds['Arm'].ArmMinimize == False: if wrd.ArmMinimize == False:
f.write("project.addDefine('WITH_JSON');\n") f.write("project.addDefine('WITH_JSON');\n")
if bpy.data.worlds['Arm'].ArmDeinterleavedBuffers == True: if wrd.ArmDeinterleavedBuffers == True:
f.write("project.addDefine('WITH_DEINTERLEAVED');\n") f.write("project.addDefine('WITH_DEINTERLEAVED');\n")
if bpy.data.worlds['Arm'].generate_gpu_skin == False: if wrd.generate_gpu_skin == False:
f.write("project.addDefine('WITH_CPU_SKIN');\n") f.write("project.addDefine('WITH_CPU_SKIN');\n")
for d in assets.khafile_defs: for d in assets.khafile_defs:
f.write("project.addDefine('" + d + "');\n") f.write("project.addDefine('" + d + "');\n")
config_text = bpy.data.worlds['Arm'].ArmKhafile config_text = wrd.ArmKhafile
if config_text != '': if config_text != '':
f.write(bpy.data.texts[config_text].as_string()) f.write(bpy.data.texts[config_text].as_string())

View file

@ -214,7 +214,8 @@ def parse_band_floats(irradiance_floats, band_line):
def write_sky_irradiance(base_name): def write_sky_irradiance(base_name):
# Predefined fake spherical harmonics for now # Predefined fake spherical harmonics for now
irradiance_floats = [1.0281457342829743,1.1617608778901902,1.3886220898440544,-0.13044863139637752,-0.2794659158733846,-0.5736106907295643,0.04065421813873111,0.0434367391348577,0.03567450494792305,0.10964557605577738,0.1129839085793664,0.11261660812141877,-0.08271974283263238,-0.08068091195339556,-0.06432614970480094,-0.12517787967665814,-0.11638582546310804,-0.09743696224655113,0.20068697715947176,0.2158788783296805,0.2109374396869599,0.19636637427150455,0.19445523113118082,0.17825330699680575,0.31440860839538637,0.33041120060402407,0.30867788630062676] # irradiance_floats = [1.0281457342829743,1.1617608778901902,1.3886220898440544,-0.13044863139637752,-0.2794659158733846,-0.5736106907295643,0.04065421813873111,0.0434367391348577,0.03567450494792305,0.10964557605577738,0.1129839085793664,0.11261660812141877,-0.08271974283263238,-0.08068091195339556,-0.06432614970480094,-0.12517787967665814,-0.11638582546310804,-0.09743696224655113,0.20068697715947176,0.2158788783296805,0.2109374396869599,0.19636637427150455,0.19445523113118082,0.17825330699680575,0.31440860839538637,0.33041120060402407,0.30867788630062676]
irradiance_floats = [0.5282714503101548,0.6576873502619733,1.0692444882409775,0.17108712865136044,-0.08840906601412168,-0.5016437779078063,-0.05123227009753221,-0.06724088656181595,-0.07651659183264257,-0.09740705087869408,-0.19569235551561795,-0.3087497307203731,0.056717192983076405,0.1109186355691673,0.20616582000220154,0.013898321643280141,0.05985657405787638,0.12638202463080392,-0.003224443014484806,0.013764449325286695,0.04288850064700093,0.1796545401960917,0.21595731080039757,0.29144356515614844,0.10152875101705996,0.2651761450155488,0.4778582813756466]
# Hosek # Hosek
# irradiance_floats = [1.5519331988822218,2.3352207154503266,2.997277451988076,0.2673894962434794,0.4305630474135794,0.11331825259716752,-0.04453633521758638,-0.038753175134160295,-0.021302768541875794,0.00055858020486499,0.000371654770334503,0.000126606145406403,-0.000135708721978705,-0.000787399554583089,-0.001550090690860059,0.021947399048903773,0.05453650591711572,0.08783641266630278,0.17053593578630663,0.14734127083304463,0.07775404698816404,-2.6924363189795e-05,-7.9350169701934e-05,-7.559914435231e-05,0.27035455385870993,0.23122918445556914,0.12158817295211832] # irradiance_floats = [1.5519331988822218,2.3352207154503266,2.997277451988076,0.2673894962434794,0.4305630474135794,0.11331825259716752,-0.04453633521758638,-0.038753175134160295,-0.021302768541875794,0.00055858020486499,0.000371654770334503,0.000126606145406403,-0.000135708721978705,-0.000787399554583089,-0.001550090690860059,0.021947399048903773,0.05453650591711572,0.08783641266630278,0.17053593578630663,0.14734127083304463,0.07775404698816404,-2.6924363189795e-05,-7.9350169701934e-05,-7.559914435231e-05,0.27035455385870993,0.23122918445556914,0.12158817295211832]
# for i in range(0, len(irradiance_floats)): # for i in range(0, len(irradiance_floats)):

View file

@ -7,8 +7,8 @@ precision mediump float;
uniform sampler2D tex; uniform sampler2D tex;
in vec2 texCoord; in vec2 texCoord;
out vec4 outColor; out vec4 fragColor;
void main() { void main() {
outColor = texture(tex, texCoord); fragColor = texture(tex, texCoord);
} }

View file

@ -9,7 +9,7 @@ precision mediump float;
uniform sampler2D tex; uniform sampler2D tex;
in vec2 texCoord; in vec2 texCoord;
out vec4 outColor; out vec4 fragColor;
//const float bloomTreshold = 3.0; //const float bloomTreshold = 3.0;
@ -17,9 +17,9 @@ void main() {
vec4 col = texture(tex, texCoord); vec4 col = texture(tex, texCoord);
float brightness = dot(col.rgb, vec3(0.2126, 0.7152, 0.0722)); float brightness = dot(col.rgb, vec3(0.2126, 0.7152, 0.0722));
if (brightness > bloomTreshold) { if (brightness > bloomTreshold) {
outColor.rgb = vec3(col.rgb); fragColor.rgb = vec3(col.rgb);
return; return;
} }
outColor.rgb = vec3(0.0); fragColor.rgb = vec3(0.0);
} }

View file

@ -14,7 +14,7 @@ uniform vec2 dir;
uniform vec2 screenSize; uniform vec2 screenSize;
in vec2 texCoord; in vec2 texCoord;
out vec4 outColor; out vec4 fragColor;
vec2 unpackFloat(float f) { vec2 unpackFloat(float f) {
return vec2(floor(f) / 1000.0, fract(f)); return vec2(floor(f) / 1000.0, fract(f));
@ -24,7 +24,7 @@ void main() {
vec2 tc = texCoord * ssrTextureScale; vec2 tc = texCoord * ssrTextureScale;
float roughness = unpackFloat(texture(gbuffer0, texCoord).b).y; float roughness = unpackFloat(texture(gbuffer0, texCoord).b).y;
// if (roughness == 0.0) { // Always blur for now, non blured output can produce noise // if (roughness == 0.0) { // Always blur for now, non blured output can produce noise
// outColor = texture(tex, tc); // fragColor = texture(tex, tc);
// return; // return;
// } // }
@ -45,5 +45,5 @@ void main() {
// result /= vec3(11.0); // result /= vec3(11.0);
result /= vec3(5.0); result /= vec3(5.0);
outColor.rgb = vec3(result); fragColor.rgb = vec3(result);
} }

View file

@ -14,7 +14,7 @@ uniform vec2 dir;
uniform vec2 screenSize; uniform vec2 screenSize;
in vec2 texCoord; in vec2 texCoord;
out vec4 outColor; out vec4 fragColor;
const float blurWeights[10] = float[] (0.132572, 0.125472, 0.106373, 0.08078, 0.05495, 0.033482, 0.018275, 0.008934, 0.003912, 0.001535); const float blurWeights[10] = float[] (0.132572, 0.125472, 0.106373, 0.08078, 0.05495, 0.033482, 0.018275, 0.008934, 0.003912, 0.001535);
const float discardThreshold = 0.95; const float discardThreshold = 0.95;
@ -66,7 +66,7 @@ void main() {
// result += texture(tex, tc - (step * 3.5)).rgb; // result += texture(tex, tc - (step * 3.5)).rgb;
// result += texture(tex, tc - (step * 4.5)).rgb; // result += texture(tex, tc - (step * 4.5)).rgb;
// result /= vec3(9.0); // result /= vec3(9.0);
// outColor.rgb = vec3(result); // fragColor.rgb = vec3(result);
vec3 nor = getNor(texture(gbuffer0, texCoord).rg); vec3 nor = getNor(texture(gbuffer0, texCoord).rg);
@ -87,6 +87,6 @@ void main() {
// } // }
result /= weight; result /= weight;
// outColor = vec4(result.rgb, 1.0); // fragColor = vec4(result.rgb, 1.0);
outColor = vec4(result.rrr, 1.0); // SSAO only fragColor = vec4(result.rrr, 1.0); // SSAO only
} }

View file

@ -12,7 +12,7 @@ uniform vec2 dir;
uniform vec2 screenSize; uniform vec2 screenSize;
in vec2 texCoord; in vec2 texCoord;
out vec4 outColor; out vec4 fragColor;
// const float weight[5] = float[] (0.227027, 0.1945946, 0.1216216, 0.054054, 0.016216); // const float weight[5] = float[] (0.227027, 0.1945946, 0.1216216, 0.054054, 0.016216);
// const float weight[8] = float[] (0.197448, 0.174697, 0.120999, 0.065602, 0.02784, 0.009246, 0.002403, 0.000489); // const float weight[8] = float[] (0.197448, 0.174697, 0.120999, 0.065602, 0.02784, 0.009246, 0.002403, 0.000489);
@ -39,5 +39,5 @@ void main() {
result += texture(tex, texCoord + step * 7.5).rgb * weight[7] * bloomStrength; result += texture(tex, texCoord + step * 7.5).rgb * weight[7] * bloomStrength;
result += texture(tex, texCoord - step * 7.5).rgb * weight[7] * bloomStrength; result += texture(tex, texCoord - step * 7.5).rgb * weight[7] * bloomStrength;
outColor.rgb = vec3(result); fragColor.rgb = vec3(result);
} }

View file

@ -10,7 +10,7 @@ uniform vec2 dir;
uniform vec2 screenSize; uniform vec2 screenSize;
in vec2 texCoord; in vec2 texCoord;
out vec4 outColor; out vec4 fragColor;
void main() { void main() {
vec2 step = dir / screenSize; vec2 step = dir / screenSize;
@ -28,5 +28,5 @@ void main() {
result += texture(tex, texCoord - (step * 5.5)).rgb; result += texture(tex, texCoord - (step * 5.5)).rgb;
result /= vec3(11.0); result /= vec3(11.0);
outColor.rgb = vec3(result); fragColor.rgb = vec3(result);
} }

View file

@ -8,7 +8,7 @@ uniform sampler2D tex;
uniform sampler2D tex2; uniform sampler2D tex2;
in vec2 texCoord; in vec2 texCoord;
out vec4 outColor; out vec4 fragColor;
const float exposure = 1.0; const float exposure = 1.0;
const float gamma = 2.2; const float gamma = 2.2;
@ -25,7 +25,7 @@ void main() {
// Gamma correction // Gamma correction
// result = pow(result, vec3(1.0 / gamma)); // result = pow(result, vec3(1.0 / gamma));
// outColor.rgb = result; // fragColor.rgb = result;
outColor.rgb = col; fragColor.rgb = col;
} }

View file

@ -33,7 +33,7 @@ in vec2 texCoord;
#ifdef _CompoPos #ifdef _CompoPos
in vec3 viewRay; in vec3 viewRay;
#endif #endif
out vec4 outColor; out vec4 fragColor;
const float focus_depth = 0.5; const float focus_depth = 0.5;
@ -311,5 +311,5 @@ void main() {
col.rgb *= 1.0 - step(0.5 - compoLetterboxSize, abs(0.5 - texCoord.y)); col.rgb *= 1.0 - step(0.5 - compoLetterboxSize, abs(0.5 - texCoord.y));
#endif #endif
outColor = col; fragColor = col;
} }

View file

@ -7,8 +7,8 @@ precision mediump float;
uniform sampler2D tex; uniform sampler2D tex;
in vec2 texCoord; in vec2 texCoord;
out vec4 outColor; out vec4 fragColor;
void main() { void main() {
outColor = texture(tex, texCoord); fragColor = texture(tex, texCoord);
} }

View file

@ -12,7 +12,7 @@ uniform vec3 eyeLook;
in vec2 texCoord; in vec2 texCoord;
in vec3 viewRay; in vec3 viewRay;
out vec4 outColor; out vec4 fragColor;
vec2 octahedronWrap(vec2 v) { vec2 octahedronWrap(vec2 v) {
return (1.0 - abs(v.yx)) * (vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0)); return (1.0 - abs(v.yx)) * (vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0));
@ -44,7 +44,7 @@ void main() {
n.xy = n.z >= 0.0 ? enc.xy : octahedronWrap(enc.xy); n.xy = n.z >= 0.0 ? enc.xy : octahedronWrap(enc.xy);
n = normalize(n); n = normalize(n);
outColor = vec4(n * 0.5 + 0.5, 1.0); fragColor = vec4(n * 0.5 + 0.5, 1.0);
// vec3 p = getPos(depth); // vec3 p = getPos(depth);
// vec3 baseColor = g1.rgb; // vec3 baseColor = g1.rgb;

View file

@ -9,9 +9,9 @@ precision mediump float;
uniform sampler2D tex; uniform sampler2D tex;
in vec2 texCoord; in vec2 texCoord;
out vec4 outColor; out vec4 fragColor;
void main() { void main() {
vec4 col = texture(tex, texCoord); vec4 col = texture(tex, texCoord);
outColor = vec4(col.r * 10.0, col.g * 10.0, 0.0, 1.0); fragColor = vec4(col.r * 10.0, col.g * 10.0, 0.0, 1.0);
} }

View file

@ -30,7 +30,7 @@ uniform mat4 V;
in vec4 wvpposition; in vec4 wvpposition;
in vec4 matColor; in vec4 matColor;
// in vec3 orientation; // in vec3 orientation;
out vec4[2] outColor; out vec4[2] fragColor;
mat3 cotangentFrame(vec3 nor, vec3 pos, vec2 uv) { mat3 cotangentFrame(vec3 nor, vec3 pos, vec2 uv) {
// Get edge vectors of the pixel triangle // Get edge vectors of the pixel triangle
@ -98,9 +98,9 @@ void main() {
// Alpha write is disabled in shader res, we acces all channels for blending // Alpha write is disabled in shader res, we acces all channels for blending
// Use separate texture for base color in the future // Use separate texture for base color in the future
outColor[1].rgb = baseColor.rgb; fragColor[1].rgb = baseColor.rgb;
outColor[1].a = baseColor.a; fragColor[1].a = baseColor.a;
// outColor[1].a = packFloat(roughness, metalness) * baseColor.a; // fragColor[1].a = packFloat(roughness, metalness) * baseColor.a;
#ifdef _MetTex #ifdef _MetTex
float metalness = texture(smetal, texCoord).r; float metalness = texture(smetal, texCoord).r;
@ -128,15 +128,15 @@ void main() {
n /= (abs(n.x) + abs(n.y) + abs(n.z)); n /= (abs(n.x) + abs(n.y) + abs(n.z));
n.xy = n.z >= 0.0 ? n.xy : octahedronWrap(n.xy); n.xy = n.z >= 0.0 ? n.xy : octahedronWrap(n.xy);
outColor[0].rg = n.xy; fragColor[0].rg = n.xy;
#else #else
outColor[0].rg = vec2(1.0); fragColor[0].rg = vec2(1.0);
#endif #endif
// outColor[0].b unused for now so we can rewrite it // fragColor[0].b unused for now so we can rewrite it
outColor[0].b = 0.0; fragColor[0].b = 0.0;
// use separete RG texture for normal storage in the future // use separete RG texture for normal storage in the future
// Color mask does not disable write for all buffers so mask is overwritten // Color mask does not disable write for all buffers so mask is overwritten
// Half of color alpha to soft normals blend // Half of color alpha to soft normals blend
outColor[0].a = baseColor.a / 2.0; fragColor[0].a = baseColor.a / 2.0;
} }

View file

@ -9,7 +9,7 @@ precision mediump float;
// #endif // #endif
// in vec4 position; // in vec4 position;
out vec4 outColor; out vec4 fragColor;
void main() { void main() {
@ -18,5 +18,5 @@ void main() {
// gl_FragDepth = depth; // gl_FragDepth = depth;
// gl_FragColor = vec4(depth, 0.0, 0.0, 1.0); // gl_FragColor = vec4(depth, 0.0, 0.0, 1.0);
outColor = vec4(0.0, 0.0, 0.0, 1.0); fragColor = vec4(0.0, 0.0, 0.0, 1.0);
} }

View file

@ -73,9 +73,9 @@ in vec4 matColor;
#endif #endif
#ifdef _Veloc #ifdef _Veloc
out vec4[3] outColor; out vec4[3] fragColor;
#else #else
out vec4[2] outColor; out vec4[2] fragColor;
#endif #endif
float packFloat(float f1, float f2) { float packFloat(float f1, float f2) {
@ -260,15 +260,15 @@ void main() {
mask_probe = probeID + clampres; mask_probe = probeID + clampres;
} }
} }
outColor[0] = vec4(n.xy, packFloat(metalness, roughness), mask_probe); fragColor[0] = vec4(n.xy, packFloat(metalness, roughness), mask_probe);
#else #else
outColor[0] = vec4(n.xy, packFloat(metalness, roughness), mask); fragColor[0] = vec4(n.xy, packFloat(metalness, roughness), mask);
#endif #endif
outColor[1] = vec4(baseColor.rgb, occ); fragColor[1] = vec4(baseColor.rgb, occ);
#ifdef _Veloc #ifdef _Veloc
vec2 posa = (wvppos.xy / wvppos.w) * 0.5 + 0.5; vec2 posa = (wvppos.xy / wvppos.w) * 0.5 + 0.5;
vec2 posb = (prevwvppos.xy / prevwvppos.w) * 0.5 + 0.5; vec2 posb = (prevwvppos.xy / prevwvppos.w) * 0.5 + 0.5;
outColor[2].rg = vec2(posa - posb); fragColor[2].rg = vec2(posa - posb);
#endif #endif
} }

View file

@ -43,7 +43,7 @@ in vec2 te_texCoord;
in vec3 te_normal; in vec3 te_normal;
#endif #endif
out vec4[2] outColor; out vec4[2] fragColor;
float packFloat(float f1, float f2) { float packFloat(float f1, float f2) {
float index = floor(f1 * 1000.0); // Temporary float index = floor(f1 * 1000.0); // Temporary
@ -100,6 +100,6 @@ void main() {
n /= (abs(n.x) + abs(n.y) + abs(n.z)); n /= (abs(n.x) + abs(n.y) + abs(n.z));
n.xy = n.z >= 0.0 ? n.xy : octahedronWrap(n.xy); n.xy = n.z >= 0.0 ? n.xy : octahedronWrap(n.xy);
outColor[0] = vec4(n.xy, packFloat(metalness, roughness), mask); fragColor[0] = vec4(n.xy, packFloat(metalness, roughness), mask);
outColor[1] = vec4(baseColor.rgb, occ); fragColor[1] = vec4(baseColor.rgb, occ);
} }

View file

@ -90,7 +90,7 @@ in vec3 eyeDir;
#else #else
in vec3 normal; in vec3 normal;
#endif #endif
out vec4 outColor; out vec4 fragColor;
#ifndef _NoShadows #ifndef _NoShadows
// float linstep(float low, float high, float v) { // float linstep(float low, float high, float v) {
@ -606,9 +606,9 @@ void main() {
sf = step(0.5, sf); sf = step(0.5, sf);
} }
outColor.rgb = ambientMaterial + (df * diffuseMaterial + sf * specularMaterial) * visibility; fragColor.rgb = ambientMaterial + (df * diffuseMaterial + sf * specularMaterial) * visibility;
float edgeDetection = (dot(v, n) < 0.1) ? 0.0 : 1.0; float edgeDetection = (dot(v, n) < 0.1) ? 0.0 : 1.0;
outColor.rgb *= edgeDetection; fragColor.rgb *= edgeDetection;
// const int levels = 4; // const int levels = 4;
// const float scaleFactor = 1.0 / levels; // const float scaleFactor = 1.0 / levels;
@ -626,7 +626,7 @@ void main() {
// float specMask = (pow(dot(h, n), shininess) > 0.4) ? 1.0 : 0.0; // float specMask = (pow(dot(h, n), shininess) > 0.4) ? 1.0 : 0.0;
// float edgeDetection = (dot(v, n) > 0.3) ? 1.0 : 0.0; // float edgeDetection = (dot(v, n) > 0.3) ? 1.0 : 0.0;
// outColor.rgb = edgeDetection * ((diffuseColor + specular * specMask) * visibility + ambientMaterial); // fragColor.rgb = edgeDetection * ((diffuseColor + specular * specMask) * visibility + ambientMaterial);
#endif #endif
@ -682,20 +682,20 @@ void main() {
indirect += indirectSpecular; indirect += indirectSpecular;
#endif #endif
indirect = indirect * envmapStrength; // * lightColor * lightStrength; indirect = indirect * envmapStrength; // * lightColor * lightStrength;
outColor = vec4(vec3(direct * visibility + indirect), 1.0); fragColor = vec4(vec3(direct * visibility + indirect), 1.0);
#ifdef _OccTex #ifdef _OccTex
vec3 occ = texture(socclusion, texCoord).rgb; vec3 occ = texture(socclusion, texCoord).rgb;
outColor.rgb *= occ; fragColor.rgb *= occ;
#else #else
outColor.rgb *= occlusion; fragColor.rgb *= occlusion;
#endif #endif
// LTC // LTC
// outColor.rgb = ltccol * 10.0 * visibility + indirect / 14.0; // fragColor.rgb = ltccol * 10.0 * visibility + indirect / 14.0;
#ifdef _LDR #ifdef _LDR
outColor.rgb = vec3(pow(outColor.rgb, vec3(1.0 / 2.2))); fragColor.rgb = vec3(pow(fragColor.rgb, vec3(1.0 / 2.2)));
// #else // #else
// outColor = vec4(outColor.rgb, outColor.a); // fragColor = vec4(fragColor.rgb, fragColor.a);
#endif #endif
} }

View file

@ -9,7 +9,7 @@ precision mediump float;
#endif #endif
// in vec4 position; // in vec4 position;
out vec4 outColor; out vec4 fragColor;
void main() { void main() {
@ -18,7 +18,7 @@ void main() {
// gl_FragDepth = depth; // gl_FragDepth = depth;
// gl_FragColor = vec4(depth, 0.0, 0.0, 1.0); // gl_FragColor = vec4(depth, 0.0, 0.0, 1.0);
outColor = vec4(0.0, 0.0, 0.0, 1.0); fragColor = vec4(0.0, 0.0, 0.0, 1.0);
// VSM // VSM
// float dx = dFdx(depth); // float dx = dFdx(depth);

View file

@ -8,8 +8,8 @@ precision mediump float;
#define _BaseTex #define _BaseTex
#endif #endif
out vec4 outColor; out vec4 fragColor;
void main() { void main() {
outColor = vec4(0.0, 0.0, 0.0, 1.0); fragColor = vec4(0.0, 0.0, 0.0, 1.0);
} }

View file

@ -64,7 +64,7 @@ in vec3 eyeDir;
#else #else
in vec3 normal; in vec3 normal;
#endif #endif
out vec4[2] outColor; out vec4[2] fragColor;
vec3 shIrradiance(vec3 nor, float scale) { vec3 shIrradiance(vec3 nor, float scale) {
const float c1 = 0.429043; const float c1 = 0.429043;
@ -200,6 +200,10 @@ void main() {
roughness *= roughnessStrength; roughness *= roughnessStrength;
#endif #endif
#ifdef _OccTex
float occlusion = texture(socclusion, texCoord).r;
#endif
// Direct // Direct
vec3 direct = diffuseBRDF(albedo, roughness, dotNV, dotNL, dotVH, dotLV) + specularBRDF(f0, roughness, dotNL, dotNH, dotNV, dotVH, dotLH); vec3 direct = diffuseBRDF(albedo, roughness, dotNV, dotNL, dotVH, dotLV) + specularBRDF(f0, roughness, dotNL, dotNH, dotNV, dotVH, dotLH);
@ -248,6 +252,6 @@ void main() {
// revealage = premultipliedReflect.a; // revealage = premultipliedReflect.a;
// RT0 = vec4(C * w, a) // RT0 = vec4(C * w, a)
// RT1 = vec4(vec3(a * w), 1) // RT1 = vec4(vec3(a * w), 1)
outColor[0] = vec4(premultipliedReflect.rgb * w, premultipliedReflect.a); fragColor[0] = vec4(premultipliedReflect.rgb * w, premultipliedReflect.a);
outColor[1] = vec4(premultipliedReflect.a * w, 0.0, 0.0, 1.0); fragColor[1] = vec4(premultipliedReflect.a * w, 0.0, 0.0, 1.0);
} }

View file

@ -35,7 +35,7 @@ in vec2 texCoord;
#ifdef _Rad #ifdef _Rad
in vec3 viewRay; in vec3 viewRay;
#endif #endif
out vec4 outColor; out vec4 fragColor;
#ifdef _Rad #ifdef _Rad
float getMipLevelFromRoughness(float roughness) { float getMipLevelFromRoughness(float roughness) {
@ -233,5 +233,5 @@ void main() {
indirect *= texture(ssaotex, texCoord).r; // SSAO indirect *= texture(ssaotex, texCoord).r; // SSAO
#endif #endif
outColor.rgb = indirect; fragColor.rgb = indirect;
} }

View file

@ -96,7 +96,7 @@ uniform vec3 eye;
// in vec2 texCoord; // in vec2 texCoord;
in vec4 wvpposition; in vec4 wvpposition;
// in vec3 viewRay; // in vec3 viewRay;
out vec4 outColor; out vec4 fragColor;
// Separable SSS Transmittance Function, ref to sss_pass // Separable SSS Transmittance Function, ref to sss_pass
#ifdef _SSS #ifdef _SSS
@ -795,7 +795,7 @@ void main() {
#endif #endif
// Direct // Direct
outColor = vec4(vec3(direct * visibility), 1.0); fragColor = vec4(vec3(direct * visibility), 1.0);
// Voxels test.. // Voxels test..
#ifdef _VoxelGI #ifdef _VoxelGI
@ -828,13 +828,13 @@ void main() {
vec3 indirect1 = indirectDiffusea * diffOcclusion + indirectSpecular; vec3 indirect1 = indirectDiffusea * diffOcclusion + indirectSpecular;
indirect1 *= texture(ssaotex, texCoord).r; indirect1 *= texture(ssaotex, texCoord).r;
outColor.rgb += indirect1; fragColor.rgb += indirect1;
#endif #endif
// LTC // LTC
// float sinval = (sin(time) * 0.5 + 0.5); // float sinval = (sin(time) * 0.5 + 0.5);
// vec4 outColor = vec4(1.0); // vec4 fragColor = vec4(1.0);
// float rectSizeX = 4.000 + sin(time) * 4.0; // float rectSizeX = 4.000 + sin(time) * 4.0;
// float rectSizeY = 1.2;// + sin(time * 2.0); // float rectSizeY = 1.2;// + sin(time * 2.0);
// vec3 ex = vec3(1, 0, 0)*rectSizeX; // vec3 ex = vec3(1, 0, 0)*rectSizeX;
@ -861,10 +861,10 @@ void main() {
// ltcdiff *= vec3(1.0, 1.0 - sinval, 1.0 - sinval); // ltcdiff *= vec3(1.0, 1.0 - sinval, 1.0 - sinval);
// vec3 ltccol = ltcspec + ltcdiff * albedo; // vec3 ltccol = ltcspec + ltcdiff * albedo;
// ltccol /= 2.0*PI; // ltccol /= 2.0*PI;
// outColor.rgb = ltccol * 5.0 * visibility + (indirect / 14.0 * ao * (rectSizeX / 6.0) ); // fragColor.rgb = ltccol * 5.0 * visibility + (indirect / 14.0 * ao * (rectSizeX / 6.0) );
// // outColor.rgb = ltccol * visibility + (indirect / 2.0 * ao); // // fragColor.rgb = ltccol * visibility + (indirect / 2.0 * ao);
// outColor = vec4(pow(outColor.rgb, vec3(1.0 / 2.2)), outColor.a); // fragColor = vec4(pow(fragColor.rgb, vec3(1.0 / 2.2)), fragColor.a);
// outputColor = vec4(outColor.rgb, outColor.a); // outputColor = vec4(fragColor.rgb, fragColor.a);
//gl_FragColor = vec4(outColor.rgb, outColor.a); //gl_FragColor = vec4(fragColor.rgb, fragColor.a);
} }

View file

@ -38,7 +38,7 @@ uniform float envmapStrength; // From world material
// in vec2 texCoord; // in vec2 texCoord;
in vec3 normal; in vec3 normal;
out vec4 outColor; out vec4 fragColor;
#ifdef _EnvSky #ifdef _EnvSky
vec3 hosekWilkie(float cos_theta, float gamma, float cos_gamma) { vec3 hosekWilkie(float cos_theta, float gamma, float cos_gamma) {
@ -223,5 +223,5 @@ void main() {
R = pow(R, vec3(1.0 / 2.2)); R = pow(R, vec3(1.0 / 2.2));
#endif #endif
outColor = vec4(R, 1.0); fragColor = vec4(R, 1.0);
} }

View file

@ -116,7 +116,7 @@ in vec3 eyeDir;
#else #else
in vec3 normal; in vec3 normal;
#endif #endif
out vec4 outColor; out vec4 fragColor;
#ifndef _NoShadows #ifndef _NoShadows
#ifndef _PCSS #ifndef _PCSS
@ -859,9 +859,9 @@ void main() {
// sf = step(0.5, sf); // sf = step(0.5, sf);
// } // }
// outColor.rgb = ambientMaterial + (df * diffuseMaterial + sf * specularMaterial) * visibility; // fragColor.rgb = ambientMaterial + (df * diffuseMaterial + sf * specularMaterial) * visibility;
// float edgeDetection = (dot(v, n) < 0.1) ? 0.0 : 1.0; // float edgeDetection = (dot(v, n) < 0.1) ? 0.0 : 1.0;
// outColor.rgb *= edgeDetection; // fragColor.rgb *= edgeDetection;
// // const int levels = 4; // // const int levels = 4;
// // const float scaleFactor = 1.0 / levels; // // const float scaleFactor = 1.0 / levels;
@ -879,7 +879,7 @@ void main() {
// // float specMask = (pow(dot(h, n), shininess) > 0.4) ? 1.0 : 0.0; // // float specMask = (pow(dot(h, n), shininess) > 0.4) ? 1.0 : 0.0;
// // float edgeDetection = (dot(v, n) > 0.3) ? 1.0 : 0.0; // // float edgeDetection = (dot(v, n) > 0.3) ? 1.0 : 0.0;
// // outColor.rgb = edgeDetection * ((diffuseColor + specular * specMask) * visibility + ambientMaterial); // // fragColor.rgb = edgeDetection * ((diffuseColor + specular * specMask) * visibility + ambientMaterial);
// #endif // #endif
@ -979,26 +979,26 @@ void main() {
#endif #endif
outColor = vec4(vec3(direct * visibility + indirect), 1.0); fragColor = vec4(vec3(direct * visibility + indirect), 1.0);
#ifdef _OccTex #ifdef _OccTex
vec3 occ = texture(socclusion, texCoord).rgb; vec3 occ = texture(socclusion, texCoord).rgb;
outColor.rgb *= occ; fragColor.rgb *= occ;
#else #else
outColor.rgb *= occlusion; fragColor.rgb *= occlusion;
#endif #endif
// LTC // LTC
// outColor.rgb = ltccol * 10.0 * visibility + indirect / 14.0; // fragColor.rgb = ltccol * 10.0 * visibility + indirect / 14.0;
#ifdef _LDR #ifdef _LDR
// gl_FragColor = vec4(pow(outColor.rgb, vec3(1.0 / 2.2)), outColor.a); // gl_FragColor = vec4(pow(fragColor.rgb, vec3(1.0 / 2.2)), fragColor.a);
outColor = vec4(pow(outColor.rgb, vec3(1.0 / 2.2)), outColor.a); fragColor = vec4(pow(fragColor.rgb, vec3(1.0 / 2.2)), fragColor.a);
// #else // #else
// gl_FragColor = vec4(outColor.rgb, outColor.a); // gl_FragColor = vec4(fragColor.rgb, fragColor.a);
//outColor = vec4(outColor.rgb, outColor.a); //fragColor = vec4(fragColor.rgb, fragColor.a);
#endif #endif
} }

View file

@ -89,7 +89,7 @@ in vec3 eyeDir;
#else #else
in vec3 normal; in vec3 normal;
#endif #endif
out vec4 outColor; out vec4 fragColor;
#ifndef _NoShadows #ifndef _NoShadows
// float linstep(float low, float high, float v) { // float linstep(float low, float high, float v) {
@ -605,9 +605,9 @@ void main() {
sf = step(0.5, sf); sf = step(0.5, sf);
} }
outColor.rgb = ambientMaterial + (df * diffuseMaterial + sf * specularMaterial) * visibility; fragColor.rgb = ambientMaterial + (df * diffuseMaterial + sf * specularMaterial) * visibility;
float edgeDetection = (dot(v, n) < 0.1) ? 0.0 : 1.0; float edgeDetection = (dot(v, n) < 0.1) ? 0.0 : 1.0;
outColor.rgb *= edgeDetection; fragColor.rgb *= edgeDetection;
// const int levels = 4; // const int levels = 4;
// const float scaleFactor = 1.0 / levels; // const float scaleFactor = 1.0 / levels;
@ -625,7 +625,7 @@ void main() {
// float specMask = (pow(dot(h, n), shininess) > 0.4) ? 1.0 : 0.0; // float specMask = (pow(dot(h, n), shininess) > 0.4) ? 1.0 : 0.0;
// float edgeDetection = (dot(v, n) > 0.3) ? 1.0 : 0.0; // float edgeDetection = (dot(v, n) > 0.3) ? 1.0 : 0.0;
// outColor.rgb = edgeDetection * ((diffuseColor + specular * specMask) * visibility + ambientMaterial); // fragColor.rgb = edgeDetection * ((diffuseColor + specular * specMask) * visibility + ambientMaterial);
#endif #endif
@ -681,20 +681,20 @@ void main() {
indirect += indirectSpecular; indirect += indirectSpecular;
#endif #endif
indirect = indirect * lightColor * lightStrength * envmapStrength; indirect = indirect * lightColor * lightStrength * envmapStrength;
outColor = vec4(vec3(direct * visibility + indirect), 1.0); fragColor = vec4(vec3(direct * visibility + indirect), 1.0);
#ifdef _OccTex #ifdef _OccTex
vec3 occ = texture(socclusion, texCoord).rgb; vec3 occ = texture(socclusion, texCoord).rgb;
outColor.rgb *= occ; fragColor.rgb *= occ;
#else #else
outColor.rgb *= occlusion; fragColor.rgb *= occlusion;
#endif #endif
// LTC // LTC
// outColor.rgb = ltccol * 10.0 * visibility + indirect / 14.0; // fragColor.rgb = ltccol * 10.0 * visibility + indirect / 14.0;
#ifdef _LDR #ifdef _LDR
outColor.rgb = vec3(pow(outColor.rgb, vec3(1.0 / 2.2))); fragColor.rgb = vec3(pow(fragColor.rgb, vec3(1.0 / 2.2)));
// #else // #else
// outColor = vec4(outColor.rgb, outColor.a); // fragColor = vec4(fragColor.rgb, fragColor.a);
#endif #endif
} }

View file

@ -9,7 +9,7 @@ precision mediump float;
#endif #endif
// in vec4 position; // in vec4 position;
out vec4 outColor; out vec4 fragColor;
void main() { void main() {
@ -18,7 +18,7 @@ void main() {
// gl_FragDepth = depth; // gl_FragDepth = depth;
// gl_FragColor = vec4(depth, 0.0, 0.0, 1.0); // gl_FragColor = vec4(depth, 0.0, 0.0, 1.0);
outColor = vec4(0.0, 0.0, 0.0, 1.0); fragColor = vec4(0.0, 0.0, 0.0, 1.0);
// VSM // VSM
// float dx = dFdx(depth); // float dx = dFdx(depth);

View file

@ -8,7 +8,7 @@ uniform sampler2D tex;
uniform vec2 texStep; // screenSizeInv uniform vec2 texStep; // screenSizeInv
in vec2 texCoord; in vec2 texCoord;
out vec4 outColor; out vec4 fragColor;
void main() { void main() {
const float FXAA_REDUCE_MIN = 1.0 / 128.0; const float FXAA_REDUCE_MIN = 1.0 / 128.0;
@ -56,6 +56,6 @@ void main() {
texture(tex, texCoord + dir * 0.5).rgb); texture(tex, texCoord + dir * 0.5).rgb);
float lumaB = dot(rgbB, luma); float lumaB = dot(rgbB, luma);
if ((lumaB < lumaMin) || (lumaB > lumaMax)) outColor = vec4(rgbA, texColor.a); if ((lumaB < lumaMin) || (lumaB > lumaMax)) fragColor = vec4(rgbA, texColor.a);
else outColor = vec4(rgbB, texColor.a); else fragColor = vec4(rgbB, texColor.a);
} }

View file

@ -6,8 +6,8 @@ precision mediump float;
in vec4 color; in vec4 color;
out vec4 outColor; out vec4 fragColor;
void main() { void main() {
outColor = color; fragColor = color;
} }

View file

@ -4,8 +4,8 @@
precision mediump float; precision mediump float;
#endif #endif
out vec4 outColor; out vec4 fragColor;
void main() { void main() {
outColor = vec4(0.0, 0.0, 0.0, 1.0); fragColor = vec4(0.0, 0.0, 0.0, 1.0);
} }

View file

@ -4,8 +4,8 @@
precision mediump float; precision mediump float;
#endif #endif
out vec4 outColor; out vec4 fragColor;
void main() { void main() {
outColor = vec4(0.0, 0.0, 0.0, 1.0); fragColor = vec4(0.0, 0.0, 0.0, 1.0);
} }

View file

@ -78,7 +78,7 @@ in vec3 eyeDir;
#else #else
in vec3 normal; in vec3 normal;
#endif #endif
out vec4[2] outColor; out vec4[2] fragColor;
#ifndef _NoShadows #ifndef _NoShadows
#ifndef _PCSS #ifndef _PCSS
@ -597,12 +597,12 @@ void main() {
#ifdef _LDR #ifdef _LDR
outputColor.rgb = tonemapUncharted2(outputColor.rgb); outputColor.rgb = tonemapUncharted2(outputColor.rgb);
outColor[0] = vec4(pow(outputColor.rgb, vec3(1.0 / 2.2)), visibility); fragColor[0] = vec4(pow(outputColor.rgb, vec3(1.0 / 2.2)), visibility);
#else #else
outColor[0] = vec4(outputColor.rgb, visibility); fragColor[0] = vec4(outputColor.rgb, visibility);
#endif #endif
n /= (abs(n.x) + abs(n.y) + abs(n.z)); n /= (abs(n.x) + abs(n.y) + abs(n.z));
n.xy = n.z >= 0.0 ? n.xy : octahedronWrap(n.xy); n.xy = n.z >= 0.0 ? n.xy : octahedronWrap(n.xy);
outColor[1] = vec4(n.xy, packFloat(metalness, roughness), 0.0); fragColor[1] = vec4(n.xy, packFloat(metalness, roughness), 0.0);
} }

View file

@ -61,7 +61,7 @@ in vec3 eyeDir;
#else #else
in vec3 normal; in vec3 normal;
#endif #endif
out vec4 outColor; out vec4 fragColor;
#ifndef _NoShadows #ifndef _NoShadows
float texture2DCompare(vec2 uv, float compare) { float texture2DCompare(vec2 uv, float compare) {
@ -320,18 +320,18 @@ void main() {
indirect += indirectSpecular; indirect += indirectSpecular;
#endif #endif
indirect = indirect * lightColor * lightStrength * envmapStrength; indirect = indirect * lightColor * lightStrength * envmapStrength;
outColor = vec4(vec3(direct * visibility + indirect), 1.0); fragColor = vec4(vec3(direct * visibility + indirect), 1.0);
#ifdef _OccTex #ifdef _OccTex
vec3 occ = texture(socclusion, texCoord).rgb; vec3 occ = texture(socclusion, texCoord).rgb;
outColor.rgb *= occ; fragColor.rgb *= occ;
#else #else
outColor.rgb *= occlusion; fragColor.rgb *= occlusion;
#endif #endif
#ifdef _LDR #ifdef _LDR
outColor.rgb = vec3(pow(outColor.rgb, vec3(1.0 / 2.2))); fragColor.rgb = vec3(pow(fragColor.rgb, vec3(1.0 / 2.2)));
// #else // #else
// outColor = vec4(outColor.rgb, outColor.a); // fragColor = vec4(fragColor.rgb, fragColor.a);
#endif #endif
} }

View file

@ -4,8 +4,8 @@
precision mediump float; precision mediump float;
#endif #endif
out vec4 outColor; out vec4 fragColor;
void main() { void main() {
outColor = vec4(0.0, 0.0, 0.0, 1.0); fragColor = vec4(0.0, 0.0, 0.0, 1.0);
} }

View file

@ -10,7 +10,7 @@ uniform sampler2D tex;
uniform sampler2D gbufferD; uniform sampler2D gbufferD;
in vec2 texCoord; in vec2 texCoord;
out vec4 outColor; out vec4 fragColor;
void main() { void main() {
const float decay = 0.96815; const float decay = 0.96815;
@ -30,5 +30,5 @@ void main() {
color *= illuminationDecay * weight; color *= illuminationDecay * weight;
illuminationDecay *= decay; illuminationDecay *= decay;
} }
outColor = color; fragColor = color;
} }

View file

@ -18,7 +18,7 @@ uniform vec3 eyeLook;
in vec2 texCoord; in vec2 texCoord;
in vec3 viewRay; in vec3 viewRay;
out vec4 outColor; out vec4 fragColor;
// const float motionBlurIntensity = 1.0; // const float motionBlurIntensity = 1.0;
// const int samples = 8; // const int samples = 8;
@ -47,13 +47,13 @@ void main() {
// Do not blur masked objects // Do not blur masked objects
if (texture(gbuffer0, texCoord).a == 1.0) { if (texture(gbuffer0, texCoord).a == 1.0) {
outColor = color; fragColor = color;
return; return;
} }
float depth = texture(gbufferD, texCoord).r * 2.0 - 1.0; float depth = texture(gbufferD, texCoord).r * 2.0 - 1.0;
if (depth == 1.0) { if (depth == 1.0) {
outColor = color; fragColor = color;
return; return;
} }
@ -114,5 +114,5 @@ void main() {
// } // }
vec4 finalColor = color / processed; vec4 finalColor = color / processed;
outColor = finalColor; fragColor = finalColor;
} }

View file

@ -15,7 +15,7 @@ uniform sampler2D tex;
// uniform vec2 texStep; // uniform vec2 texStep;
in vec2 texCoord; in vec2 texCoord;
out vec4 outColor; out vec4 fragColor;
void main() { void main() {
vec2 velocity = texture(sveloc, texCoord).rg; vec2 velocity = texture(sveloc, texCoord).rg;
@ -25,7 +25,7 @@ void main() {
// Do not blur masked objects // Do not blur masked objects
if (texture(gbuffer0, texCoord).a == 1.0) { if (texture(gbuffer0, texCoord).a == 1.0) {
outColor = col; fragColor = col;
return; return;
} }
@ -55,5 +55,5 @@ void main() {
// } // }
col /= float(samples + 1); col /= float(samples + 1);
outColor = col; fragColor = col;
} }

View file

@ -7,9 +7,9 @@ precision mediump float;
uniform sampler2D gbuffer; uniform sampler2D gbuffer;
in vec2 texCoord; in vec2 texCoord;
out vec4 outColor; out vec4 fragColor;
void main() { void main() {
vec3 col = texture(gbuffer, texCoord).rgb; vec3 col = texture(gbuffer, texCoord).rgb;
outColor = vec4(col, 1.0); fragColor = vec4(col, 1.0);
} }

View file

@ -5,7 +5,7 @@ precision mediump float;
#endif #endif
in vec3 initialRay; in vec3 initialRay;
in vec2 texCoord; in vec2 texCoord;
out vec4 outColor; out vec4 fragColor;
uniform vec3 eye; uniform vec3 eye;
//uniform float textureWeight; //uniform float textureWeight;
uniform float timeSinceStart; uniform float timeSinceStart;
@ -192,6 +192,6 @@ time += 0.35;
//} //}
outColor = vec4(vec3(col / samples), 1.0); fragColor = vec4(vec3(col / samples), 1.0);
outColor.rgb = pow(outColor.rgb * 0.7, vec3(1.0 / 2.2)); fragColor.rgb = pow(fragColor.rgb * 0.7, vec3(1.0 / 2.2));
} }

View file

@ -37,7 +37,7 @@ in vec2 pixcoord;
in vec4 offset0; in vec4 offset0;
in vec4 offset1; in vec4 offset1;
in vec4 offset2; in vec4 offset2;
out vec4 outColor; out vec4 fragColor;
// Blending Weight Calculation Pixel Shader (Second Pass) // Blending Weight Calculation Pixel Shader (Second Pass)
vec2 cdw_end; vec2 cdw_end;
@ -727,6 +727,6 @@ vec4 SMAABlendingWeightCalculationPS(vec2 texcoord, vec2 pixcoord, /*vec4 offset
} }
void main() { void main() {
outColor = SMAABlendingWeightCalculationPS(texCoord, pixcoord, /*offset,*/ fragColor = SMAABlendingWeightCalculationPS(texCoord, pixcoord, /*offset,*/
/*edgesTex, areaTex, searchTex,*/ vec4(0.0)); /*edgesTex, areaTex, searchTex,*/ vec4(0.0));
} }

View file

@ -56,7 +56,7 @@ in vec2 texCoord;
in vec4 offset0; in vec4 offset0;
in vec4 offset1; in vec4 offset1;
in vec4 offset2; in vec4 offset2;
out vec4 outColor; out vec4 fragColor;
// Misc functions // Misc functions
// Gathers current pixel, and the top-left neighbors. // Gathers current pixel, and the top-left neighbors.
@ -208,6 +208,6 @@ vec2 SMAAColorEdgeDetectionPS(vec2 texcoord/*, vec4 offset[3], sampler2D colorTe
// } // }
void main() { void main() {
// outColor.rg = SMAALumaEdgeDetectionPS(texCoord/*, offset, colorTex*/); // fragColor.rg = SMAALumaEdgeDetectionPS(texCoord/*, offset, colorTex*/);
outColor.rg = SMAAColorEdgeDetectionPS(texCoord/*, offset, colorTex*/); fragColor.rg = SMAAColorEdgeDetectionPS(texCoord/*, offset, colorTex*/);
} }

View file

@ -14,7 +14,7 @@ uniform vec2 screenSizeInv;
in vec2 texCoord; in vec2 texCoord;
in vec4 offset; in vec4 offset;
out vec4 outColor; out vec4 fragColor;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Neighborhood Blending Pixel Shader (Third Pass) // Neighborhood Blending Pixel Shader (Third Pass)
@ -97,5 +97,5 @@ vec4 SMAANeighborhoodBlendingPS(vec2 texcoord, vec4 offset/*, sampler2D colorTex
} }
void main() { void main() {
outColor = SMAANeighborhoodBlendingPS(texCoord, offset/*, colorTex, blendTex*/); fragColor = SMAANeighborhoodBlendingPS(texCoord, offset/*, colorTex, blendTex*/);
} }

View file

@ -36,7 +36,7 @@ uniform vec2 aspectRatio;
in vec2 texCoord; in vec2 texCoord;
// in vec3 viewRay; // in vec3 viewRay;
out vec4 outColor; out vec4 fragColor;
// float rand(vec2 co) { // Unreliable // float rand(vec2 co) { // Unreliable
// return fract(sin(dot(co.xy ,vec2(12.9898, 78.233))) * 43758.5453); // return fract(sin(dot(co.xy ,vec2(12.9898, 78.233))) * 43758.5453);
@ -82,7 +82,7 @@ float doAO(vec2 kernelVec, vec2 randomVec, mat2 rotMat, vec3 currentPos, vec3 cu
void main() { void main() {
float depth = texture(gbufferD, texCoord).r * 2.0 - 1.0; float depth = texture(gbufferD, texCoord).r * 2.0 - 1.0;
if (depth == 1.0) { if (depth == 1.0) {
outColor = vec4(1.0); fragColor = vec4(1.0);
return; return;
} }
@ -160,5 +160,5 @@ void main() {
amount *= ssaoStrength / kernelSize; amount *= ssaoStrength / kernelSize;
amount = 1.0 - amount; amount = 1.0 - amount;
amount = max(0.0, amount); amount = max(0.0, amount);
outColor = vec4(amount, 0.0, 0.0, 1.0); fragColor = vec4(amount, 0.0, 0.0, 1.0);
} }

View file

@ -38,7 +38,7 @@ uniform vec2 aspectRatio;
in vec2 texCoord; in vec2 texCoord;
in vec3 viewRay; in vec3 viewRay;
out vec4 outColor; out vec4 fragColor;
// float rand(vec2 co) { // Unreliable // float rand(vec2 co) { // Unreliable
// return fract(sin(dot(co.xy ,vec2(12.9898, 78.233))) * 43758.5453); // return fract(sin(dot(co.xy ,vec2(12.9898, 78.233))) * 43758.5453);
@ -84,7 +84,7 @@ float doAO(vec2 kernelVec, vec2 randomVec, mat2 rotMat, vec3 currentPos, vec3 cu
void main() { void main() {
float depth = texture(gbufferD, texCoord).r * 2.0 - 1.0; float depth = texture(gbufferD, texCoord).r * 2.0 - 1.0;
if (depth == 1.0) { if (depth == 1.0) {
outColor = vec4(1.0); fragColor = vec4(1.0);
return; return;
} }
@ -162,10 +162,10 @@ void main() {
amount *= ssaoStrength / kernelSize; amount *= ssaoStrength / kernelSize;
amount = 1.0 - amount; amount = 1.0 - amount;
amount = max(0.0, amount); amount = max(0.0, amount);
// outColor = vec4(amount, 0.0, 0.0, 1.0); // fragColor = vec4(amount, 0.0, 0.0, 1.0);
// Velocity is assumed to be calculated for motion blur, so we need to inverse it for reprojection // Velocity is assumed to be calculated for motion blur, so we need to inverse it for reprojection
vec2 velocity = -textureLod(sveloc, texCoord, 0.0).rg; vec2 velocity = -textureLod(sveloc, texCoord, 0.0).rg;
float last = texture(slast, texCoord + velocity).r; float last = texture(slast, texCoord + velocity).r;
outColor = vec4((amount + last) * 0.5, 0.0, 0.0, 1.0); fragColor = vec4((amount + last) * 0.5, 0.0, 0.0, 1.0);
} }

View file

@ -27,7 +27,7 @@ const vec3 sh2_weight_l1 = vec3(fudge_factor_l1 * 0.48860); //0.5*sqrt(3.0/pi);
const vec4 sh2_weight = vec4(sh2_weight_l1, sh2_weight_l0) / num_samples; const vec4 sh2_weight = vec4(sh2_weight_l1, sh2_weight_l0) / num_samples;
in vec2 texCoord; in vec2 texCoord;
out vec4 outColor; out vec4 fragColor;
vec2 octahedronWrap(vec2 v) { vec2 octahedronWrap(vec2 v) {
return (1.0 - abs(v.yx)) * (vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0)); return (1.0 - abs(v.yx)) * (vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0));
@ -65,7 +65,7 @@ void main() {
float depth = texture(gbufferD, texCoord).r * 2.0 - 1.0; float depth = texture(gbufferD, texCoord).r * 2.0 - 1.0;
// if (depth == 0.0) { // if (depth == 0.0) {
if (depth == 1.0) { if (depth == 1.0) {
outColor = vec4(1.0); fragColor = vec4(1.0);
return; return;
} }
@ -161,5 +161,5 @@ void main() {
occlusion_sh2 += doDO(points[31], noise, radius, center_pos, max_distance_inv, center_normal); occlusion_sh2 += doDO(points[31], noise, radius, center_pos, max_distance_inv, center_normal);
// } // }
outColor = vec4(vec3(1.0 - occlusion_sh2.rgb), 1.0); fragColor = vec4(vec3(1.0 - occlusion_sh2.rgb), 1.0);
} }

View file

@ -22,7 +22,7 @@ uniform mat4 tiV;
in vec3 viewRay; in vec3 viewRay;
in vec2 texCoord; in vec2 texCoord;
out vec4 outColor; out vec4 fragColor;
vec3 hitCoord; vec3 hitCoord;
float depth; float depth;
@ -190,14 +190,14 @@ void main() {
float roughness = unpackFloat(g0.b).y; float roughness = unpackFloat(g0.b).y;
if (roughness == 1.0) { if (roughness == 1.0) {
outColor = vec4(0.0); fragColor = vec4(0.0);
return; return;
} }
float reflectivity = 1.0 - roughness; float reflectivity = 1.0 - roughness;
float d = texture(gbufferD, texCoord).r * 2.0 - 1.0; float d = texture(gbufferD, texCoord).r * 2.0 - 1.0;
if (d == 1.0) { if (d == 1.0) {
outColor = vec4(0.0); fragColor = vec4(0.0);
return; return;
} }
@ -209,8 +209,8 @@ void main() {
vec4 viewNormal = vec4(n, 1.0); vec4 viewNormal = vec4(n, 1.0);
// if (viewNormal.z <= 0.9) { // if (viewNormal.z <= 0.9) {
// outColor = texture(tex, texCoord); // fragColor = texture(tex, texCoord);
// outColor = vec4(0.0); // fragColor = vec4(0.0);
// return; // return;
// discard; // Only up facing surfaces for now // discard; // Only up facing surfaces for now
// } // }
@ -236,12 +236,12 @@ void main() {
intensity = clamp(intensity, 0.0, 1.0); intensity = clamp(intensity, 0.0, 1.0);
if (intensity == 0.0) { if (intensity == 0.0) {
outColor = vec4(0.0); fragColor = vec4(0.0);
return; return;
} }
vec4 reflCol = vec4(texture(tex, coords.xy).rgb, 1.0); vec4 reflCol = vec4(texture(tex, coords.xy).rgb, 1.0);
reflCol = clamp(reflCol, 0.0, 1.0); reflCol = clamp(reflCol, 0.0, 1.0);
// outColor = texColor * (1.0 - intensity) + reflCol * intensity; // fragColor = texColor * (1.0 - intensity) + reflCol * intensity;
outColor = reflCol * intensity; // fragColor = reflCol * intensity; //
} }

View file

@ -50,7 +50,7 @@ uniform sampler2D tex;
uniform vec2 dir; uniform vec2 dir;
in vec2 texCoord; in vec2 texCoord;
out vec4 outColor; out vec4 fragColor;
const float SSSS_FOVY = 45.0; const float SSSS_FOVY = 45.0;
@ -157,9 +157,9 @@ vec4 SSSSBlur(float sssWidth) {
void main() { void main() {
// SSS only masked objects // SSS only masked objects
if (texture(gbuffer0, texCoord).a == 2.0) { if (texture(gbuffer0, texCoord).a == 2.0) {
outColor = SSSSBlur(0.005); fragColor = SSSSBlur(0.005);
} }
else { else {
outColor = texture(tex, texCoord); fragColor = texture(tex, texCoord);
} }
} }

View file

@ -11,7 +11,7 @@ uniform sampler2D sveloc;
#endif #endif
in vec2 texCoord; in vec2 texCoord;
out vec4 outColor; out vec4 fragColor;
const float SMAA_REPROJECTION_WEIGHT_SCALE = 30.0; const float SMAA_REPROJECTION_WEIGHT_SCALE = 30.0;
@ -34,9 +34,9 @@ void main() {
float weight = 0.5 * clamp(1.0 - sqrt(delta) * SMAA_REPROJECTION_WEIGHT_SCALE, 0.0, 1.0); float weight = 0.5 * clamp(1.0 - sqrt(delta) * SMAA_REPROJECTION_WEIGHT_SCALE, 0.0, 1.0);
// Blend the pixels according to the calculated weight: // Blend the pixels according to the calculated weight:
outColor.rgb = mix(current.rgb, previous.rgb, weight); fragColor.rgb = mix(current.rgb, previous.rgb, weight);
#else #else
vec4 previous = texture(tex2, texCoord); vec4 previous = texture(tex2, texCoord);
outColor = mix(current.rgb, previous.rgb, 0.5); fragColor = mix(current.rgb, previous.rgb, 0.5);
#endif #endif
} }

View file

@ -10,7 +10,7 @@ uniform sampler2D gbuffer0; // saccum
uniform sampler2D gbuffer1; // srevealage uniform sampler2D gbuffer1; // srevealage
in vec2 texCoord; in vec2 texCoord;
out vec4 outColor; out vec4 fragColor;
void main() { void main() {
vec4 accum = texture(gbuffer0, texCoord); vec4 accum = texture(gbuffer0, texCoord);
@ -24,8 +24,8 @@ void main() {
float accumA = texture(gbuffer1, texCoord).r; float accumA = texture(gbuffer1, texCoord).r;
// accum.a = texture(gbuffer1, texCoord).r; // accum.a = texture(gbuffer1, texCoord).r;
// outColor = vec4(accum.rgb / clamp(accum.a, 1e-4, 5e4), revealage); // fragColor = vec4(accum.rgb / clamp(accum.a, 1e-4, 5e4), revealage);
const float epsilon = 0.00001; const float epsilon = 0.00001;
outColor = vec4(accum.rgb / max(accumA, epsilon), 1.0 - revealage); fragColor = vec4(accum.rgb / max(accumA, epsilon), 1.0 - revealage);
} }

Some files were not shown because too many files have changed in this diff Show more