port from perforce

This commit is contained in:
2026-04-18 22:31:51 +02:00
commit 8d0ab5b7cc
8409 changed files with 3972376 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,22 @@
// some useful song defines for 4klang
#define SAMPLE_RATE 44100
#define BPM 137.126862
#define MAX_INSTRUMENTS 9
#define MAX_PATTERNS 132
#define PATTERN_SIZE_SHIFT 3
#define PATTERN_SIZE (1 << PATTERN_SIZE_SHIFT)
#define MAX_TICKS (MAX_PATTERNS*PATTERN_SIZE)
#define SAMPLES_PER_TICK 4824
#define MAX_SAMPLES (SAMPLES_PER_TICK*MAX_TICKS)
#define POLYPHONY 1
#define FLOAT_32BIT
#define SAMPLE_TYPE float
#define WINDOWS_OBJECT
// declaration of the external synth render function, you'll always need that
extern "C" void __stdcall _4klang_render(void*);
// declaration of the external envelope buffer. access only if you're song was exported with that option
extern "C" float _4klang_envelope_buffer;
// declaration of the external note buffer. access only if you're song was exported with that option
extern "C" int _4klang_note_buffer;

View File

@@ -0,0 +1,850 @@
%macro export_func 1
global _%1
_%1:
%endmacro
%define USE_SECTIONS
%define SAMPLE_RATE 44100
%define MAX_INSTRUMENTS 9
%define MAX_VOICES 1
%define HLD 1
%define BPM 137.126862
%define MAX_PATTERNS 132
%define PATTERN_SIZE_SHIFT 3
%define PATTERN_SIZE (1 << PATTERN_SIZE_SHIFT)
%define MAX_TICKS (MAX_PATTERNS*PATTERN_SIZE)
%define SAMPLES_PER_TICK 4824
%define DEF_LFO_NORMALIZE 0.0000518242
%define MAX_SAMPLES (SAMPLES_PER_TICK*MAX_TICKS)
;%define GO4K_USE_16BIT_OUTPUT
;%define GO4K_USE_GROOVE_PATTERN
%define GO4K_USE_ENVELOPE_RECORDINGS
;%define GO4K_USE_NOTE_RECORDINGS
%define GO4K_CLIP_OUTPUT
%define GO4K_USE_DST
%define GO4K_USE_DLL
%define GO4K_USE_PAN
%define GO4K_USE_GLOBAL_DLL
%define GO4K_USE_FSTG
%define GO4K_USE_ENV_CHECK
%define GO4K_USE_ENV_MOD_GM
%define GO4K_USE_VCO_CHECK
%define GO4K_USE_VCO_PHASE_OFFSET
%define GO4K_USE_VCO_SHAPE
%define GO4K_USE_VCO_GATE
%define GO4K_USE_VCO_MOD_TM
%define GO4K_USE_VCO_MOD_DM
%define GO4K_USE_VCO_MOD_CM
%define GO4K_USE_VCF_CHECK
%define GO4K_USE_VCF_MOD_FM
%define GO4K_USE_VCF_MOD_RM
%define GO4K_USE_VCF_HIGH
%define GO4K_USE_VCF_BAND
%define GO4K_USE_VCF_PEAK
%define GO4K_USE_DST_CHECK
%define GO4K_USE_DLL_CHORUS
%define GO4K_USE_DLL_CHORUS_CLAMP
%define GO4K_USE_DLL_DAMP
%define GO4K_USE_DLL_DC_FILTER
%define GO4K_USE_FSTG_CHECK
%define GO4K_USE_WAVESHAPER_CLIP
%define MAX_DELAY 65536
%define MAX_WORKSPACE_SLOTS 8
%define GO4K_BEGIN_CMDDEF(def_name)
%define GO4K_END_CMDDEF db 0
%define GO4K_BEGIN_PARAMDEF(def_name)
%define GO4K_END_PARAMDEF
GO4K_ENV_ID equ 1
%macro GO4K_ENV 5
db %1
db %2
db %3
db %4
db %5
%endmacro
%define ATTAC(val) val
%define DECAY(val) val
%define SUSTAIN(val) val
%define RELEASE(val) val
%define GAIN(val) val
struc go4kENV_val
.attac resd 1
.decay resd 1
.sustain resd 1
.release resd 1
.gain resd 1
.size
endstruc
struc go4kENV_wrk
.state resd 1
.level resd 1
.gm resd 1
.am resd 1
.dm resd 1
.sm resd 1
.rm resd 1
.size
endstruc
%define ENV_STATE_ATTAC 0
%define ENV_STATE_DECAY 1
%define ENV_STATE_SUSTAIN 2
%define ENV_STATE_RELEASE 3
%define ENV_STATE_OFF 4
GO4K_VCO_ID equ 2
%macro GO4K_VCO 8
db %1
db %2
%ifdef GO4K_USE_VCO_PHASE_OFFSET
db %3
%endif
%ifdef GO4K_USE_VCO_GATE
db %4
%endif
db %5
%ifdef GO4K_USE_VCO_SHAPE
db %6
%endif
db %7
db %8
%endmacro
%define TRANSPOSE(val) val
%define DETUNE(val) val
%define PHASE(val) val
%define GATES(val) val
%define COLOR(val) val
%define SHAPE(val) val
%define FLAGS(val) val
%define SINE 0x01
%define TRISAW 0x02
%define PULSE 0x04
%define NOISE 0x08
%define LFO 0x10
%define GATE 0x20
struc go4kVCO_val
.transpose resd 1
.detune resd 1
%ifdef GO4K_USE_VCO_PHASE_OFFSET
.phaseofs resd 1
%endif
%ifdef GO4K_USE_VCO_GATE
.gate resd 1
%endif
.color resd 1
%ifdef GO4K_USE_VCO_SHAPE
.shape resd 1
%endif
.gain resd 1
.flags resd 1
.size
endstruc
struc go4kVCO_wrk
.phase resd 1
.tm resd 1
.dm resd 1
.fm resd 1
.pm resd 1
.cm resd 1
.sm resd 1
.gm resd 1
.size
endstruc
GO4K_VCF_ID equ 3
%macro GO4K_VCF 3
db %1
db %2
db %3
%endmacro
%define LOWPASS 0x1
%define HIGHPASS 0x2
%define BANDPASS 0x4
%define BANDSTOP 0x3
%define ALLPASS 0x7
%define PEAK 0x8
%define FREQUENCY(val) val
%define RESONANCE(val) val
%define VCFTYPE(val) val
struc go4kVCF_val
.freq resd 1
.res resd 1
.type resd 1
.size
endstruc
struc go4kVCF_wrk
.low resd 1
.high resd 1
.band resd 1
.freq resd 1
.fm resd 1
.rm resd 1
.size
endstruc
GO4K_DST_ID equ 4
%macro GO4K_DST 2
db %1
%ifdef GO4K_USE_DST_SH
db %2
%endif
%endmacro
%define DRIVE(val) val
%define SNHFREQ(val) val
struc go4kDST_val
.drive resd 1
%ifdef GO4K_USE_DST_SH
.snhfreq resd 1
%endif
.size
endstruc
struc go4kDST_wrk
%ifdef GO4K_USE_DST_SH
.out resd 1
.snhphase resd 1
%endif
.dm resd 1
.sm resd 1
.size
endstruc
GO4K_DLL_ID equ 5
%macro GO4K_DLL 8
db %1
db %2
db %3
%ifdef GO4K_USE_DLL_DAMP
db %4
%endif
%ifdef GO4K_USE_DLL_CHORUS
db %5
db %6
%endif
db %7
db %8
%endmacro
%define PREGAIN(val) val
%define DRY(val) val
%define FEEDBACK(val) val
%define DEPTH(val) val
%define DAMP(val) val
%define DELAY(val) val
%define COUNT(val) val
struc go4kDLL_val
.pregain resd 1
.dry resd 1
.feedback resd 1
%ifdef GO4K_USE_DLL_DAMP
.damp resd 1
%endif
%ifdef GO4K_USE_DLL_CHORUS
.freq resd 1
.depth
%endif
.delay resd 1
.count resd 1
.size
endstruc
struc go4kDLL_wrk
.index resd 1
.store resd 1
.dcin resd 1
.dcout resd 1
%ifdef GO4K_USE_DLL_CHORUS
.phase resd 1
%endif
.buffer resd MAX_DELAY
.size
endstruc
struc go4kDLL_wrk2
.pm resd 1
.fm resd 1
.im resd 1
.dm resd 1
.sm resd 1
.am resd 1
.size
endstruc
GO4K_FOP_ID equ 6
%macro GO4K_FOP 1
db %1
%endmacro
%define OP(val) val
%define FOP_POP 0x1
%define FOP_ADDP 0x2
%define FOP_MULP 0x3
%define FOP_PUSH 0x4
%define FOP_XCH 0x5
%define FOP_ADD 0x6
%define FOP_MUL 0x7
%define FOP_ADDP2 0x8
%define FOP_LOADNOTE 0x9
struc go4kFOP_val
.flags resd 1
.size
endstruc
struc go4kFOP_wrk
.size
endstruc
GO4K_FST_ID equ 7
%macro GO4K_FST 2
db %1
db %2
%endmacro
%define AMOUNT(val) val
%define DEST(val) val
struc go4kFST_val
.amount resd 1
.op1 resd 1
.size
endstruc
struc go4kFST_wrk
.size
endstruc
GO4K_PAN_ID equ 8
%macro GO4K_PAN 1
%ifdef GO4K_USE_PAN
db %1
%endif
%endmacro
%define PANNING(val) val
struc go4kPAN_val
%ifdef GO4K_USE_PAN
.panning resd 1
%endif
.size
endstruc
struc go4kPAN_wrk
.pm resd 1
.size
endstruc
GO4K_OUT_ID equ 9
%macro GO4K_OUT 2
db %1
%ifdef GO4K_USE_GLOBAL_DLL
db %2
%endif
%endmacro
%define AUXSEND(val) val
struc go4kOUT_val
.gain resd 1
%ifdef GO4K_USE_GLOBAL_DLL
.auxsend resd 1
%endif
.size
endstruc
struc go4kOUT_wrk
.am resd 1
.gm resd 1
.size
endstruc
GO4K_ACC_ID equ 10
%macro GO4K_ACC 1
db %1
%endmacro
%define OUTPUT 0
%define AUX 8
%define ACCTYPE(val) val
struc go4kACC_val
.acctype resd 1
.size
endstruc
struc go4kACC_wrk
.size
endstruc
%ifdef GO4K_USE_FLD
GO4K_FLD_ID equ 11
%macro GO4K_FLD 1
db
%endmacro
%define VALUE(val) val
struc go4kFLD_val
.value resd 1
.size
endstruc
struc go4kFLD_wrk
.vm resd 1
.size
endstruc
%endif
%ifdef GO4K_USE_FSTG
GO4K_FSTG_ID equ 12
%macro GO4K_FSTG 2
db %1
dd %2
%endmacro
struc go4kFSTG_val
.amount resd 1
.op1 resd 1
.size
endstruc
struc go4kFSTG_wrk
.size
endstruc
%endif
struc go4k_instrument
.release resd 1
.note resd 1
.workspace resd 256
.dlloutl resd 1
.dlloutr resd 1
.outl resd 1
.outr resd 1
.size
endstruc
struc go4k_synth
.instruments resb go4k_instrument.size * MAX_INSTRUMENTS * MAX_VOICES
.global resb go4k_instrument.size * MAX_VOICES
.size
endstruc
%ifdef USE_SECTIONS
section .g4kmuc1 data align=1
%else
section .data align=1
%endif
go4k_patterns
db 0, 0, 0, 0, 0, 0, 0, 0,
db 50, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 38, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 57, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 45, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 48, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 36, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 55, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 43, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 60, HLD, 0, 0, 60, HLD, 0, 0,
db 60, HLD, 0, 0, 0, 0, 0, 0,
db 0, 50, 62, 50, 0, 50, 62, 50,
db 0, 45, 57, 45, 0, 45, 57, 45,
db 0, 48, 60, 48, 0, 48, 60, 48,
db 0, 55, 67, 55, 0, 55, 67, 55,
db 0, 0, 0, 0, 62, HLD, HLD, HLD,
db HLD, HLD, HLD, HLD, 62, HLD, HLD, HLD,
db 62, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 60, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 0, 0, 0, 88, 89, HLD, 89, HLD,
db 0, 0, 0, 88, 84, HLD, 84, HLD,
db 0, 0, 0, 86, 88, HLD, 88, HLD,
db 0, 0, 0, 84, 81, HLD, 81, HLD,
db 0, 0, 0, 84, 79, HLD, 79, HLD,
db 0, 0, 0, 84, 86, HLD, 86, HLD,
db 0, 0, 0, 84, 83, HLD, 83, HLD,
db 0, 0, 0, 89, 91, HLD, 91, HLD,
db 0, 0, 0, 91, 89, HLD, 89, HLD,
db 86, HLD, 0, 0, 0, 0, 74, HLD,
db 81, HLD, 0, 0, 0, 0, 69, HLD,
db 84, HLD, 0, 0, 0, 0, 72, HLD,
db 79, HLD, 0, 0, 0, 0, 67, HLD,
db 93, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 98, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 0, 0, 0, 0, 0, 0, 0, 91,
db 93, HLD, 91, HLD, 93, HLD, 96, HLD,
db 0, 0, 0, 0, 0, 0, 96, HLD,
db 98, HLD, HLD, HLD, 96, HLD, 98, HLD,
db 100, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 0, 0, 0, 0, 0, 0, 98, 0,
db 100, HLD, 98, HLD, 100, HLD, 103, HLD,
db HLD, 0, 0, 0, 0, 0, 0, 0,
go4k_patterns_end
%ifdef USE_SECTIONS
section .g4kmuc2 data align=1
%else
section .data
%endif
go4k_pattern_lists
Instrument0List db 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1, 3, 4, 5, 4, 5, 6, 7, 6, 7, 8, 9, 8, 9, 1, 3, 1, 3, 4, 5, 4, 5, 6, 7, 6, 7, 8, 9, 8, 9, 1, 3, 1, 3, 4, 5, 4, 5, 6, 7, 6, 7, 8, 9, 8, 9, 1, 3, 1, 3, 4, 5, 4, 5, 6, 7, 6, 7, 8, 9, 8, 9, 1, 3, 1, 3, 4, 5, 4, 5, 6, 7, 6, 7, 8, 9, 8, 9, 1, 3, 1, 3, 4, 5, 4, 5, 6, 7, 6, 7, 8, 9, 8, 9, 1, 3, 1, 3, 4, 5, 4, 5, 6, 7, 6, 7, 8, 9, 8, 9, 1, 2, 0, 0,
Instrument1List db 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 0,
Instrument2List db 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 12, 12, 0, 0,
Instrument3List db 0, 0, 0, 0, 0, 0, 0, 16, 2, 2, 2, 2, 2, 2, 2, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Instrument4List db 0, 0, 0, 0, 0, 0, 0, 0, 19, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Instrument5List db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 20, 21, 22, 23, 22, 23, 22, 24, 22, 24, 25, 26, 27, 28, 20, 21, 20, 21, 22, 23, 22, 23, 22, 24, 22, 24, 25, 26, 27, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 20, 21, 22, 23, 22, 23, 22, 24, 22, 24, 25, 26, 27, 28, 20, 21, 20, 21, 22, 23, 22, 23, 22, 24, 22, 24, 25, 26, 27, 28, 20, 21, 20, 21, 22, 23, 22, 23, 22, 24, 22, 24, 25, 26, 27, 28, 0, 0, 0, 0,
Instrument6List db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 0, 29, 0, 30, 0, 30, 0, 31, 0, 31, 0, 32, 0, 32, 0, 29, 0, 29, 0, 30, 0, 30, 0, 31, 0, 31, 0, 32, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 0, 29, 0, 30, 0, 30, 0, 31, 0, 31, 0, 32, 0, 32, 0, 29, 0, 29, 0, 30, 0, 30, 0, 31, 0, 31, 0, 32, 0, 32, 0, 29, 0, 0, 0,
Instrument7List db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 34, 2, 35, 36, 2, 2, 37, 38, 39, 2, 40, 41, 34, 2, 0, 33, 34, 2, 35, 36, 2, 2, 37, 38, 39, 2, 40, 41, 34, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 34, 2, 35, 36, 2, 2, 37, 38, 39, 2, 40, 41, 34, 2, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Instrument8List db 19, 2, 2, 2, 2, 2, 2, 2, 19, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 19, 2, 2, 42,
go4k_pattern_lists_end
%ifdef USE_SECTIONS
section .g4kmuc3 data align=1
%else
section .data
%endif
go4k_synth_instructions
GO4K_BEGIN_CMDDEF(Instrument0)
db GO4K_ENV_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_DST_ID
db GO4K_VCF_ID
db GO4K_DST_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_DST_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_PAN_ID
db GO4K_OUT_ID
GO4K_END_CMDDEF
GO4K_BEGIN_CMDDEF(Instrument1)
db GO4K_ENV_ID
db GO4K_FST_ID
db GO4K_ENV_ID
db GO4K_FSTG_ID
db GO4K_FOP_ID
db GO4K_ENV_ID
db GO4K_DST_ID
db GO4K_FST_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_ENV_ID
db GO4K_VCO_ID
db GO4K_VCF_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_PAN_ID
db GO4K_OUT_ID
GO4K_END_CMDDEF
GO4K_BEGIN_CMDDEF(Instrument2)
db GO4K_ENV_ID
db GO4K_ENV_ID
db GO4K_FST_ID
db GO4K_FST_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_FST_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_FST_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_DLL_ID
db GO4K_PAN_ID
db GO4K_DLL_ID
db GO4K_OUT_ID
GO4K_END_CMDDEF
GO4K_BEGIN_CMDDEF(Instrument3)
db GO4K_ENV_ID
db GO4K_FST_ID
db GO4K_ENV_ID
db GO4K_FST_ID
db GO4K_FST_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_VCF_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_PAN_ID
db GO4K_OUT_ID
GO4K_END_CMDDEF
GO4K_BEGIN_CMDDEF(Instrument4)
db GO4K_ENV_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_PAN_ID
db GO4K_OUT_ID
GO4K_END_CMDDEF
GO4K_BEGIN_CMDDEF(Instrument5)
db GO4K_ENV_ID
db GO4K_FST_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_ENV_ID
db GO4K_FST_ID
db GO4K_FST_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_DLL_ID
db GO4K_PAN_ID
db GO4K_DLL_ID
db GO4K_OUT_ID
GO4K_END_CMDDEF
GO4K_BEGIN_CMDDEF(Instrument6)
db GO4K_ENV_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_FST_ID
db GO4K_FST_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_DLL_ID
db GO4K_PAN_ID
db GO4K_OUT_ID
GO4K_END_CMDDEF
GO4K_BEGIN_CMDDEF(Instrument7)
db GO4K_ENV_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_PAN_ID
db GO4K_DLL_ID
db GO4K_FOP_ID
db GO4K_DLL_ID
db GO4K_OUT_ID
GO4K_END_CMDDEF
GO4K_BEGIN_CMDDEF(Instrument8)
db GO4K_ENV_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_FSTG_ID
db GO4K_FSTG_ID
db GO4K_FSTG_ID
db GO4K_FSTG_ID
db GO4K_FOP_ID
GO4K_END_CMDDEF
GO4K_BEGIN_CMDDEF(Global)
db GO4K_ACC_ID
db GO4K_VCF_ID
db GO4K_DLL_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_DLL_ID
db GO4K_ACC_ID
db GO4K_FOP_ID
db GO4K_OUT_ID
GO4K_END_CMDDEF
go4k_synth_instructions_end
%ifdef USE_SECTIONS
section .g4kmuc4 data align=1
%else
section .data
%endif
go4k_synth_parameter_values
GO4K_BEGIN_PARAMDEF(Instrument0)
GO4K_ENV ATTAC(0),DECAY(64),SUSTAIN(64),RELEASE(0),GAIN(128)
GO4K_VCO TRANSPOSE(64),DETUNE(66),PHASE(96),GATES(0),COLOR(112),SHAPE(32),GAIN(128),FLAGS(TRISAW)
GO4K_VCO TRANSPOSE(64),DETUNE(72),PHASE(0),GATES(85),COLOR(48),SHAPE(80),GAIN(128),FLAGS(SINE)
GO4K_VCO TRANSPOSE(64),DETUNE(56),PHASE(32),GATES(85),COLOR(40),SHAPE(64),GAIN(128),FLAGS(TRISAW)
GO4K_VCO TRANSPOSE(64),DETUNE(72),PHASE(48),GATES(85),COLOR(48),SHAPE(32),GAIN(128),FLAGS(SINE)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_ADDP)
GO4K_DST DRIVE(80), SNHFREQ(128)
GO4K_VCF FREQUENCY(96),RESONANCE(64),VCFTYPE(LOWPASS)
GO4K_DST DRIVE(96), SNHFREQ(128)
GO4K_FOP OP(FOP_PUSH)
GO4K_VCF FREQUENCY(64),RESONANCE(64),VCFTYPE(HIGHPASS)
GO4K_FOP OP(FOP_XCH)
GO4K_VCF FREQUENCY(64),RESONANCE(64),VCFTYPE(LOWPASS)
GO4K_DST DRIVE(96), SNHFREQ(128)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_MULP)
GO4K_PAN PANNING(64)
GO4K_OUT GAIN(128), AUXSEND(8)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument1)
GO4K_ENV ATTAC(0),DECAY(32),SUSTAIN(96),RELEASE(64),GAIN(128)
GO4K_FST AMOUNT(128),DEST(0*MAX_WORKSPACE_SLOTS+2)
GO4K_ENV ATTAC(0),DECAY(72),SUSTAIN(0),RELEASE(0),GAIN(128)
GO4K_FSTG AMOUNT(128),DEST(8*go4k_instrument.size*MAX_VOICES+0*MAX_WORKSPACE_SLOTS*4+2*4+go4k_instrument.workspace)
GO4K_FOP OP(FOP_POP)
GO4K_ENV ATTAC(0),DECAY(72),SUSTAIN(0),RELEASE(0),GAIN(128)
GO4K_DST DRIVE(32), SNHFREQ(128)
GO4K_FST AMOUNT(80),DEST(9*MAX_WORKSPACE_SLOTS+1)
GO4K_FOP OP(FOP_POP)
GO4K_VCO TRANSPOSE(44),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(64),GAIN(128),FLAGS(SINE)
GO4K_ENV ATTAC(0),DECAY(32),SUSTAIN(0),RELEASE(0),GAIN(128)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(64),GAIN(128),FLAGS(NOISE)
GO4K_VCF FREQUENCY(64),RESONANCE(128),VCFTYPE(HIGHPASS)
GO4K_VCF FREQUENCY(96),RESONANCE(64),VCFTYPE(LOWPASS)
GO4K_FOP OP(FOP_MULP)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_MULP)
GO4K_PAN PANNING(64)
GO4K_OUT GAIN(128), AUXSEND(0)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument2)
GO4K_ENV ATTAC(0),DECAY(64),SUSTAIN(0),RELEASE(72),GAIN(128)
GO4K_ENV ATTAC(0),DECAY(72),SUSTAIN(0),RELEASE(80),GAIN(128)
GO4K_FST AMOUNT(96),DEST(18*MAX_WORKSPACE_SLOTS+4)
GO4K_FST AMOUNT(96),DEST(19*MAX_WORKSPACE_SLOTS+4)
GO4K_FOP OP(FOP_POP)
GO4K_FOP OP(FOP_PUSH)
GO4K_VCO TRANSPOSE(72),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(64),GAIN(128),FLAGS(SINE|LFO)
GO4K_FOP OP(FOP_ADDP)
GO4K_FST AMOUNT(32),DEST(13*MAX_WORKSPACE_SLOTS+5)
GO4K_FOP OP(FOP_POP)
GO4K_VCO TRANSPOSE(96),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(64),GAIN(128),FLAGS(SINE|LFO)
GO4K_FST AMOUNT(80),DEST(15*MAX_WORKSPACE_SLOTS+2)
GO4K_FOP OP(FOP_POP)
GO4K_VCO TRANSPOSE(76),DETUNE(64),PHASE(0),GATES(85),COLOR(128),SHAPE(64),GAIN(128),FLAGS(PULSE)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(64),GAIN(128),FLAGS(PULSE)
GO4K_VCO TRANSPOSE(76),DETUNE(64),PHASE(0),GATES(85),COLOR(0),SHAPE(64),GAIN(128),FLAGS(TRISAW)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_ADDP)
GO4K_VCF FREQUENCY(24),RESONANCE(96),VCFTYPE(LOWPASS)
GO4K_VCF FREQUENCY(24),RESONANCE(96),VCFTYPE(PEAK)
GO4K_FOP OP(FOP_MULP)
GO4K_DLL PREGAIN(64),DRY(128),FEEDBACK(64),DAMP(32),FREQUENCY(0),DEPTH(0),DELAY(16),COUNT(1)
GO4K_PAN PANNING(64)
GO4K_DLL PREGAIN(128),DRY(0),FEEDBACK(0),DAMP(0),FREQUENCY(0),DEPTH(0),DELAY(17),COUNT(1)
GO4K_OUT GAIN(40), AUXSEND(8)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument3)
GO4K_ENV ATTAC(0),DECAY(80),SUSTAIN(0),RELEASE(0),GAIN(128)
GO4K_FST AMOUNT(128),DEST(0*MAX_WORKSPACE_SLOTS+2)
GO4K_ENV ATTAC(0),DECAY(32),SUSTAIN(0),RELEASE(0),GAIN(128)
GO4K_FST AMOUNT(104),DEST(6*MAX_WORKSPACE_SLOTS+1)
GO4K_FST AMOUNT(72),DEST(7*MAX_WORKSPACE_SLOTS+1)
GO4K_FOP OP(FOP_POP)
GO4K_VCO TRANSPOSE(52),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(32),GAIN(48),FLAGS(SINE)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(80),GAIN(48),FLAGS(SINE)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(16),GAIN(64),FLAGS(NOISE)
GO4K_VCF FREQUENCY(112),RESONANCE(128),VCFTYPE(LOWPASS)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(64),GAIN(16),FLAGS(NOISE)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_MULP)
GO4K_VCF FREQUENCY(24),RESONANCE(32),VCFTYPE(HIGHPASS)
GO4K_PAN PANNING(64)
GO4K_OUT GAIN(8), AUXSEND(0)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument4)
GO4K_ENV ATTAC(0),DECAY(128),SUSTAIN(128),RELEASE(0),GAIN(128)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(64),GATES(85),COLOR(64),SHAPE(64),GAIN(128),FLAGS(NOISE)
GO4K_FOP OP(FOP_MULP)
GO4K_VCF FREQUENCY(112),RESONANCE(128),VCFTYPE(HIGHPASS)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(17),COLOR(17),SHAPE(64),GAIN(128),FLAGS(GATE|LFO)
GO4K_FOP OP(FOP_MULP)
GO4K_PAN PANNING(64)
GO4K_OUT GAIN(8), AUXSEND(16)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument5)
GO4K_ENV ATTAC(0),DECAY(64),SUSTAIN(64),RELEASE(72),GAIN(128)
GO4K_FST AMOUNT(112),DEST(0*MAX_WORKSPACE_SLOTS+2)
GO4K_VCO TRANSPOSE(52),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(64),GAIN(128),FLAGS(PULSE)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(85),COLOR(0),SHAPE(64),GAIN(128),FLAGS(TRISAW)
GO4K_FOP OP(FOP_ADDP)
GO4K_ENV ATTAC(0),DECAY(64),SUSTAIN(16),RELEASE(64),GAIN(128)
GO4K_FST AMOUNT(96),DEST(9*MAX_WORKSPACE_SLOTS+4)
GO4K_FST AMOUNT(96),DEST(10*MAX_WORKSPACE_SLOTS+4)
GO4K_FOP OP(FOP_POP)
GO4K_VCF FREQUENCY(16),RESONANCE(128),VCFTYPE(PEAK)
GO4K_VCF FREQUENCY(8),RESONANCE(128),VCFTYPE(LOWPASS)
GO4K_FOP OP(FOP_MULP)
GO4K_DLL PREGAIN(64),DRY(128),FEEDBACK(64),DAMP(64),FREQUENCY(0),DEPTH(0),DELAY(16),COUNT(1)
GO4K_PAN PANNING(64)
GO4K_DLL PREGAIN(128),DRY(0),FEEDBACK(0),DAMP(0),FREQUENCY(0),DEPTH(0),DELAY(18),COUNT(1)
GO4K_OUT GAIN(32), AUXSEND(8)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument6)
GO4K_ENV ATTAC(48),DECAY(80),SUSTAIN(64),RELEASE(64),GAIN(128)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(64),GAIN(64),FLAGS(NOISE)
GO4K_VCO TRANSPOSE(16),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(64),GAIN(128),FLAGS(TRISAW|LFO)
GO4K_FOP OP(FOP_ADDP)
GO4K_FST AMOUNT(40),DEST(9*MAX_WORKSPACE_SLOTS+4)
GO4K_FST AMOUNT(58),DEST(9*MAX_WORKSPACE_SLOTS+5)
GO4K_FOP OP(FOP_POP)
GO4K_VCO TRANSPOSE(88),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(64),GAIN(128),FLAGS(SINE)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(64),GATES(85),COLOR(64),SHAPE(64),GAIN(8),FLAGS(NOISE)
GO4K_VCF FREQUENCY(72),RESONANCE(24),VCFTYPE(BANDPASS)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_PUSH)
GO4K_VCF FREQUENCY(32),RESONANCE(128),VCFTYPE(BANDPASS)
GO4K_FOP OP(FOP_XCH)
GO4K_VCF FREQUENCY(96),RESONANCE(128),VCFTYPE(BANDPASS)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_MULP)
GO4K_DLL PREGAIN(64),DRY(128),FEEDBACK(64),DAMP(64),FREQUENCY(0),DEPTH(0),DELAY(19),COUNT(1)
GO4K_PAN PANNING(48)
GO4K_OUT GAIN(64), AUXSEND(16)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument7)
GO4K_ENV ATTAC(0),DECAY(64),SUSTAIN(64),RELEASE(64),GAIN(128)
GO4K_VCO TRANSPOSE(52),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(64),GAIN(128),FLAGS(PULSE)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(64),GAIN(128),FLAGS(SINE)
GO4K_FOP OP(FOP_ADDP)
GO4K_VCF FREQUENCY(48),RESONANCE(64),VCFTYPE(LOWPASS)
GO4K_FOP OP(FOP_MULP)
GO4K_PAN PANNING(48)
GO4K_DLL PREGAIN(128),DRY(64),FEEDBACK(64),DAMP(64),FREQUENCY(48),DEPTH(64),DELAY(18),COUNT(1)
GO4K_FOP OP(FOP_XCH)
GO4K_DLL PREGAIN(112),DRY(64),FEEDBACK(64),DAMP(64),FREQUENCY(46),DEPTH(64),DELAY(18),COUNT(1)
GO4K_OUT GAIN(32), AUXSEND(0)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument8)
GO4K_ENV ATTAC(0),DECAY(128),SUSTAIN(0),RELEASE(0),GAIN(0)
GO4K_FOP OP(FOP_PUSH)
GO4K_FOP OP(FOP_ADDP)
GO4K_FSTG AMOUNT(16),DEST(0*go4k_instrument.size*MAX_VOICES+0*MAX_WORKSPACE_SLOTS*4+2*4+go4k_instrument.workspace)
GO4K_FSTG AMOUNT(0),DEST(2*go4k_instrument.size*MAX_VOICES+0*MAX_WORKSPACE_SLOTS*4+2*4+go4k_instrument.workspace)
GO4K_FSTG AMOUNT(16),DEST(4*go4k_instrument.size*MAX_VOICES+0*MAX_WORKSPACE_SLOTS*4+2*4+go4k_instrument.workspace)
GO4K_FSTG AMOUNT(48),DEST(7*go4k_instrument.size*MAX_VOICES+0*MAX_WORKSPACE_SLOTS*4+2*4+go4k_instrument.workspace)
GO4K_FOP OP(FOP_POP)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Global)
GO4K_ACC ACCTYPE(AUX)
GO4K_VCF FREQUENCY(4),RESONANCE(64),VCFTYPE(HIGHPASS)
GO4K_DLL PREGAIN(24),DRY(128),FEEDBACK(126),DAMP(96),FREQUENCY(0),DEPTH(0),DELAY(0),COUNT(8)
GO4K_FOP OP(FOP_XCH)
GO4K_VCF FREQUENCY(4),RESONANCE(64),VCFTYPE(HIGHPASS)
GO4K_DLL PREGAIN(24),DRY(128),FEEDBACK(126),DAMP(96),FREQUENCY(0),DEPTH(0),DELAY(8),COUNT(8)
GO4K_ACC ACCTYPE(OUTPUT)
GO4K_FOP OP(FOP_ADDP2)
GO4K_OUT GAIN(48), AUXSEND(0)
GO4K_END_PARAMDEF
go4k_synth_parameter_values_end
%ifdef USE_SECTIONS
section .g4kmuc5 data align=1
%else
section .data
%endif
%ifdef GO4K_USE_DLL
global _go4k_delay_times
_go4k_delay_times
dw 1116
dw 1188
dw 1276
dw 1356
dw 1422
dw 1492
dw 1556
dw 1618
dw 1140
dw 1212
dw 1300
dw 1380
dw 1446
dw 1516
dw 1580
dw 1642
dw 14472
dw 528
dw 544
dw 19296
%endif

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,364 @@
//#define DEBUG_COMPRESSED_SHADER
#ifdef _DEBUG
#include "Shaders.h"
PFNGLCREATESHADERPROC glCreateShader = NULL;
PFNGLSHADERSOURCEPROC glShaderSource = NULL;
PFNGLCOMPILESHADERPROC glCompileShader = NULL;
PFNGLGETSHADERIVPROC glGetShaderiv = NULL;
PFNGLGETPROGRAMIVPROC glGetProgramiv = NULL;
PFNGLCREATEPROGRAMPROC glCreateProgram = NULL;
PFNGLATTACHSHADERPROC glAttachShader = NULL;
PFNGLLINKPROGRAMPROC glLinkProgram = NULL;
PFNGLUSEPROGRAMPROC glUseProgram = NULL;
PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog = NULL;
PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog = NULL;
void useProgram(GLhandleARB ah_Program)
{
glUseProgram(ah_Program);
}
void initShaders()
{
glCreateShader = (PFNGLCREATESHADERPROC)myGetProcAddress("glCreateShader");
glShaderSource = (PFNGLSHADERSOURCEPROC)myGetProcAddress("glShaderSource");
glCompileShader = (PFNGLCOMPILESHADERPROC)myGetProcAddress("glCompileShader");
glGetShaderiv = (PFNGLGETSHADERIVPROC)myGetProcAddress("glGetShaderiv");
glGetProgramiv = (PFNGLGETPROGRAMIVPROC)myGetProcAddress("glGetProgramiv");
glCreateProgram = (PFNGLCREATEPROGRAMPROC)myGetProcAddress("glCreateProgram");
glAttachShader = (PFNGLATTACHSHADERPROC)myGetProcAddress("glAttachShader");
glLinkProgram = (PFNGLLINKPROGRAMPROC)myGetProcAddress("glLinkProgram");
glUseProgram = (PFNGLUSEPROGRAMPROC)myGetProcAddress("glUseProgram");
glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)myGetProcAddress("glGetShaderInfoLog");
glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)myGetProcAddress("glGetProgramInfoLog");
if (!(glCreateShader && glShaderSource && glCompileShader && glGetShaderiv && glGetProgramiv && glCreateProgram && glAttachShader && glLinkProgram && glUseProgram && glGetShaderInfoLog && glGetProgramInfoLog))
{
std::cerr << "Some shader functions are not available!" << std::endl;
}
}
#include <sstream>
#include <fstream>
std::string ReplaceString(const std::string &stringSearchString, const std::string &stringReplaceString, std::string stringStringToReplace)
{
std::string::size_type pos = stringStringToReplace.find(stringSearchString, 0);
int intLengthSearch = stringSearchString.length();
int intLengthReplacment = stringReplaceString.length();
while(std::string::npos != pos)
{
stringStringToReplace.replace(pos, intLengthSearch, stringReplaceString);
pos = stringStringToReplace.find(stringSearchString, pos + intLengthReplacment);
}
return stringStringToReplace;
}
std::string MakeFileName( const char* as_FileName, int ShaderID, bool bDebug )
{
std::stringstream ss;
ss << as_FileName << "_" << ShaderID;
if( bDebug )
{
ss << "_dbg";
}
return ss.str();
}
void CreateSubShader( const char* as_FileName, int ShaderID, bool bDebug )
{
char* ls_ShaderSource = textFileRead(as_FileName);
std::string strData= ls_ShaderSource;
std::string strNewData;
bool bRemove= false;
for( size_t i= 0; i < strData.size(); ++i )
{
bool bEndRemove= false;
if( strData[ i ] == '@' )
{
if( i + 2 >= strData.size() )
{
break;
}
i++;
if( strData[ i ] == '@' )
{
bRemove= false;
}
else if( strData[ i ] == 'D' )
{
bRemove= !bDebug;
}
else
{
int ID= (int)(strData[ i ] - '0');
bRemove= ID!=ShaderID;
}
i++;
}
if( !bRemove || strData[ i ] == 10 || strData[ i ] == 13)
{
strNewData+= strData[ i ];
}
}
std::string strFileOut= MakeFileName( as_FileName, ShaderID, bDebug );
std::ofstream ofs(strFileOut.c_str());
// some Renaming
/*strNewData= ReplaceString( "rayDir","q", strNewData);
strNewData= ReplaceString( "cRes","b", strNewData);
strNewData= ReplaceString( "cFac","a", strNewData);
strNewData= ReplaceString( "CurStep","d", strNewData);
strNewData= ReplaceString( "CurStep","d", strNewData);
strNewData= ReplaceString( "rotate","r", strNewData);
strNewData= ReplaceString( "repeatHex","sh", strNewData);
strNewData= ReplaceString( "repeat","s", strNewData);
strNewData= ReplaceString( "pi2","P", strNewData);
strNewData= ReplaceString( "sqrtOf075","Q", strNewData);
strNewData= ReplaceString( "EndlessBar","O", strNewData);
strNewData= ReplaceString( "CurTime","R", strNewData);
strNewData= ReplaceString( "CurScene","S", strNewData);
strNewData= ReplaceString( "torus","T", strNewData);
strNewData= ReplaceString( "noise3D","N", strNewData);
strNewData= ReplaceString( "smoothnoise","M", strNewData);*/
ofs << strNewData;
}
void CreateAllSubShader( const char* as_FileName )
{
for( int i= 0; i < MAX_SHADER_ID; ++i )
{
CreateSubShader( as_FileName, i, true );
CreateSubShader( as_FileName, i, false );
}
}
void PrintErrors()
{
GLenum lr_Error = GL_NO_ERROR;
int li_ErrorCount = 5;
do
{
lr_Error = glGetError();
if (lr_Error != GL_NO_ERROR)
{
li_ErrorCount--;
char* ls_ErrorString = (char*)gluErrorString(lr_Error);
if (ls_ErrorString != 0)
std::cout << "OPENGL :: ERROR " << ls_ErrorString << std::endl;
}
if (li_ErrorCount == 0)
{
std::cout << "OPENGL :: ERROR Too many errors!" << std::endl;
break;
}
} while (lr_Error != GL_NO_ERROR);
}
GLhandleARB createVertexShader(const char* as_FileName)
{
GLhandleARB lh_Shader = 0;
char* ls_ShaderSource = textFileRead(as_FileName);
if (ls_ShaderSource == NULL)
{
std::cerr << "Error reading file: " << as_FileName << std::endl;
return lh_Shader;
}
lh_Shader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(lh_Shader, 1, (const char**)&ls_ShaderSource, NULL);
glCompileShader(lh_Shader);
free(ls_ShaderSource);
int li_Status = 0;
glGetShaderiv(lh_Shader, GL_COMPILE_STATUS, &li_Status);
if (li_Status == GL_FALSE)
{
std::cerr << "Error compiling vertex shader: " << as_FileName << std::endl;
printShaderInfoLog(lh_Shader);
}
return lh_Shader;
}
#ifdef DEBUG_COMPRESSED_SHADER
#include "shader_code.h"
#endif
GLhandleARB createFragmentShader(const char* as_FileName, int ShaderID, bool bDebug)
{
CreateAllSubShader( as_FileName );
GLhandleARB lh_Shader = 0;
char* ls_ShaderSource = textFileRead(MakeFileName(as_FileName, ShaderID, bDebug).c_str());
if (ls_ShaderSource == NULL)
{
std::cerr << "Error reading file: " << as_FileName << std::endl;
return lh_Shader;
}
lh_Shader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(lh_Shader, 1, (const char**)&ls_ShaderSource, NULL);
#ifdef DEBUG_COMPRESSED_SHADER
glShaderSource(lh_Shader, 1, (const char**)&mark_fs, NULL);
#endif
glCompileShader(lh_Shader);
int li_Status = 0;
glGetShaderiv(lh_Shader, GL_COMPILE_STATUS, &li_Status);
if (li_Status == GL_FALSE)
{
std::cerr << "Error compiling fragment shader: " << as_FileName << std::endl;
printShaderInfoLog(lh_Shader);
}
free(ls_ShaderSource);
return lh_Shader;
}
GLhandleARB createProgram(GLhandleARB ah_VertexShader, GLhandleARB ah_FragmentShader)
{
GLhandleARB lh_Program = 0;
if (ah_VertexShader + ah_FragmentShader <= 1)
{
std::cerr << "Cannot create program." << std::endl;
return lh_Program;
}
lh_Program = glCreateProgram();
glAttachShader(lh_Program, ah_VertexShader);
glAttachShader(lh_Program, ah_FragmentShader);
glLinkProgram(lh_Program);
int li_Status = 0;
glGetProgramiv(lh_Program, GL_LINK_STATUS, &li_Status);
if (li_Status == GL_FALSE)
{
std::cerr << "Error linking shaders." << std::endl;
printProgramInfoLog(lh_Program);
}
return lh_Program;
}
char* textFileRead(const char* as_FileName)
{
FILE* lh_File;
char* ls_Content = NULL;
size_t li_Count = 0;
if (as_FileName != NULL)
{
fopen_s(&lh_File, as_FileName, "rt");
if (lh_File != NULL)
{
fseek(lh_File, 0, SEEK_END);
li_Count = ftell(lh_File);
rewind(lh_File);
if (li_Count > 0)
{
ls_Content = (char*) malloc(sizeof(char) * (li_Count + 1));
li_Count = fread(ls_Content, sizeof(char), li_Count, lh_File);
ls_Content[li_Count] = '\0';
}
fclose(lh_File);
}
}
return ls_Content;
}
void printShaderInfoLog(GLhandleARB ah_Shader)
{
int li_InfologLength = 0;
int li_CharsWritten = 0;
char* li_InfoLog;
glGetShaderiv(ah_Shader, GL_INFO_LOG_LENGTH, &li_InfologLength);
if (li_InfologLength > 0)
{
li_InfoLog = (char*) malloc(li_InfologLength);
glGetShaderInfoLog(ah_Shader, li_InfologLength, &li_CharsWritten, li_InfoLog);
std::cerr << li_InfoLog << std::endl;
free(li_InfoLog);
}
}
void printProgramInfoLog(GLhandleARB ah_Program)
{
int li_InfologLength = 0;
int li_CharsWritten = 0;
char* ls_InfoLog;
glGetProgramiv(ah_Program, GL_INFO_LOG_LENGTH, &li_InfologLength);
if (li_InfologLength > 0)
{
ls_InfoLog = (char *)malloc(li_InfologLength);
glGetProgramInfoLog(ah_Program, li_InfologLength, &li_CharsWritten, ls_InfoLog);
std::cerr << ls_InfoLog << std::endl;
free(ls_InfoLog);
}
}
bool printShaderStatistics()
{
if (GL_VERSION_2_1) std::cout << "Supports OpenGL 2.1. " << std::endl;
else if (GL_VERSION_2_0) std::cout << "Supports OpenGL 2.0. " << std::endl;
else if (GL_VERSION_1_5) std::cout << "Supports OpenGL 1.5. " << std::endl;
else if (GL_VERSION_1_4) std::cout << "Supports OpenGL 1.4. " << std::endl;
else if (GL_VERSION_1_3) std::cout << "Supports OpenGL 1.3. " << std::endl;
else if (GL_VERSION_1_2) std::cout << "Supports OpenGL 1.2. " << std::endl;
else if (GL_VERSION_1_1) std::cout << "Supports OpenGL 1.1. " << std::endl;
if (GL_ARB_shader_objects && GL_ARB_vertex_shader && GL_ARB_fragment_shader)
{
std::cout << "Status: Using GLSL " << glGetString(GL_SHADING_LANGUAGE_VERSION_ARB) << std::endl;
}
else
{
std::cerr << "No GLSL support!" << std::endl;
return false;
}
return true;
}
#endif

View File

@@ -0,0 +1,21 @@
#pragma once
#define MAX_SHADER_ID 4
#include <windows.h>
#include <iostream>
#include <GL/gl.h>
#include <GL/glu.h>
#include "glext.h"
#define myGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
void initShaders();
GLhandleARB createVertexShader(const char* as_FileName);
GLhandleARB createFragmentShader(const char* as_FileName, int ShaderID, bool bDebug);
GLhandleARB createProgram(GLhandleARB ah_VertexShader, GLhandleARB ah_FragmentShader);
void PrintErrors();
void useProgram(GLhandleARB ah_Program);
char* textFileRead(const char* as_FileName);
void printShaderInfoLog(GLhandleARB ah_Shader);
void printProgramInfoLog(GLhandleARB ah_Program);
bool printShaderStatistics();

View File

@@ -0,0 +1,23 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bp4k", "bp4k.vcxproj", "{213903DE-E40A-4D23-9310-E520AC2B412E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Compress_Slow|Win32 = Compress_Slow|Win32
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{213903DE-E40A-4D23-9310-E520AC2B412E}.Compress_Slow|Win32.ActiveCfg = Compress_Slow|Win32
{213903DE-E40A-4D23-9310-E520AC2B412E}.Compress_Slow|Win32.Build.0 = Compress_Slow|Win32
{213903DE-E40A-4D23-9310-E520AC2B412E}.Debug|Win32.ActiveCfg = Debug|Win32
{213903DE-E40A-4D23-9310-E520AC2B412E}.Debug|Win32.Build.0 = Debug|Win32
{213903DE-E40A-4D23-9310-E520AC2B412E}.Release|Win32.ActiveCfg = Release|Win32
{213903DE-E40A-4D23-9310-E520AC2B412E}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Binary file not shown.

View File

@@ -0,0 +1,369 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="bp4k"
ProjectGUID="{213903DE-E40A-4D23-9310-E520AC2B412E}"
RootNamespace="bp4k"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)_$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
CallingConvention="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Gdi32.lib user32.lib opengl32.lib winmm.lib glu32.lib"
OutputFile="$(OutDir)\$(ProjectName)_$(ConfigurationName).exe"
LinkIncremental="2"
AdditionalLibraryDirectories="&quot;$(ProjectDir)&quot;"
GenerateDebugInformation="true"
SubSystem="1"
EntryPointSymbol="main"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)_$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="rem minify\shader_minifier.exe &quot;mark.fs_0&quot; -o mark_0.h -v --no-renaming&#x0D;&#x0A;rem minify\shader_minifier.exe &quot;mark.fs_1&quot; -o mark_1.h -v --no-renaming&#x0D;&#x0A;rem minify\shader_minifier.exe &quot;mark.fs_2&quot; -o mark_2.h -v --no-renaming&#x0D;&#x0A;rem minify\shader_minifier.exe &quot;mark.fs_0&quot; -o mark_small.h -v&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="2"
WholeProgramOptimization="false"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
ExceptionHandling="0"
RuntimeLibrary="0"
BufferSecurityCheck="false"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="0"
DebugInformationFormat="3"
CallingConvention="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/CRINKLER"
AdditionalDependencies="Gdi32.lib user32.lib opengl32.lib winmm.lib libcmt.lib"
OutputFile="$(OutDir)\$(ProjectName)_$(ConfigurationName).exe"
AdditionalLibraryDirectories="&quot;$(ProjectDir)&quot;"
GenerateManifest="false"
ManifestFile=""
GenerateDebugInformation="true"
SubSystem="2"
LinkTimeCodeGeneration="0"
EntryPointSymbol="main"
TargetMachine="1"
ErrorReporting="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Compress (Slow)|Win32"
OutputDirectory="$(SolutionDir)bin"
IntermediateDirectory="$(SolutionDir)obj\$(ProjectName)_$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine=""
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/QIfist"
Optimization="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="2"
WholeProgramOptimization="false"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
ExceptionHandling="0"
RuntimeLibrary="0"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="false"
FloatingPointModel="2"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="0"
DebugInformationFormat="0"
CallingConvention="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/CRINKLER /COMPMODE:SLOW /ORDERTRIES:4000 /HASHTRIES:300 /UNSAFEIMPORT /TRUNCATEFLOATS:24 /HASHSIZE:200 /REPORT:report.html /RANGE:opengl32 /PROGRESSGUI /TRANSFORM:CALLS"
AdditionalDependencies="opengl32.lib winmm.lib"
OutputFile="$(OutDir)\$(ProjectName)_$(ConfigurationName).exe"
AdditionalLibraryDirectories="&quot;$(ProjectDir)&quot;"
GenerateManifest="false"
ManifestFile=""
GenerateDebugInformation="false"
SubSystem="2"
LinkTimeCodeGeneration="0"
EntryPointSymbol="main"
TargetMachine="1"
ErrorReporting="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\main.cpp"
>
</File>
<File
RelativePath=".\Shaders.cpp"
>
</File>
<File
RelativePath=".\synth.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\glext.h"
>
</File>
<File
RelativePath=".\release.h"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description=""
CommandLine=""
AdditionalDependencies=""
Outputs=""
/>
</FileConfiguration>
<FileConfiguration
Name="Compress (Slow)|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description=""
CommandLine=""
AdditionalDependencies=""
Outputs=""
/>
</FileConfiguration>
</File>
<File
RelativePath=".\Shaders.h"
>
</File>
<File
RelativePath=".\small.h"
>
</File>
<File
RelativePath=".\synth.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\4klang.obj"
>
</File>
<File
RelativePath=".\generic.vs"
>
</File>
<File
RelativePath=".\mark.fs"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,245 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Compress_Slow|Win32">
<Configuration>Compress_Slow</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{213903DE-E40A-4D23-9310-E520AC2B412E}</ProjectGuid>
<RootNamespace>bp4k</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Compress_Slow|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v100</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>NotSet</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v100</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v100</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Compress_Slow|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)obj\$(ProjectName)_$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)obj\$(ProjectName)_$(Configuration)\</IntDir>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</GenerateManifest>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Compress_Slow|Win32'">$(SolutionDir)bin\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Compress_Slow|Win32'">$(SolutionDir)obj\$(ProjectName)_$(Configuration)\</IntDir>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Compress_Slow|Win32'">false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ExecutablePath>$(ProjectDir);$(ExecutablePath)</ExecutablePath>
<TargetName>$(ProjectName)_$(Configuration)</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ExecutablePath>$(ProjectDir);$(ExecutablePath)</ExecutablePath>
<TargetName>$(ProjectName)_$(Configuration)</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Compress_Slow|Win32'">
<TargetName>$(ProjectName)_$(Configuration)</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CallingConvention>StdCall</CallingConvention>
</ClCompile>
<Link>
<AdditionalDependencies>4klang.obj;Gdi32.lib;user32.lib;opengl32.lib;winmm.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(ProjectDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<EntryPointSymbol>main</EntryPointSymbol>
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent>
<Command>rem minify\shader_minifier.exe "mark.fs_0" -o mark_0.h -v --no-renaming
rem minify\shader_minifier.exe "mark.fs_1" -o mark_1.h -v --no-renaming
rem minify\shader_minifier.exe "mark.fs_2" -o mark_2.h -v --no-renaming
rem minify\shader_minifier.exe "mark.fs_0" -o mark_small.h -v
</Command>
</PreBuildEvent>
<ClCompile>
<Optimization>MinSpace</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>
</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CallingConvention>StdCall</CallingConvention>
</ClCompile>
<Link>
<AdditionalDependencies>4klang.obj;Gdi32.lib;user32.lib;opengl32.lib;winmm.lib;libcmt.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(ProjectDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ManifestFile>
</ManifestFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<LinkTimeCodeGeneration>
</LinkTimeCodeGeneration>
<EntryPointSymbol>main</EntryPointSymbol>
<TargetMachine>MachineX86</TargetMachine>
<LinkErrorReporting>
</LinkErrorReporting>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Compress_Slow|Win32'">
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<ClCompile>
<AdditionalOptions>/QIfist %(AdditionalOptions)</AdditionalOptions>
<Optimization>MinSpace</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<FunctionLevelLinking>false</FunctionLevelLinking>
<FloatingPointModel>Fast</FloatingPointModel>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<DebugInformationFormat>
</DebugInformationFormat>
<CallingConvention>StdCall</CallingConvention>
<StringPooling Condition="'$(Configuration)|$(Platform)'=='Compress (Slow)|Win32'">false</StringPooling>
<StringPooling Condition="'$(Configuration)|$(Platform)'=='Compress (Slow)|Win32'">true</StringPooling>
</ClCompile>
<Link>
<AdditionalOptions>/CRINKLER /COMPMODE:SLOW /ORDERTRIES:4000 /HASHTRIES:300 /UNSAFEIMPORT /TRUNCATEFLOATS:24 /HASHSIZE:200 /REPORT:report.html /RANGE:opengl32 /PROGRESSGUI /TRANSFORM:CALLS %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>4klang.obj;opengl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(ProjectDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ManifestFile>
</ManifestFile>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<LinkTimeCodeGeneration>
</LinkTimeCodeGeneration>
<EntryPointSymbol>main</EntryPointSymbol>
<TargetMachine>MachineX86</TargetMachine>
<LinkErrorReporting>
</LinkErrorReporting>
<SuppressStartupBanner Condition="'$(Configuration)|$(Platform)'=='Compress (Slow)|Win32'">false</SuppressStartupBanner>
<ImageHasSafeExceptionHandlers Condition="'$(Configuration)|$(Platform)'=='Compress (Slow)|Win32'">false</ImageHasSafeExceptionHandlers>
<DataExecutionPrevention Condition="'$(Configuration)|$(Platform)'=='Compress (Slow)|Win32'">false</DataExecutionPrevention>
<RandomizedBaseAddress Condition="'$(Configuration)|$(Platform)'=='Compress (Slow)|Win32'">false</RandomizedBaseAddress>
<IgnoreAllDefaultLibraries Condition="'$(Configuration)|$(Platform)'=='Compress (Slow)|Win32'">true</IgnoreAllDefaultLibraries>
</Link>
<ProjectReference>
<LinkLibraryDependencies Condition="'$(Configuration)|$(Platform)'=='Compress (Slow)|Win32'">false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Compress_Slow|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="main_release.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="Shaders.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="4klang.h" />
<ClInclude Include="glext.h" />
<CustomBuild Include="release.h">
<Message Condition="'$(Configuration)|$(Platform)'=='Compress_Slow|Win32'">
</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Compress_Slow|Win32'">
</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Compress_Slow|Win32'">%(AdditionalInputs)</AdditionalInputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Compress_Slow|Win32'">%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalInputs)</AdditionalInputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(Outputs)</Outputs>
</CustomBuild>
<ClInclude Include="mark_small.h" />
<ClInclude Include="Shaders.h" />
<ClInclude Include="small.h" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="4klang.asm">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Compress_Slow|Win32'">yasm-1.2.0-win32.exe -f win32 -o 4klang.obj 4klang.asm</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Compress_Slow|Win32'">Compiling 4klang...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Compress_Slow|Win32'">4klang.obj</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">yasm-1.2.0-win32.exe -f win32 -o 4klang.obj 4klang.asm</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compiling 4klang...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4klang.obj</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">yasm-1.2.0-win32.exe -f win32 -o 4klang.obj 4klang.asm</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compiling 4klang...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4klang.obj</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4klang.inc</AdditionalInputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Compress_Slow|Win32'">4klang.inc</AdditionalInputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4klang.inc</AdditionalInputs>
</CustomBuild>
<None Include="4klang.inc" />
<None Include="generic.vs" />
<None Include="mark.fs" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Shaders.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="main_release.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="glext.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Shaders.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="small.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="4klang.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="mark_small.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="generic.vs" />
<None Include="mark.fs" />
<None Include="4klang.inc">
<Filter>Header Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="release.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="4klang.asm">
<Filter>Source Files</Filter>
</CustomBuild>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,16 @@
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
call "build.cmd" 1.33 800 600 W
call "build.cmd" 1.88 960 510 W
call "build.cmd" 1.33 1024 768
call "build.cmd" 1.25 1280 1024
call "build.cmd" 1.77 1280 720
call "build.cmd" 1.6 1280 800
call "build.cmd" 1.33 1280 960
call "build.cmd" 1.55 1400 900
call "build.cmd" 1.33 1400 1050
call "build.cmd" 1.33 1600 1200
call "build.cmd" 1.6 1680 1050
call "build.cmd" 1.77 1920 1080
call "build.cmd" 1.6 1920 1200
call "build.cmd" 1.33 800 600

View File

@@ -0,0 +1,9 @@
IF [%4]==[W] GOTO :windowed
:fullscreen
cl /c @switches.txt /DASPECT=%1 /DSCREENWIDTH=%2 /DSCREENHEIGHT=%3 main_release.cpp
link @linkparams.txt /out:"final\custom\mirror_%2x%3.exe"
goto :end
:windowed
cl /c @switches.txt /DASPECT=%1 /DSCREENWIDTH=%2 /DSCREENHEIGHT=%3 /DWINDOWED main_release.cpp
link @linkparams.txt /out:"final\custom\mirror_%2x%3_window.exe"
:end

Binary file not shown.

View File

@@ -0,0 +1 @@
minify\shader_minifier.exe "mark.fs_0" -o mark_small.h -v

View File

@@ -0,0 +1,4 @@
minify\shader_minifier.exe "mark.fs_0" -o mark_0.h -v
minify\shader_minifier.exe "mark.fs_1" -o mark_1.h -v
minify\shader_minifier.exe "mark.fs_2" -o mark_2.h -v
minify\shader_minifier.exe "mark.fs_0" -o mark_small.h -v

View File

@@ -0,0 +1 @@
main_release.cpp

View File

@@ -0,0 +1,26 @@
BluFlame :-: Reflected
code :-: TGGC & xTr1m / BluFlame
music :-: xTr1m
gfx :-: TGGC & GRAPHICNOISE
packer :-: crinkler by Mentor/TBC and Blueberry/Loonies
synthesizer :-: 4klang by Gopher & pOWL of Alcatraz.
greets Approximate, ASD, Brainstorm, Calodox, CNCD, Ctrl+Alt+Test,
Conspiracy, Fairlight, Farbrausch, FRequency, Fuzzion,
Kakiarts, Haujobb, Loonies, Mercury, Nuance, Panda Cube,
Quite, RGBA, Speckdrumm, SQNY, Still, TBC, TBL, TRSi,
Titan, Traction, UF&DD, Youth Uprising
atla, BlueCobold, Hel, jco, mcdeck, matt|6s, netpoet, pro,
raYn, rapso, rip, TomasRiker, xardias,
anyone else from #gamedev.ger, #sppro and #cpp
We like to thank TBC/Loonies/Alcatraz for making their fantastic tools
available to the public.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

View File

@@ -0,0 +1,19 @@
varying vec4 Y;
varying vec2 Z;
void main()
{
Y = gl_Color;
Z = (gl_Vertex.xy*vec2(1.7777,1.0))*0.5+0.5;
gl_Position = gl_Vertex;
}
/*varying vec4 v;
varying vec2 m;
void main()
{
v = gl_Color;
m = (gl_Vertex.xy*vec2(1.7777,1.0))*0.5+0.5;
gl_Position = gl_Vertex;
}*/

7271
evoke-64k/evk13-4k/glext.h Normal file

File diff suppressed because it is too large Load Diff

BIN
evoke-64k/evk13-4k/link.exe Normal file

Binary file not shown.

View File

@@ -0,0 +1,28 @@
/CRINKLER
/COMPMODE:SLOW
/ORDERTRIES:3000
/HASHTRIES:200
/UNSAFEIMPORT
/TRUNCATEFLOATS:24
/HASHSIZE:200
/REPORT:report.html
/RANGE:opengl32
/TRANSFORM:CALLS
/ENTRY:main
/SUBSYSTEM:WINDOWS
obj\bp4k_Compress_Slow\main_release.obj
4klang.obj
opengl32.lib
winmm.lib
kernel32.lib
user32.lib
gdi32.lib
winspool.lib
comdlg32.lib
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib
odbccp32.lib

549
evoke-64k/evk13-4k/main.cpp Normal file
View File

@@ -0,0 +1,549 @@
//#define NOMUSICTIMING
#define MULTISHADER
#ifdef _DEBUG
#include <time.h>
#include <io.h>
#include <process.h>
#include "Shaders.h"
#else
#define WIN32_LEAN_AND_MEAN
#define WIN32_EXTRA_LEAN
#include <windows.h>
#include <stdio.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "glext.h"
#include "small.h"
#include "synth.h"
#ifdef NOMUSICTIMING
#include "Mmsystem.h"
#endif
#define V_Y "Y"
#define V_Z "Z"
#ifndef ASPECT
#define ASPECT 1.78
#endif
#ifndef SCREENWIDTH
#define SCREENWIDTH 1680
#endif
#ifndef SCREENHEIGTH
#define SCREENHEIGTH 1050
#endif
#define WINDOWED
#pragma data_seg(".Shader0")
#include "mark_small.h"
#define STR2(x) #x
#define STR(x) STR2(x)
#pragma data_seg(".vertexshader")
//static char* vsh = "varying vec4 Y;varying vec2 Z;void main(){Y=gl_Color;Z=(gl_Vertex.xy*vec2(Y.w,1))*.5+.5;gl_Position=gl_Vertex;}";
static char* vsh = "varying vec4 "V_Y";varying vec2 "V_Z";void main(){"V_Y"=gl_Color;"V_Z"=(gl_Vertex.xy*vec2("STR( ASPECT )",1))*.5+.5;gl_Position=gl_Vertex;}";
#endif
#ifdef _DEBUG
#define HALF_FAC 1
#pragma data_seg(".resolutionX")
static const int gi_ScreenWidth = 1280/HALF_FAC;
#pragma data_seg(".resolutionY")
static const int gi_ScreenHeight = 720/HALF_FAC;
#else
#pragma data_seg(".resolutionX")
static const int gi_ScreenWidth = SCREENWIDTH;
#pragma data_seg(".resolutionY")
static const int gi_ScreenHeight = SCREENHEIGTH ;
#endif
#ifdef _DEBUG
#pragma bss_seg(".debugnothing")
HANDLE gh_ShaderCompileEvent;
static char** gs_LastShader_;
static __time64_t gi_ShaderChangedDate;
static unsigned int gi_ShaderProgram;
static unsigned int gi_LastShaderProgram;
#pragma data_seg(".debuginfo")
static const char* gs_VertexShader = "generic.vs";
static const char* gs_ShaderFile = "mark.fs";
#endif
#pragma data_seg(".pfd")
static const PIXELFORMATDESCRIPTOR pfd={
0, 1, PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, 32, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 8
};
#pragma data_seg(".dms")
static DEVMODE dmScreenSettings={
"",0,0,sizeof(dmScreenSettings),0,DM_PELSWIDTH|DM_PELSHEIGHT,
0,0,0,0,0,0,0,0,0,0,0,0,0,"",0,0,gi_ScreenWidth,gi_ScreenHeight
};
#ifndef _DEBUG
#pragma code_seg(".compile")
__forceinline unsigned int compileShader(const char* vsh, const char* fsh)
{
GLuint s,p;
p = ((PFNGLCREATEPROGRAMPROC)wglGetProcAddress("glCreateProgram"))();
s = ((PFNGLCREATESHADERPROC)(wglGetProcAddress("glCreateShader")))(GL_VERTEX_SHADER);
((PFNGLSHADERSOURCEPROC)wglGetProcAddress("glShaderSource")) (s, 1, &vsh, NULL);
((PFNGLCOMPILESHADERPROC)wglGetProcAddress("glCompileShader"))(s);
((PFNGLATTACHSHADERPROC)wglGetProcAddress("glAttachShader")) (p,s);
s = ((PFNGLCREATESHADERPROC)wglGetProcAddress("glCreateShader"))(GL_FRAGMENT_SHADER);
((PFNGLSHADERSOURCEPROC)wglGetProcAddress("glShaderSource")) (s, 1, &fsh, NULL);
((PFNGLCOMPILESHADERPROC)wglGetProcAddress("glCompileShader"))(s);
((PFNGLATTACHSHADERPROC)wglGetProcAddress("glAttachShader")) (p,s);
((PFNGLLINKPROGRAMPROC)wglGetProcAddress("glLinkProgram"))(p);
#ifndef MULTISHADER
((PFNGLUSEPROGRAMPROC)wglGetProcAddress("glUseProgram"))(p);
#endif
return p;
}
#endif
#ifdef _DEBUG
#define CHECK_DEBUG_OUTPUT(shader) \
{\
GLint success = 0;\
glGetShaderiv(shader, GL_COMPILE_STATUS, &success);\
if (!success)\
{\
GLchar infoLog[16384];\
glGetShaderInfoLog(shader, 16384, NULL, infoLog);\
OutputDebugString(infoLog);\
}\
}
#else
#define CHECK_DEBUG_OUTPUT(shader)
#endif
#ifdef _DEBUG
DWORD WINAPI filemon(void* args)
{
while (true)
{
_finddata_t fdata;
long hfile = _findfirst(gs_ShaderFile, &fdata);
if (hfile != -1)
{
if (fdata.time_write != gi_ShaderChangedDate)
{
gi_ShaderChangedDate = fdata.time_write;
::SetEvent(gh_ShaderCompileEvent);
std::cout << "Shader loaded." << std::endl;
}
_findclose(hfile);
}
::Sleep(100);
}
return 0;
}
#include <cmath>
float g_DebugCamPos[ 3 ]= {0,2.0f,-5.0f};
float g_DebugCamRot[ 2 ]= {0,0};
bool g_ShaderDebug= true;
int g_ShaderID= 0;
int g_SceneID= 0;
int g_MaxSceneID= 16;
float g_fSqrAnimFac= 0.0f;
float g_fSpeedFac= 8.0f;
bool g_bForceCompile= true;
void MoveCam( float& fCurTime )
{
float fSpeed= 0.125f;
bool bShift= GetAsyncKeyState( VK_SHIFT ) || GetAsyncKeyState( VK_MBUTTON ) || GetAsyncKeyState( VK_RBUTTON );
bool bStrg= GetAsyncKeyState( VK_CONTROL ) != 0;
float a= g_DebugCamRot[ 0 ];
float b= g_DebugCamRot[ 1 ];
float g_Forward[ 3 ]= {sinf( a )*cosf(b),-sinf(b), cosf( a )*cosf(b)};
float g_Right[ 3 ]= {cosf( a ),0, -sinf( a )};
if( bShift )
{
if( GetAsyncKeyState( VK_HOME ) )
{
g_DebugCamPos[ 0 ]= 0.0f;
g_DebugCamPos[ 1 ]= 2.0f;
g_DebugCamPos[ 2 ]= -5.0f;
g_DebugCamRot[ 0 ]= 0.0f;
g_DebugCamRot[ 1 ]= 0.0f;
}
if( GetAsyncKeyState( 'W' ) )
{
g_DebugCamPos[ 0 ]+= fSpeed * g_Forward[ 0 ];
g_DebugCamPos[ 1 ]+= fSpeed * g_Forward[ 1 ];
g_DebugCamPos[ 2 ]+= fSpeed * g_Forward[ 2 ];
}
if( GetAsyncKeyState( 'S' ) )
{
g_DebugCamPos[ 0 ]-= fSpeed * g_Forward[ 0 ];
g_DebugCamPos[ 1 ]-= fSpeed * g_Forward[ 1 ];
g_DebugCamPos[ 2 ]-= fSpeed * g_Forward[ 2 ];
}
if( GetAsyncKeyState( 'A' ) )
{
g_DebugCamPos[ 0 ]-= fSpeed * g_Right[ 0 ];
g_DebugCamPos[ 1 ]-= fSpeed * g_Right[ 1 ];
g_DebugCamPos[ 2 ]-= fSpeed * g_Right[ 2 ];
}
if( GetAsyncKeyState( 'D' ) )
{
g_DebugCamPos[ 0 ]+= fSpeed * g_Right[ 0 ];
g_DebugCamPos[ 1 ]+= fSpeed * g_Right[ 1 ];
g_DebugCamPos[ 2 ]+= fSpeed * g_Right[ 2 ];
}
if( GetAsyncKeyState( 'F' ) )
{
g_DebugCamPos[ 1 ]+= fSpeed;
}
if( GetAsyncKeyState( 'V' ) )
{
g_DebugCamPos[ 1 ]-= fSpeed;
}
if( bStrg )
{
if( ( GetAsyncKeyState( VK_F2 ) & 1 ) != 0)
{
g_ShaderDebug= !g_ShaderDebug;
g_bForceCompile= true;
}
if( ( GetAsyncKeyState( VK_F3 ) & 1 ) != 0)
{
g_ShaderID= (g_ShaderID + MAX_SHADER_ID - 1 ) % MAX_SHADER_ID;
g_bForceCompile= true;
}
if( ( GetAsyncKeyState( VK_F4 ) & 1 )!= 0)
{
g_ShaderID= (g_ShaderID + MAX_SHADER_ID + 1 ) % MAX_SHADER_ID;
g_bForceCompile= true;
}
if( ( GetAsyncKeyState( VK_F7 ) & 1 ) != 0)
{
g_SceneID= (g_SceneID + g_MaxSceneID - 1 ) % g_MaxSceneID;
}
if( ( GetAsyncKeyState( VK_F8 ) & 1 )!= 0)
{
g_SceneID= (g_SceneID + g_MaxSceneID + 1 ) % g_MaxSceneID;
}
if( ( GetAsyncKeyState( VK_F9 ) & 1 ) != 0)
{
g_fSqrAnimFac-= 1.0f;
}
if( ( GetAsyncKeyState( VK_F10 ) & 1 )!= 0)
{
g_fSqrAnimFac+= 1.0f;
}
}
else
{
if( ( GetAsyncKeyState( VK_F6 ) & 1 )!= 0)
{
fCurTime= 0.0f;
}
if( ( GetAsyncKeyState( VK_F7 ) & 1 )!= 0)
{
g_fSpeedFac*= 2.0f;
if( g_fSpeedFac > 32.0f )
{
g_fSpeedFac= 32.0f;
}
}
if( ( GetAsyncKeyState( VK_F8 ) & 1 ) != 0)
{
g_fSpeedFac/= 2.0f;
if( g_fSpeedFac < 2.0f )
{
g_fSpeedFac= 2.0f;
}
}
}
}
static POINT OldCurPos;
POINT CurPos;
GetCursorPos( &CurPos );
if( bShift )
{
g_DebugCamRot[ 0 ]-= 0.003f * ( OldCurPos.x - CurPos.x );
g_DebugCamRot[ 1 ]-= 0.003f * ( OldCurPos.y - CurPos.y );
g_DebugCamRot[ 1 ]= max( g_DebugCamRot[ 1 ], -1.56f );
g_DebugCamRot[ 1 ]= min( g_DebugCamRot[ 1 ], 1.56f );
}
OldCurPos= CurPos;
}
LRESULT MessageCallback(HWND ar_Handle, UINT aw_Message, WPARAM aw_Param, LPARAM al_Param)
{
return DefWindowProc(ar_Handle, aw_Message, aw_Param, al_Param);
}
#endif
int gCurScene= 0;
int gCurSceneStart= 0;
#pragma data_seg(".g_SceneLength")
int g_SceneLength[]=
{
16, 16, 16,
16, 16, 16,
16, 32, 16,
16, 16, 16,
0x80000000
};
#pragma data_seg(".g_SceneShader")
int g_SceneShader[]=
{
0,0,0,
1,1,1,
2,2,2,
3,3,3,
};
#pragma data_seg(".g_SceneFactor")
float g_SceneFactor[]=
{
0, 0, 0,
0, 0, 1.0f,
0, 0, 1.0f,
0, 1.0f, 1.0f,
0,
};
#ifndef _DEBUG
#pragma code_seg(".main")
#endif
void _cdecl main()
{
#ifdef _DEBUG
//ChangeDisplaySettings (&dmScreenSettings,CDS_FULLSCREEN);
//HDC hDC = GetDC(CreateWindow("edit", 0, WS_POPUP | WS_VISIBLE | WS_MAXIMIZE, 0, 0, 0, 0, 0, 0, 0, 0));
//HWND hWnd = CreateWindow("MDICLIENT", "Test", WS_OVERLAPPED | WS_VISIBLE | WS_SYSMENU, 0, 0, gi_ScreenWidth, gi_ScreenHeight, 0, 0, 0, 0);
WNDCLASSEX wndclass;
wndclass.cbSize = sizeof (wndclass) ;
wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wndclass.lpfnWndProc = (WNDPROC)MessageCallback ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = NULL ;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (DKGRAY_BRUSH) ;
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = "Window" ;
wndclass.hIconSm = LoadIcon (NULL, IDI_APPLICATION) ;
RegisterClassEx(&wndclass);
HWND hWnd = CreateWindow(
"Window", /* Classname */
"Title", /* Title Text */
WS_EX_APPWINDOW, /* default window */
10, /* Windows decides the position */
30, /* where the window ends up on the screen */
gi_ScreenWidth, /* The programs width */
gi_ScreenHeight, /* and height in pixels */
NULL, /* The window is a child-window to desktop */
NULL, /* No menu */
GetModuleHandle(NULL), //GetModuleHandle(NULL), /* Program Instance handler */
NULL /* No Window Creation data */
);
HDC hDC = GetDC(hWnd);
SetPixelFormat(hDC, ChoosePixelFormat(hDC, &pfd), &pfd);
wglMakeCurrent(hDC, wglCreateContext(hDC));
initShaders();
gh_ShaderCompileEvent = ::CreateEvent(NULL, FALSE, FALSE, TEXT("WriteEvent"));
SetThreadPriority((HANDLE)CreateThread(0, 0, &filemon, 0, 0, 0), THREAD_PRIORITY_BELOW_NORMAL);
ShowWindow (hWnd , SW_NORMAL );
::Sleep(100);
#else
#ifndef WINDOWED
ChangeDisplaySettings (&dmScreenSettings,CDS_FULLSCREEN);
HDC hDC = GetDC(CreateWindow("edit", 0, WS_POPUP | WS_VISIBLE | WS_MAXIMIZE, 0, 0, 0, 0, 0, 0, 0, 0));
#else
HDC hDC = GetDC(CreateWindow("static", "RED", WS_EX_APPWINDOW | WS_VISIBLE | WS_SYSMENU, 0, 0, gi_ScreenWidth, gi_ScreenHeight, 0, 0, 0, 0));
#endif
SetPixelFormat(hDC, ChoosePixelFormat(hDC, &pfd), &pfd);
wglMakeCurrent(hDC, wglCreateContext(hDC));
#ifdef MULTISHADER
unsigned int shaders[4];
mark_fs_0[6]= '0';
shaders[0]=compileShader(vsh, mark_fs_0 ),
mark_fs_0[6]= '1';
shaders[1]=compileShader(vsh, mark_fs_0 ),
mark_fs_0[6]= '2';
shaders[2]=compileShader(vsh, mark_fs_0 ),
mark_fs_0[6]= '3';
shaders[3]=compileShader(vsh, mark_fs_0 ),
#else
compileShader(vsh, mark_fs_0 );
#endif
ShowCursor(FALSE);
#endif
#ifdef _DEBUG
if (::WaitForSingleObject(gh_ShaderCompileEvent, 0) == WAIT_OBJECT_0)
{
::Sleep(250);
gi_ShaderProgram = createProgram(
createVertexShader(gs_VertexShader),
createFragmentShader(gs_ShaderFile, g_ShaderID, g_ShaderDebug ));
((PFNGLUSEPROGRAMPROC)wglGetProcAddress("glUseProgram"))(gi_ShaderProgram);
PrintErrors();
}
glColor4f(0,0,0,0);
glRectf(-1, -1, 1, 1);
SwapBuffers(hDC);
#endif
#ifndef _DEBUG
InitSound();
#else
LARGE_INTEGER li_OldTime = { 0 };
#endif
#ifdef NOMUSICTIMING
int iStartTick= timeGetTime();
#endif
float lf_Time= 0.0f;
do
{
#ifdef _DEBUG
MSG msg;
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT)
return;
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
if (::WaitForSingleObject(gh_ShaderCompileEvent, 0) == WAIT_OBJECT_0 || g_bForceCompile)
{
::Sleep(50);
gi_ShaderProgram = createProgram(
createVertexShader(gs_VertexShader),
createFragmentShader(gs_ShaderFile, g_ShaderID, g_ShaderDebug));
((PFNGLUSEPROGRAMPROC)wglGetProcAddress("glUseProgram"))(gi_ShaderProgram);
PrintErrors();
g_bForceCompile= false;
}
#endif
//int Sample= get_Sample() - gCurSceneStart;
int SceneEnd= g_SceneLength[ gCurScene ] * (44100 * 60 / 145);//samples per tick
//lf_Time = get_Time() * 71.0f / 240.0f;
#ifdef NOMUSICTIMING
lf_Time = ( timeGetTime() - iStartTick ) * 0.001f / 16.0f;
#endif
glLoadIdentity();
#ifdef _DEBUG
LARGE_INTEGER li_CurrentTime, li_CurrentFrequency;
QueryPerformanceCounter(&li_CurrentTime);
QueryPerformanceFrequency(&li_CurrentFrequency);
//lf_Time = (float)li_CurrentTime.QuadPart / (float)li_CurrentFrequency.QuadPart;
float lf_DiffTime = (float)(li_CurrentTime.QuadPart - li_OldTime.QuadPart) / (float)li_CurrentFrequency.QuadPart;
char windowText[255];
sprintf_s(
windowText,
"Shader: %d Scene: %d AnimFac: %2.2f FPS: %.2f, Render time: %.4fms",
g_ShaderID,
g_SceneID,
g_fSqrAnimFac,
1.0f / lf_DiffTime,
lf_DiffTime );
::SetWindowTextA(hWnd, windowText);
li_OldTime = li_CurrentTime;
lf_Time+= lf_DiffTime * 145.0f / 60.0f / g_fSpeedFac;
if( lf_Time > 1.0f )
{
lf_Time= 0.0f;
}
float fBeat = lf_Time * 16.0f;
while( fBeat > 1.0f )
{
fBeat-= 1.0f;
}
if( fBeat < 0.0f)
{
fBeat = 0.0f;
}
fBeat = pow( 10.0f, 4.0f * -fBeat );
glColor3f((float)g_SceneID + lf_Time, fBeat, fBeat);
#else
#ifdef MULTISHADER
((PFNGLUSEPROGRAMPROC)wglGetProcAddress("glUseProgram"))(shaders[ g_SceneShader[ gCurScene ] ]);
#endif
lf_Time= (float)Sample / (float)SceneEnd;
glColor4f((float)gCurScene+lf_Time, lf_Time * lf_Time * g_SceneFactor[ gCurScene ], 0.0f,0.0f);
#endif
#ifdef _DEBUG
MoveCam( lf_Time );
float fDebugData[ 16 ];
fDebugData[ 0 ]= g_DebugCamPos[ 0 ];
fDebugData[ 1 ]= g_DebugCamPos[ 1 ];
fDebugData[ 2 ]= g_DebugCamPos[ 2 ];
fDebugData[ 4 ]= g_DebugCamRot[ 0 ];
fDebugData[ 5 ]= g_DebugCamRot[ 1 ];
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf((GLfloat*)&fDebugData);
#endif
glRects(-1, -1, 1, 1);
SwapBuffers(hDC);
#ifndef _DEBUG
if( Sample > SceneEnd )
{
gCurSceneStart+= SceneEnd;
gCurScene++;
}
#endif
}
#ifdef _DEBUG
while ( !GetAsyncKeyState(VK_ESCAPE) );
#else
while ( g_SceneLength[ gCurScene ] > 0 && !GetAsyncKeyState(VK_ESCAPE) );
#endif
ExitProcess(0);
}

View File

@@ -0,0 +1,453 @@
#define WIN32_LEAN_AND_MEAN
#define WIN32_EXTRA_LEAN
#include <windows.h>
#include <stdio.h>
#include <mmsystem.h>
#include <mmreg.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "glext.h"
#include "small.h"
#include "4klang.h"
#define ULTRA
#pragma data_seg(".Shader0")
#include "mark_small.h"
/*******************************************************/
/* config flags */
//#define DESKTOP_RESOLUTION
//#define WINDOWED
#define CHANGERES_DELAY
#define CLEAR_SCREEN_WHILE_LOADING
#define SHADER_WARMUP
/* end config flags */
/*******************************************************/
#ifndef DESKTOP_RESOLUTION
#ifndef ASPECT
#define ASPECT 1.77
#endif
#ifndef SCREENWIDTH
#define SCREENWIDTH 1920
#endif
#ifndef SCREENHEIGHT
#define SCREENHEIGHT 1080
#endif
#else
// default aspect ratio for when using the desktop resolution
#ifndef ASPECT
#define ASPECT 1.77
#endif
#endif
#define USE_SOUND_THREAD
#define STR2(x) #x
#define STR(x) STR2(x)
#pragma data_seg(".vertexshader")
static char* vertexShader = "varying vec4 "I_Y";varying vec2 "I_Z";void main(){"I_Y"=gl_Color;"I_Z"=(gl_Vertex.xy*vec2("STR(ASPECT)",1))*.5+.5;gl_Position=gl_Vertex;}";
static char** vsh = &vertexShader;
static char* pixelShader = (char*)mark_fs_0;
static char** fsh = &pixelShader;
#pragma data_seg(".pfd")
static const PIXELFORMATDESCRIPTOR pfd={
0, 1, PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8
};
#ifndef DESKTOP_RESOLUTION
#pragma data_seg(".dms")
static DEVMODE dmScreenSettings={
"",0,0,sizeof(dmScreenSettings),0,DM_PELSWIDTH|DM_PELSHEIGHT,0,0,0,0,0,0,0,0,0,0,0,0,0,"",0,0,SCREENWIDTH,SCREENHEIGHT
};
#endif
#pragma bss_seg(".mainbss")
static SAMPLE_TYPE lpSoundBuffer[MAX_SAMPLES*2];
static HWAVEOUT hWaveOut;
static unsigned int shaders[5];
#pragma data_seg(".wavefmt")
WAVEFORMATEX WaveFMT =
{
#ifdef FLOAT_32BIT
WAVE_FORMAT_IEEE_FLOAT,
#else
WAVE_FORMAT_PCM,
#endif
2, // channels
SAMPLE_RATE, // samples per sec
SAMPLE_RATE*sizeof(SAMPLE_TYPE)*2, // bytes per sec
sizeof(SAMPLE_TYPE)*2, // block alignment;
sizeof(SAMPLE_TYPE)*8, // bits per sample
0 // extension not needed
};
#pragma data_seg(".wavehdr")
WAVEHDR WaveHDR =
{
(LPSTR)lpSoundBuffer,
MAX_SAMPLES*sizeof(SAMPLE_TYPE)*2,
0, 0, 0, 0, 0, 0
};
#pragma data_seg(".mmtime")
MMTIME MMTime =
{
TIME_SAMPLES,
0
};
#pragma data_seg(".maindata")
const float sceneLength = 64 * SAMPLES_PER_TICK;
const int shaderLength = 4 * 64 * SAMPLES_PER_TICK;
#pragma data_seg(".windowClass")
const char* edit = "edit";
#pragma data_seg(".glFunctions")
const char* glUseProgram = "glUseProgram";
const char* glCreateProgram = "glCreateProgram";
const char* glCreateShader = "glCreateShader";
const char* glShaderSource = "glShaderSource";
const char* glCompileShader = "glCompileShader";
const char* glAttachShader = "glAttachShader";
const char* glLinkProgram = "glLinkProgram";
#pragma code_seg(".initsnd")
__forceinline void InitSound()
{
_asm
{
#ifdef USE_SOUND_THREAD
push ESI
push ESI
push offset [lpSoundBuffer]
push dword ptr [_4klang_render]
push ESI
push ESI
call dword ptr [CreateThread]
#else
push offset [lpSoundBuffer]
push dword ptr [_4klang_render]
#endif
push ESI
push ESI
push ESI
push offset [WaveFMT]
push -0x1
push offset [hWaveOut]
call dword ptr [waveOutOpen]
push 0x20
push offset [WaveHDR]
push dword ptr [hWaveOut]
push 0x20
push offset [WaveHDR]
push dword ptr [hWaveOut]
call dword ptr [waveOutPrepareHeader]
call dword ptr [waveOutWrite]
}
}
#pragma code_seg(".envelope")
float get_Envelope(int instrument)
{
return (&_4klang_envelope_buffer)[(((MMTime.u.sample) >> 8) << 5) + POLYPHONY*instrument]; // the last number is the instrument
}
#pragma code_seg(".sample")
int get_Sample()
{
waveOutGetPosition(hWaveOut, &MMTime, sizeof(MMTIME));
return MMTime.u.sample;
}
#pragma code_seg(".compile")
unsigned int compileShader()
{
_asm
{
push glCreateProgram
call dword ptr [wglGetProcAddress]
call eax
mov ebx, eax
push ebx
push glLinkProgram
push GL_FRAGMENT_SHADER
push glCreateShader
push GL_VERTEX_SHADER
push glCreateShader
call dword ptr [wglGetProcAddress]
call eax
push eax
push ebx
push glAttachShader
push eax
push glCompileShader
push esi
push vsh
push 1
push eax
push glShaderSource
call dword ptr [wglGetProcAddress]
call eax
call dword ptr [wglGetProcAddress]
call eax
call dword ptr [wglGetProcAddress]
call eax
call dword ptr [wglGetProcAddress]
call eax
push eax
push ebx
push glAttachShader
push eax
push glCompileShader
push esi
push fsh
push 1
push eax
push glShaderSource
call dword ptr [wglGetProcAddress]
call eax
call dword ptr [wglGetProcAddress]
call eax
call dword ptr [wglGetProcAddress]
call eax
call dword ptr [wglGetProcAddress]
call eax
mov eax, ebx
}
}
// Aufbau der musik:
// Teil / Dauer in Szenen
// ----------------------
// Intro / 2
// A-Teil / 4
// B-Teil / 4
// A-Teil / 4
// Outro / 3 (wobei die letzte Szene für fade-out dienen soll)
#pragma code_seg(".main")
void _cdecl main()
{
register HDC hDC;
_asm
{
xor esi,esi
push esi //ShowCursor
push esi //CreateWindowExA
push esi
push esi
push esi
#ifdef DESKTOP_RESOLUTION
push esi
push esi
#else
#ifdef WINDOWED
push SCREENHEIGHT
push SCREENWIDTH
#else
push esi
push esi
#endif
#endif
push esi
push esi
#ifdef DESKTOP_RESOLUTION
push WS_POPUP | WS_VISIBLE | WS_MAXIMIZE
#else
#ifdef WINDOWED
push WS_POPUP | WS_VISIBLE
#else
push WS_POPUP | WS_VISIBLE | WS_MAXIMIZE
#endif
#endif
push esi
push edit
push esi
#ifndef WINDOWED
#ifndef DESKTOP_RESOLUTION
push 4 //ChangeDisplaySettings
push offset [dmScreenSettings]
call dword ptr [ChangeDisplaySettings]
#endif
#endif
call dword ptr [CreateWindowExA]
push eax
call dword ptr [GetDC]
mov hDC, eax
mov eax, offset [pfd]
push eax
push eax
push hDC
call dword ptr [ChoosePixelFormat]
push eax
push hDC
call dword ptr [SetPixelFormat]
push hDC
call dword ptr [wglCreateContext]
push eax
push hDC
call dword ptr [wglMakeCurrent]
mov ebx, offset [shaders]
mov edi, offset [mark_fs_0] + 12
call dword ptr[compileShader]
mov dword ptr[ebx], eax
inc dword ptr[edi]
add ebx, 4
call dword ptr[compileShader]
mov dword ptr[ebx], eax
inc dword ptr[edi]
add ebx, 4
call dword ptr[compileShader]
mov dword ptr[ebx], eax
inc dword ptr[edi]
add ebx, 4
call dword ptr[compileShader]
mov dword ptr[ebx], eax
inc dword ptr[edi]
add ebx, 4
mov dword ptr[ebx], eax
call dword ptr[ShowCursor]
#ifdef CHANGERES_DELAY
push 2048 // delay time in milliseconds
#endif
#ifdef CLEAR_SCREEN_WHILE_LOADING
push hDC
push 1 // glRects
push 1
push -1
push -1
push esi
push esi
push esi
call dword ptr[glColor3f]
call dword ptr[glRects]
call dword ptr[SwapBuffers]
#endif
#ifdef CHANGERES_DELAY
call dword ptr [Sleep]
#endif
}
#ifdef SHADER_WARMUP
_asm
{
push 1 // glRects
push 1
push -1
push -1
push dword ptr [shaders+12] // glUseProgram
push dword ptr [glUseProgram] // wglGetProcAddress
push 1 // glRects
push 1
push -1
push -1
push dword ptr [shaders+8] // glUseProgram
push dword ptr [glUseProgram] // wglGetProcAddress
push 1 // glRects
push 1
push -1
push -1
push dword ptr [shaders+4] // glUseProgram
push dword ptr [glUseProgram] // wglGetProcAddress
push 1 // glRects
push 1
push -1
push -1
push dword ptr [shaders+0] // glUseProgram
push dword ptr [glUseProgram] // wglGetProcAddress
call dword ptr [wglGetProcAddress]
call eax
call dword ptr[glRects]
call dword ptr [wglGetProcAddress]
call eax
call dword ptr[glRects]
call dword ptr [wglGetProcAddress]
call eax
call dword ptr[glRects]
call dword ptr [wglGetProcAddress]
call eax
call dword ptr[glRects]
}
#endif
_asm call dword ptr[InitSound]
while (true)
{
_asm
{
push PM_REMOVE // PeekMessageA
push esi
push esi
push esi
push esi
push hDC // SwapBuffers
push 1 // glRects
push 1
push -1
push -1
push esi //glColor3f
push esi
push esi
}
if (get_Sample() >= MAX_TICKS * SAMPLES_PER_TICK)
break;
_asm
{
mov dword ptr [esp],eax
cdq
div dword ptr [shaderLength]
mov ebx, eax
fild dword ptr [esp]
fdiv dword ptr [sceneLength]
fstp dword ptr [esp]
push 2
call dword ptr [get_Envelope]
fstp dword ptr [esp+4]
push 6
call dword ptr [get_Envelope]
fstp dword ptr [esp+8]
call dword ptr [glColor3f]
push dword ptr [ebx*4+shaders]
push dword ptr [glUseProgram]
call dword ptr [wglGetProcAddress]
call eax
call dword ptr[glRects]
call dword ptr[SwapBuffers]
call dword ptr[PeekMessageA]
}
if (GetAsyncKeyState(VK_ESCAPE))
break;
}
ExitProcess(0);
}

518
evoke-64k/evk13-4k/mark.fs Normal file
View File

@@ -0,0 +1,518 @@
#version 130
@0
const int shader= 0;
@@
@1
const int shader= 1;
@@
@2
const int shader= 2;
@@
@3
const int shader= 3;
@@
// Parameters from our host
// x: Scene.Zeit
// y: Base drum envelope
// z: Snare drum envelope
// w: undefinded
in vec4 Y;
// Position of the fragment
in vec2 Z;
// All data of our world
float L, CurScene, CurTime, CurAnim, cFac, CurStep, VolLight, pi2= 6.28319, LightHeight = 50.0;
int m;
vec3 cRes, CurColor, RayStep;
vec2 rotate(vec2 v,float y)
{
return cos(y)*v+sin(y)*vec2(-v.y,v.x);
}
//repeat around y axis w times
//void rp(inout vec3 p, float trans, float w)
float repeatr(inout vec2 v,float x, float y)
{
float a= atan(v.y,v.x);
float z=mod(a,y)-y*.5;
v=(length(v))*vec2(cos(z),sin(z));
v.x-=x;
return a-z;
}
void repeat( inout float w, float y )
{
w= mod( w - y*.5, y ) - y*.5;
}
void repeate( inout float w, float y, float z )
{
w= max( abs(w)-z, mod( w - y*.5, y ) - y*.5);
}
float CBox( in vec3 p, in vec3 box, float rad )
{
return length( max( abs(p) - box + vec3(rad), 0.0 ) ) - rad;
}
float plasm(float x, float a, float b,float c)
{
return sin(x+a+c*sin(x+b));
}
vec3 shad2move()
{
return vec3( CurTime*19.0, 24.0 - cos(CurAnim*9.0) * 8.0, cos(CurAnim*5.0) * 24.0);
}
void schad3transform( inout vec3 p )
{
p.xz = rotate(p.xz, 0.2 * cos( pow(abs(p.x),0.4 - CurTime * 0.1)) );
p.yx = rotate(p.yx, 0.2 * cos( pow(abs(p.x),0.3 + CurTime * 0.1)) );
}
float f0(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
repeat(p.x, 0.5);
return max( length(p.x) - 0.1, CBox( p, vec3(1000.,1.4,1.4), .5));
}
if( shader == 1 )
{
p -= shad2move();
//p.y = rotate(p.yz, 50. *CurAnim );
p.x = length (p.xz)+4*Y.y - 12.5;
repeat (p.x, 24.0);
return length( max( abs(p.xy) - vec2(3., .2), 0.0 ) ) - 0.2;
}
if( shader == 2 )
{
p.y += plasm(
0.1 * p.x,
0.1 * p.z,
CurTime* 10.0,
1.0 );
float d = p.x;
repeat(p.x, pi2);
p.y -= 0.3 * cos( (p.z + d - p.x)*.5);
p.z += 128.0 * CurTime * cos(0.7 * (d-p.x) );
repeat(p.z, 2.4);
return CBox( p, vec3(1.0, 0.1, 1.0), 0.1);
}
if( shader == 3 )
{
p.x -= 128. * CurAnim;
repeat(p.x, 64.);
p.x = length( p.x ) - 11.;
return (p.x < 0.0 ? length( p.yz ): length( p )) - 5.0 ;
}
}
float f1(vec3 p)
{
if( shader == 0 )
{
float d = p.y - 5.;
p.x *= 1.0;
repeat(p.x, 20.);
repeatr(p.yz, 28.0, pi2 / 9.0);
return max( d, CBox( p, vec3(10.,2.0,10.), 3.));
}
if( shader == 1 )
{
vec3 o= p;
repeat(p.x, 8.0);
repeat(p.z, 8.0);
o -= shad2move();
p.xz = rotate(p.xz, atan(o.x, o.z) );
p.yz = rotate(p.yz, atan(length(o.xz), 48.0) );
float d = CBox( p, vec3(2.5 , 2.0, 2.5), 0.8);
p.y += 12. + plasm(
0.1 * o.x,
0.1 * o.z,
CurTime* 10.0,
1.0 );
return max(d, length(p)- 12.);
}
if( shader == 2 )
{
p.y += plasm(
0.1 * p.x,
0.1 * p.z,
CurTime* 10.0,
1.0 );
float d = p.z;
repeat(p.z, pi2);
p.y += 0.3 * cos( (p.x + d - p.z)*.5);
return CBox( p, vec3(1000.0, 0.1, 2.0), 0.1);
}
if( shader == 3 )
{
p.z = length(p.z) + 15.;
float d = length(p.y) - 15.;
repeat(p.x, 100.);
//repeat(p.y, 9.);
float f = 2.+ plasm(
5.0 * repeatr(p.zy, 85.0, pi2 / 40.0),
6.0 * repeatr(p.zx, 55.0, pi2 / 50.0),
CurTime * 20.0,
1.0 );
return max( d, CBox( p, vec3(4.,3.,f), 1.)); //max( length(p) - 64., CBox( p, vec3(4.,4.,80.), 1.));
}
}
float f2(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
p.x += 256.0 * CurAnim;
repeat(p.x, 32.0);
return length(vec2(length(p.yz) - 3.0,p.x)) - 1.- Y.y;
}
if( shader == 1 )
{
return length(p-shad2move()) - 12.0;
}
if( shader == 2 )
{
p.y -= 8.;
float d = p.x;
repeat(p.x, 32.0);
p.yz = rotate(p.yz, plasm(d-p.x, 2., CurAnim, 1.0)- Y.z );
p.xz = rotate(p.xz, plasm(d-p.x, 1., CurAnim, 2.0) );
return CBox( p, vec3(8.0), 6. - CurAnim);
}
if( shader == 3 )
{
p.yz = rotate(p.yz, plasm(round(p.x / 8.0), 1., 4.0*CurTime, 2.0) );
repeat(p.x, 8.0);
repeatr(p.yz, 0.0, pi2 / 10.0);
return max( abs(length(p.yz) - 6.0)-.2, abs(length(p.xz) - 2.+0.5*Y.y)-.3);
}
}
float f3(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
return CBox( p, vec3(1000.,1.,1.), .1);
}
if( shader == 1 )
{
p.y += 20.;
repeat( p.x, 6.3);
repeat( p.z, 1.3);
//repeatr(p.xz, .0, pi2 / 4.0);
return CBox( p, vec3(3.0, 15.0, 0.5), 0.4);
}
if( shader == 2 )
{
p.y -= 20.;
repeat( p.x, 20.0);
repeat( p.z, 20.0);
repeatr(p.xz, .0, pi2 / 4.0);
return CBox( p, vec3(1000.0, 1.0, 1.0), 0.2);
}
if( shader == 3 )
{
repeat(p.z, 6.);
repeat(p.x, 5.5);
repeatr(p.xz, 2.0, pi2 / 6.0);
return max( abs(1.-length(p.xz))-0.1,abs(length(p.y)-15.0)-0.1);
}
}
float f(vec3 p)
{
return (0.003 - Y.y * 0.007) * plasm(p.x+Y.y*9., p.y, p.z, 1.0-Y.y) + min( min( min( f0(p), f1(p) ), f2(p) ), f3(p) );
}
float l(vec2 p)
{
float d = floor(0.5 - p.y/32.0) + floor(0.5 - p.x/70.0) * 3.;
if( shader == 1 || shader == 2 )
{
d= plasm( 33.0 * floor(0.5 - p.y/20.0), 5.0 * floor(0.5 - p.x/20.0), 17.0 * floor(CurTime * 16.0 + 0.5), 1.0);
repeate( p.x, 20.0, 60.0 );
repeat( p.y, 20.0);
L = length( max( abs(p) - vec2(3.0), 0.0 ) ) + 2.5;// max( length(p.x), length(p.y));
if (d > 0.5)
L += 2.0*Y.y;
}
else
{
repeate( p.y, 32.0, 32.0 );
repeat( p.x, 70.0 );
p.x = length(p.x) - 25.0;
L = 2.0 - Y.z + (p.x < 0. ? length(p.y) : length(p));
}
if( CurScene == 0 )
return max(0.0, 4.0 * smoothstep(10.,-pow(sin(d+CurTime*10.0*CurTime*220.0)+sin(d)+CurTime*10.0-4.0,.2),L));
return 4.0 * smoothstep(10.,0.0,L);
}
void mat(vec3 p)
{
CurColor = vec3(0.,.65,.2 );
//CurColor = vec3(1.0,.3,0.9 );
CurStep= .3;
//CurNormal.y= 1.5;
float z= f0(p);
if( z > f1(p) )
{
z= f1(p);
CurColor = vec3(0.1);
CurStep= 0.85;
//CurNormal.y= 0.15;
}
if( z > f2(p) )
{
z= f2(p);
CurColor = vec3(1.0,.0,0.0 );
//CurColor = vec3(0.1,1.0,.0 );
CurStep= .2;
//CurNormal.y= 0.0;
}
if( z > f3(p) )
{
//Wz= f3(p);
CurColor = vec3(.25);// + animTex(p.zy / 10.0) * 0.6;
CurStep= .1;
m=2;
}
}
void ToRes(vec3 Color, float Factor)
{
cRes+= Color * cFac;
cFac*= Factor;
}
void main()
{
CurScene= floor(Y.x);
CurTime= Y.x - CurScene;
CurAnim= CurTime;
// Get the look direction for the current pixel (always look forwards)
vec3 rayDir = vec3( 0.6, (Z.yx - 0.5));
//Kamera sitzt an dieser Position
vec3 p;
if( CurScene == 0.0 )
{
p= vec3( CurTime * 120. - 120. , -24.0, .0);
rayDir.xy= rotate( rayDir.xy, CurTime - 0.9 );
//rayDir.xz= rotate( rayDir.xz, CurTime );
//rayDir.yz= rotate( rayDir.yz, 0.9 - CurTime );
}
else if( CurScene == 1.0 )
{
p= vec3( 0., 5.0, -2.0);
rayDir.xy= rotate( rayDir.xy, -0.4 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= CurTime*CurTime;
}
else if( CurScene == 2.0 )
{
p= vec3( -CurTime * 200. + 140, -2., 5.0);
rayDir.xy= rotate( rayDir.xy, CurTime-0.8 );
rayDir.xz= rotate( rayDir.xz, 3.14 );
}
else if( CurScene == 3.0 )
{
p= vec3( -25. , 0., CurTime * 20.0 - 19.0);
rayDir.xy= rotate( rayDir.xy, -0.2 );
}
else if( CurScene == 4.0 )
{
p= vec3( 0., 40.0, CurTime *8.);
rayDir.xy= rotate( rayDir.xy, -CurTime );
CurAnim= 0;
}
else if( CurScene == 5.0 )
{
p= vec3( 0., 40.0, CurTime * -64. + 56.);
rayDir.xy= rotate( rayDir.xy, -1.0 );
CurAnim= 0.4*CurTime*CurTime;
}
else if( CurScene == 6.0 )
{
p= vec3( 0., 12.0, CurTime * -12.0);
rayDir.xy= rotate( rayDir.xy, CurTime - 1.5);
rayDir.xz= rotate( rayDir.xz, CurTime );
}
else if( CurScene == 7.0 )
{
p= vec3( -4., CurTime * 64. + 4.0, 0.);
rayDir.xy= rotate( rayDir.xy, -1.0 );
rayDir.xz= rotate( rayDir.xz, -CurTime );
}
else if( CurScene == 8.0 )
{
p= vec3( 8.0, 8.0, CurTime * 24. - 32.);
rayDir.xy= rotate( rayDir.xy, -0.3 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= 0;
}
else if( CurScene == 9.0 )
{
p= vec3( CurTime * 14., 18.0, 0.);
rayDir.xy= rotate( rayDir.xy, -CurTime-0.5 );
CurAnim= CurTime*CurTime;
}
else if( CurScene == 10.0 )
{
p= vec3( 2.0, CurTime * 4. + 2.0, CurTime * 12.+ 7.);
rayDir.xy= rotate( rayDir.xy, -0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime );
}
else if( CurScene == 11.0 )
{
p= vec3( CurTime * 70. - 80., CurTime * -4. + 6.0, CurTime * 64.- 56.);
rayDir.xy= rotate( rayDir.xy, -0.2 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= 4.*CurTime;
}
else if( CurScene == 12.0 )
{
p= vec3( 30.,-8.,-8.);
rayDir.xy= rotate( rayDir.xy, 0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime + 3.0 );
CurAnim= 0.4*CurTime*CurTime;
}
else if( CurScene == 13.0 )
{
p= vec3( -60.,12.,0.);
rayDir.xy= rotate( rayDir.xy, CurTime - 1.5 );
}
else if( CurScene == 14.0 )
{
p= vec3( -22.,0.,-8.);
//rayDir.xy= rotate( rayDir.xy, 0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime + 2.0 );
//CurAnim= 0.4*Y.y;
}
else if( CurScene == 15.0 )
{
p= vec3( 80. * CurTime, 7. ,-0.);
rayDir.xz= rotate( rayDir.xz, 3.*CurTime );
}
if( CurScene == 16.0 )
{
p.x = 43.0;
rayDir.xz= rotate( rayDir.xz, pi2/2.);
CurAnim= CurTime*CurTime;
}
@D
/////////////////////////////////////////////////////////////////////
//Debugzeug fuer Kamerasteuerung
if( true )
{
p.x= gl_ModelViewMatrix[0][0];
p.y= gl_ModelViewMatrix[0][1];
p.z= gl_ModelViewMatrix[0][2];
float a1= gl_ModelViewMatrix[1][1];
float c1,s1;vec3 q1= vec3((Z.xy - 0.5), 0.8);
c1 = cos(a1); s1 = sin(a1);
rayDir.y = c1 * q1.y - s1 * q1.z;
rayDir.x= q1.x;
rayDir.z = s1 * q1.y + c1 * q1.z;
a1= gl_ModelViewMatrix[1][0];
q1=rayDir;
c1 = cos(a1); s1 = sin(a1);
rayDir.x = c1 * q1.x + s1 * q1.z;
rayDir.z = -s1 * q1.x + c1 * q1.z;
}
//Ende Debugzeug fuer Kamerasteuerung
/////////////////////////////////////////////////////////////////////
@@
rayDir = normalize(rayDir);
cRes= vec3( .0 );
cFac=1.0;
float t=0.0,y,z;
m=0;
while (m++<2)
{
//bis zu einer Oberflaeche steppen
//for (CurStep=1.0;t<220.0 && CurStep>t*.003;t+=0.01+max(0.0, CurStep),RayStep=rayDir*t )
for (CurStep=1.0;t<220.0 && CurStep>t*.003;t+=CurStep,RayStep=rayDir*t )
CurStep = f(p+RayStep);
vec3 NextPos = p+RayStep;
VolLight = 0.0;
if( p.y < LightHeight && NextPos.y > LightHeight)
{
float f = (p.y - LightHeight) / (p.y - NextPos.y);
p += RayStep*f;
VolLight = l(p.xz) * smoothstep( 220.0,0.0, f * t );
}
//Startpunkt und Richtung fuer reflektierten Strahl;
p= NextPos;
vec3 n = vec3(0.04, 0.0, 0.0);
n= normalize(vec3( f(p + n.xyy) - f(p - n.xyy), f(p + n.yxy) - f(p - n.yxy), f(p + n.yyx) - f(p - n.yyx) ));
//n= normalize(n);
//CurStep ab hier == Reflektion !!!
mat(p);
float Ambient= 0.45 + 0.4 * dot( n,vec3(0,1.0,0) );
ToRes(vec3(0.7,1.0,0.9)*VolLight,1.0-VolLight);
L= smoothstep( 0.,128., t );
ToRes(vec3( 0.0, 0.0, 0.05 )*L,1.0-L); // FogColor
if( t > 220.0 )
break;
rayDir= reflect( rayDir, n );
//float ao(vec3 p, vec3 n, float d, float i) {
y= 6.0;
for (z=1.0;y>0.;y--)
z-=(y*.5-f(p+n*y*.5))/exp2(y);
CurColor*= z*Ambient;
//CurColor*= .4 + .3 * ( dot(normalize(LightPos-p),n) );
cRes+= cFac*CurColor;//*(1.0-Reflect);
cFac*= CurStep;// Reflect * (1.0-t/tmax);
t= 0.5;
RayStep=rayDir*t;
}
gl_FragColor.xyz = cRes;// + Y.w;// + cFac*FogColor;
}

View File

@@ -0,0 +1,512 @@
#version 130
const int shader= 0;
// Parameters from our host
// x: Scene.Zeit
// y: Base drum envelope
// z: Snare drum envelope
// w: undefinded
in vec4 Y;
// Position of the fragment
in vec2 Z;
// All data of our world
float L, CurScene, CurTime, CurAnim, cFac, CurStep, VolLight, pi2= 6.28319, LightHeight = 50.0;
int m;
vec3 cRes, CurColor, RayStep;
vec2 rotate(vec2 v,float y)
{
return cos(y)*v+sin(y)*vec2(-v.y,v.x);
}
//repeat around y axis w times
//void rp(inout vec3 p, float trans, float w)
float repeatr(inout vec2 v,float x, float y)
{
float a= atan(v.y,v.x);
float z=mod(a,y)-y*.5;
v=(length(v))*vec2(cos(z),sin(z));
v.x-=x;
return a-z;
}
void repeat( inout float w, float y )
{
w= mod( w - y*.5, y ) - y*.5;
}
void repeate( inout float w, float y, float z )
{
w= max( abs(w)-z, mod( w - y*.5, y ) - y*.5);
}
float CBox( in vec3 p, in vec3 box, float rad )
{
return length( max( abs(p) - box + vec3(rad), 0.0 ) ) - rad;
}
float plasm(float x, float a, float b,float c)
{
return sin(x+a+c*sin(x+b));
}
vec3 shad2move()
{
return vec3( CurTime*19.0, 24.0 - cos(CurAnim*9.0) * 8.0, cos(CurAnim*5.0) * 24.0);
}
void schad3transform( inout vec3 p )
{
p.xz = rotate(p.xz, 0.2 * cos( pow(abs(p.x),0.4 - CurTime * 0.1)) );
p.yx = rotate(p.yx, 0.2 * cos( pow(abs(p.x),0.3 + CurTime * 0.1)) );
}
float f0(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
repeat(p.x, 0.5);
return max( length(p.x) - 0.1, CBox( p, vec3(1000.,1.4,1.4), .5));
}
if( shader == 1 )
{
p -= shad2move();
//p.y = rotate(p.yz, 50. *CurAnim );
p.x = length (p.xz)+4*Y.y - 12.5;
repeat (p.x, 24.0);
return length( max( abs(p.xy) - vec2(3., .2), 0.0 ) ) - 0.2;
}
if( shader == 2 )
{
float d = p.x;
repeat(p.x, pi2);
p.y -= 0.3 * cos( (p.z + d - p.x)*.5);
p.z += 128.0 * CurTime * cos(0.7 * (d-p.x) );
repeat(p.z, 2.4);
return CBox( p, vec3(1.0, 0.1, 1.0), 0.1);
}
if( shader == 3 )
{
p.x -= 128. * CurAnim;
repeat(p.x, 64.);
p.x = length( p.x ) - 11.;
return (p.x < 0.0 ? length( p.yz ): length( p )) - 5.0 ;
}
}
float f1(vec3 p)
{
if( shader == 0 )
{
float d = p.y - 5.;
p.x *= 1.0;
repeat(p.x, 20.);
repeatr(p.yz, 28.0, pi2 / 9.0);
return max( d, CBox( p, vec3(10.,2.0,10.), 3.));
}
if( shader == 1 )
{
vec3 o= p;
repeat(p.x, 8.0);
repeat(p.z, 8.0);
o -= shad2move();
p.xz = rotate(p.xz, atan(o.x, o.z) );
p.yz = rotate(p.yz, atan(length(o.xz), 48.0) );
float d = CBox( p, vec3(2.5 , 2.0, 2.5), 0.8);
p.y += 12.;
return max(d, length(p)- 12.);
}
if( shader == 2 )
{
float d = p.z;
repeat(p.z, pi2);
p.y += 0.3 * cos( (p.x + d - p.z)*.5);
return CBox( p, vec3(1000.0, 0.1, 2.0), 0.1);
}
if( shader == 3 )
{
p.z = length(p.z) + 15.;
float d = length(p.y) - 15.;
repeat(p.x, 100.);
//repeat(p.y, 9.);
repeatr(p.zy, 85.0, pi2 / 40.0);
repeatr(p.zx, 58.0, pi2 / 50.0);
return max( d, CBox( p, vec3(4.,3.,1.), 1.)); //max( length(p) - 64., CBox( p, vec3(4.,4.,80.), 1.));
}
}
float f2(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
p.x += 256.0 * CurAnim;
repeat(p.x, 32.0);
return length(vec2(length(p.yz) - 3.0,p.x)) - 1.- Y.y;
}
if( shader == 1 )
{
return length(p-shad2move()) - 12.0;
}
if( shader == 2 )
{
p.y -= 8.;
float d = p.x;
repeat(p.x, 32.0);
p.yz = rotate(p.yz, plasm(d-p.x, 2., CurAnim, 1.0)- Y.z );
p.xz = rotate(p.xz, plasm(d-p.x, 1., CurAnim, 2.0) );
return CBox( p, vec3(8.0), 6. - CurAnim);
}
if( shader == 3 )
{
p.yz = rotate(p.yz, plasm(round(p.x / 8.0), 1., 4.0*CurTime, 2.0) );
repeat(p.x, 8.0);
repeatr(p.yz, 0.0, pi2 / 10.0);
return max( abs(length(p.yz) - 6.0)-.2, abs(length(p.xz) - 2.+0.5*Y.y)-.3);
}
}
float f3(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
return CBox( p, vec3(1000.,1.,1.), .1);
}
if( shader == 1 )
{
p.y += 20.;
repeat( p.x, 6.3);
repeat( p.z, 1.3);
//repeatr(p.xz, .0, pi2 / 4.0);
return CBox( p, vec3(3.0, 15.0, 0.5), 0.4);
}
if( shader == 2 )
{
p.y -= 20.;
repeat( p.x, 20.0);
repeat( p.z, 20.0);
repeatr(p.xz, .0, pi2 / 4.0);
return CBox( p, vec3(1000.0, 1.0, 1.0), 0.2);
}
if( shader == 3 )
{
repeat(p.z, 6.);
repeat(p.x, 5.5);
repeatr(p.xz, 2.0, pi2 / 6.0);
return max( abs(1.-length(p.xz))-0.1,abs(length(p.y)-15.0)-0.1);
}
}
float f(vec3 p)
{
return (Y.y * 0.003+0.001) * plasm(p.x+Y.y*9., p.y, p.z, 1.0-Y.y) + min( min( min( f0(p), f1(p) ), f2(p) ), f3(p) );
}
float l(vec2 p)
{
float d = floor(0.5 - p.y/32.0) + floor(0.5 - p.x/70.0) * 3.;
if( shader == 1 || shader == 2 )
{
d= plasm( 33.0 * floor(0.5 - p.y/20.0), 17.0 * floor(0.5 - p.x/20.0), floor(CurTime * 8.0), 1.0);
repeate( p.x, 20.0, 60.0 );
repeat( p.y, 20.0);
L = length( max( abs(p) - vec2(3.0), 0.0 ) ) + 2.0;// max( length(p.x), length(p.y));
if (d > 0.5)
L /= 1.0 - 0.5 * Y.y;
else
L /= 1.0 - 0.5 * Y.z;
//float sync = shader == 1 ? Y.z : Y.y;
//repeate( p.x, 20.0, 60.0 );
//repeate( p.y, 20.0, 100.0 );
//vec2 q = p;
//q.y += 10;
//repeat (q.y, 40.0);
//repeat( p.y, 20.0);
//repeat( p.x, 20.0);
//L = length( max( abs(p) - vec2(3.0), 0.0 ) ) + 1.0;// max( length(p.x), length(p.y));
//L = L * step(q.y, 0) + L * step(0, q.y) / (1.0 - 0.3 * sync);
//L /= (1.0 - Y.y) * (step(0, q.y));
}
else
{
repeate( p.y, 32.0, 32.0 );
repeat( p.x, 70.0 );
p.x = length(p.x) - 25.0;
L = 2.0 + (p.x < 0. ? length(p.y) : length(p));
L *= 1.0 - 0.5 * Y.z;
}
if( CurScene == 0 )
return max(0., 4.0 * smoothstep(10.,-pow(sin(d+CurTime*15.0*CurTime*220.0)+CurTime*15.0-4.0,.2),L));
return 4.0 * smoothstep(10.,0.0,L);
}
void mat(vec3 p)
{
CurColor = vec3(1.,1.,0.);
CurStep= .3;
//CurNormal.y= 1.5;
float z= f0(p);
if( z > f1(p) )
{
z= f1(p);
CurColor = vec3(0.1);
CurStep= 0.85;
//CurNormal.y= 0.15;
}
if( z > f2(p) )
{
z= f2(p);
CurColor = vec3(0.6,0,0.15);
CurStep= .2;
//CurNormal.y= 0.0;
}
if( z > f3(p) )
{
//Wz= f3(p);
CurColor = vec3(.25);// + animTex(p.zy / 10.0) * 0.6;
CurStep= .1;
m=2;
}
}
void ToRes(vec3 Color, float Factor)
{
cRes+= Color * cFac;
cFac*= Factor;
}
void main()
{
CurScene= floor(Y.x);
CurTime= Y.x - CurScene;
CurAnim= CurTime;
// Get the look direction for the current pixel (always look forwards)
vec3 rayDir = vec3( 0.6, (Z.yx - 0.5));
//Kamera sitzt an dieser Position
vec3 p;
if( CurScene == 0.0 )
{
p= vec3( CurTime * 120. - 120. , -24.0, .0);
rayDir.xy= rotate( rayDir.xy, CurTime - 0.9 );
//rayDir.xz= rotate( rayDir.xz, CurTime );
//rayDir.yz= rotate( rayDir.yz, 0.9 - CurTime );
}
else if( CurScene == 1.0 )
{
p= vec3( 0., 5.0, -2.0);
rayDir.xy= rotate( rayDir.xy, -0.4 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= CurTime*CurTime;
}
else if( CurScene == 2.0 )
{
p= vec3( -CurTime * 200. + 140, -2., 5.0);
rayDir.xy= rotate( rayDir.xy, CurTime-0.8 );
rayDir.xz= rotate( rayDir.xz, 3.14 );
}
else if( CurScene == 3.0 )
{
p= vec3( -25. , 0., CurTime * 20.0 - 19.0);
rayDir.xy= rotate( rayDir.xy, -0.2 );
}
else if( CurScene == 4.0 )
{
p= vec3( 0., 40.0, CurTime *8.);
rayDir.xy= rotate( rayDir.xy, -CurTime );
CurAnim= 0;
}
else if( CurScene == 5.0 )
{
p= vec3( 0., 40.0, CurTime * -64. + 56.);
rayDir.xy= rotate( rayDir.xy, -1.0 );
CurAnim= 0.4*CurTime*CurTime;
}
else if( CurScene == 6.0 )
{
p= vec3( 0., 12.0, CurTime * -12.0);
rayDir.xy= rotate( rayDir.xy, CurTime - 1.5);
rayDir.xz= rotate( rayDir.xz, CurTime );
}
else if( CurScene == 7.0 )
{
p= vec3( -4., CurTime * 64. + 4.0, 0.);
rayDir.xy= rotate( rayDir.xy, -1.0 );
rayDir.xz= rotate( rayDir.xz, -CurTime );
}
else if( CurScene == 8.0 )
{
p= vec3( 8.0, 8.0, CurTime * 24. - 32.);
rayDir.xy= rotate( rayDir.xy, -0.3 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= 0;
}
else if( CurScene == 9.0 )
{
p= vec3( CurTime * 14., 18.0, 0.);
rayDir.xy= rotate( rayDir.xy, -CurTime-0.5 );
CurAnim= CurTime*CurTime;
}
else if( CurScene == 10.0 )
{
p= vec3( 2.0, CurTime * 4. + 2.0, CurTime * 12.+ 7.);
rayDir.xy= rotate( rayDir.xy, -0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime );
}
else if( CurScene == 11.0 )
{
p= vec3( CurTime * 70. - 80., CurTime * -4. + 6.0, CurTime * 64.- 56.);
rayDir.xy= rotate( rayDir.xy, -0.2 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= 4.*CurTime;
}
else if( CurScene == 12.0 )
{
p= vec3( 30.,-8.,-8.);
rayDir.xy= rotate( rayDir.xy, 0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime + 3.0 );
CurAnim= 0.4*CurTime*CurTime;
}
else if( CurScene == 13.0 )
{
p= vec3( -60.,12.,0.);
rayDir.xy= rotate( rayDir.xy, CurTime - 1.5 );
}
else if( CurScene == 14.0 )
{
p= vec3( -22.,0.,-8.);
//rayDir.xy= rotate( rayDir.xy, 0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime + 2.0 );
//CurAnim= 0.4*Y.y;
}
else if( CurScene == 15.0 )
{
p= vec3( 80. * CurTime, 7. ,-0.);
rayDir.xz= rotate( rayDir.xz, 3.*CurTime );
}
if( CurScene == 16.0 )
{
p.x = 43.0;
rayDir.xz= rotate( rayDir.xz, pi2/2.);
CurAnim= CurTime*CurTime;
}
rayDir = normalize(rayDir);
cRes= vec3( .0 );
cFac=1.0;
float t=0.0,y,z;
m=0;
while (m++<2)
{
//bis zu einer Oberflaeche steppen
//for (CurStep=1.0;t<220.0 && CurStep>t*.003;t+=0.01+max(0.0, CurStep),RayStep=rayDir*t )
for (CurStep=1.0;t<220.0 && CurStep>t*.003;t+=CurStep,RayStep=rayDir*t )
CurStep = f(p+RayStep);
vec3 NextPos = p+RayStep;
VolLight = 0.0;
if( p.y < LightHeight && NextPos.y > LightHeight)
{
float f = (p.y - LightHeight) / (p.y - NextPos.y);
p += RayStep*f;
VolLight = l(p.xz) * smoothstep( 220.0,0.0, f * t );
}
//Startpunkt und Richtung fuer reflektierten Strahl;
p= NextPos;
vec3 n = vec3(0.04, 0.0, 0.0);
n= normalize(vec3( f(p + n.xyy) - f(p - n.xyy), f(p + n.yxy) - f(p - n.yxy), f(p + n.yyx) - f(p - n.yyx) ));
//n= normalize(n);
//CurStep ab hier == Reflektion !!!
mat(p);
float Ambient= 0.45 + 0.4 * dot( n,vec3(0,1.0,0) );
ToRes(vec3(0.7,1.0,0.9)*VolLight,1.0-VolLight);
L= smoothstep( 0.,128., t );
ToRes(vec3( 0.0, 0.0, 0.05 )*L,1.0-L); // FogColor
if( t > 220.0 )
break;
rayDir= reflect( rayDir, n );
//float ao(vec3 p, vec3 n, float d, float i) {
y= 6.0;
for (z=1.0;y>0.;y--)
z-=(y*.5-f(p+n*y*.5))/exp2(y);
CurColor*= z*Ambient;
//CurColor*= .4 + .3 * ( dot(normalize(LightPos-p),n) );
cRes+= cFac*CurColor;//*(1.0-Reflect);
cFac*= CurStep;// Reflect * (1.0-t/tmax);
t= 0.5;
RayStep=rayDir*t;
}
gl_FragColor.xyz = cRes;// + Y.w;// + cFac*FogColor;
}

View File

@@ -0,0 +1,512 @@
#version 130
const int shader= 0;
// Parameters from our host
// x: Scene.Zeit
// y: Base drum envelope
// z: Snare drum envelope
// w: undefinded
in vec4 Y;
// Position of the fragment
in vec2 Z;
// All data of our world
float L, CurScene, CurTime, CurAnim, cFac, CurStep, VolLight, pi2= 6.28319, LightHeight = 50.0;
int m;
vec3 cRes, CurColor, RayStep;
vec2 rotate(vec2 v,float y)
{
return cos(y)*v+sin(y)*vec2(-v.y,v.x);
}
//repeat around y axis w times
//void rp(inout vec3 p, float trans, float w)
float repeatr(inout vec2 v,float x, float y)
{
float a= atan(v.y,v.x);
float z=mod(a,y)-y*.5;
v=(length(v))*vec2(cos(z),sin(z));
v.x-=x;
return a-z;
}
void repeat( inout float w, float y )
{
w= mod( w - y*.5, y ) - y*.5;
}
void repeate( inout float w, float y, float z )
{
w= max( abs(w)-z, mod( w - y*.5, y ) - y*.5);
}
float CBox( in vec3 p, in vec3 box, float rad )
{
return length( max( abs(p) - box + vec3(rad), 0.0 ) ) - rad;
}
float plasm(float x, float a, float b,float c)
{
return sin(x+a+c*sin(x+b));
}
vec3 shad2move()
{
return vec3( CurTime*19.0, 24.0 - cos(CurAnim*9.0) * 8.0, cos(CurAnim*5.0) * 24.0);
}
void schad3transform( inout vec3 p )
{
p.xz = rotate(p.xz, 0.2 * cos( pow(abs(p.x),0.4 - CurTime * 0.1)) );
p.yx = rotate(p.yx, 0.2 * cos( pow(abs(p.x),0.3 + CurTime * 0.1)) );
}
float f0(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
repeat(p.x, 0.5);
return max( length(p.x) - 0.1, CBox( p, vec3(1000.,1.4,1.4), .5));
}
if( shader == 1 )
{
p -= shad2move();
//p.y = rotate(p.yz, 50. *CurAnim );
p.x = length (p.xz)+4*Y.y - 12.5;
repeat (p.x, 24.0);
return length( max( abs(p.xy) - vec2(3., .2), 0.0 ) ) - 0.2;
}
if( shader == 2 )
{
float d = p.x;
repeat(p.x, pi2);
p.y -= 0.3 * cos( (p.z + d - p.x)*.5);
p.z += 128.0 * CurTime * cos(0.7 * (d-p.x) );
repeat(p.z, 2.4);
return CBox( p, vec3(1.0, 0.1, 1.0), 0.1);
}
if( shader == 3 )
{
p.x -= 128. * CurAnim;
repeat(p.x, 64.);
p.x = length( p.x ) - 11.;
return (p.x < 0.0 ? length( p.yz ): length( p )) - 5.0 ;
}
}
float f1(vec3 p)
{
if( shader == 0 )
{
float d = p.y - 5.;
p.x *= 1.0;
repeat(p.x, 20.);
repeatr(p.yz, 28.0, pi2 / 9.0);
return max( d, CBox( p, vec3(10.,2.0,10.), 3.));
}
if( shader == 1 )
{
vec3 o= p;
repeat(p.x, 8.0);
repeat(p.z, 8.0);
o -= shad2move();
p.xz = rotate(p.xz, atan(o.x, o.z) );
p.yz = rotate(p.yz, atan(length(o.xz), 48.0) );
float d = CBox( p, vec3(2.5 , 2.0, 2.5), 0.8);
p.y += 12.;
return max(d, length(p)- 12.);
}
if( shader == 2 )
{
float d = p.z;
repeat(p.z, pi2);
p.y += 0.3 * cos( (p.x + d - p.z)*.5);
return CBox( p, vec3(1000.0, 0.1, 2.0), 0.1);
}
if( shader == 3 )
{
p.z = length(p.z) + 15.;
float d = length(p.y) - 15.;
repeat(p.x, 100.);
//repeat(p.y, 9.);
repeatr(p.zy, 85.0, pi2 / 40.0);
repeatr(p.zx, 58.0, pi2 / 50.0);
return max( d, CBox( p, vec3(4.,3.,1.), 1.)); //max( length(p) - 64., CBox( p, vec3(4.,4.,80.), 1.));
}
}
float f2(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
p.x += 256.0 * CurAnim;
repeat(p.x, 32.0);
return length(vec2(length(p.yz) - 3.0,p.x)) - 1.- Y.y;
}
if( shader == 1 )
{
return length(p-shad2move()) - 12.0;
}
if( shader == 2 )
{
p.y -= 8.;
float d = p.x;
repeat(p.x, 32.0);
p.yz = rotate(p.yz, plasm(d-p.x, 2., CurAnim, 1.0)- Y.z );
p.xz = rotate(p.xz, plasm(d-p.x, 1., CurAnim, 2.0) );
return CBox( p, vec3(8.0), 6. - CurAnim);
}
if( shader == 3 )
{
p.yz = rotate(p.yz, plasm(round(p.x / 8.0), 1., 4.0*CurTime, 2.0) );
repeat(p.x, 8.0);
repeatr(p.yz, 0.0, pi2 / 10.0);
return max( abs(length(p.yz) - 6.0)-.2, abs(length(p.xz) - 2.+0.5*Y.y)-.3);
}
}
float f3(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
return CBox( p, vec3(1000.,1.,1.), .1);
}
if( shader == 1 )
{
p.y += 20.;
repeat( p.x, 6.3);
repeat( p.z, 1.3);
//repeatr(p.xz, .0, pi2 / 4.0);
return CBox( p, vec3(3.0, 15.0, 0.5), 0.4);
}
if( shader == 2 )
{
p.y -= 20.;
repeat( p.x, 20.0);
repeat( p.z, 20.0);
repeatr(p.xz, .0, pi2 / 4.0);
return CBox( p, vec3(1000.0, 1.0, 1.0), 0.2);
}
if( shader == 3 )
{
repeat(p.z, 6.);
repeat(p.x, 5.5);
repeatr(p.xz, 2.0, pi2 / 6.0);
return max( abs(1.-length(p.xz))-0.1,abs(length(p.y)-15.0)-0.1);
}
}
float f(vec3 p)
{
return (Y.y * 0.003+0.001) * plasm(p.x+Y.y*9., p.y, p.z, 1.0-Y.y) + min( min( min( f0(p), f1(p) ), f2(p) ), f3(p) );
}
float l(vec2 p)
{
float d = floor(0.5 - p.y/32.0) + floor(0.5 - p.x/70.0) * 3.;
if( shader == 1 || shader == 2 )
{
d= plasm( 33.0 * floor(0.5 - p.y/20.0), 17.0 * floor(0.5 - p.x/20.0), floor(CurTime * 8.0), 1.0);
repeate( p.x, 20.0, 60.0 );
repeat( p.y, 20.0);
L = length( max( abs(p) - vec2(3.0), 0.0 ) ) + 2.0;// max( length(p.x), length(p.y));
if (d > 0.5)
L /= 1.0 - 0.5 * Y.y;
else
L /= 1.0 - 0.5 * Y.z;
//float sync = shader == 1 ? Y.z : Y.y;
//repeate( p.x, 20.0, 60.0 );
//repeate( p.y, 20.0, 100.0 );
//vec2 q = p;
//q.y += 10;
//repeat (q.y, 40.0);
//repeat( p.y, 20.0);
//repeat( p.x, 20.0);
//L = length( max( abs(p) - vec2(3.0), 0.0 ) ) + 1.0;// max( length(p.x), length(p.y));
//L = L * step(q.y, 0) + L * step(0, q.y) / (1.0 - 0.3 * sync);
//L /= (1.0 - Y.y) * (step(0, q.y));
}
else
{
repeate( p.y, 32.0, 32.0 );
repeat( p.x, 70.0 );
p.x = length(p.x) - 25.0;
L = 2.0 + (p.x < 0. ? length(p.y) : length(p));
L *= 1.0 - 0.5 * Y.z;
}
if( CurScene == 0 )
return max(0., 4.0 * smoothstep(10.,-pow(sin(d+CurTime*15.0*CurTime*220.0)+CurTime*15.0-4.0,.2),L));
return 4.0 * smoothstep(10.,0.0,L);
}
void mat(vec3 p)
{
CurColor = vec3(1.,1.,0.);
CurStep= .3;
//CurNormal.y= 1.5;
float z= f0(p);
if( z > f1(p) )
{
z= f1(p);
CurColor = vec3(0.1);
CurStep= 0.85;
//CurNormal.y= 0.15;
}
if( z > f2(p) )
{
z= f2(p);
CurColor = vec3(0.6,0,0.15);
CurStep= .2;
//CurNormal.y= 0.0;
}
if( z > f3(p) )
{
//Wz= f3(p);
CurColor = vec3(.25);// + animTex(p.zy / 10.0) * 0.6;
CurStep= .1;
m=2;
}
}
void ToRes(vec3 Color, float Factor)
{
cRes+= Color * cFac;
cFac*= Factor;
}
void main()
{
CurScene= floor(Y.x);
CurTime= Y.x - CurScene;
CurAnim= CurTime;
// Get the look direction for the current pixel (always look forwards)
vec3 rayDir = vec3( 0.6, (Z.yx - 0.5));
//Kamera sitzt an dieser Position
vec3 p;
if( CurScene == 0.0 )
{
p= vec3( CurTime * 120. - 120. , -24.0, .0);
rayDir.xy= rotate( rayDir.xy, CurTime - 0.9 );
//rayDir.xz= rotate( rayDir.xz, CurTime );
//rayDir.yz= rotate( rayDir.yz, 0.9 - CurTime );
}
else if( CurScene == 1.0 )
{
p= vec3( 0., 5.0, -2.0);
rayDir.xy= rotate( rayDir.xy, -0.4 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= CurTime*CurTime;
}
else if( CurScene == 2.0 )
{
p= vec3( -CurTime * 200. + 140, -2., 5.0);
rayDir.xy= rotate( rayDir.xy, CurTime-0.8 );
rayDir.xz= rotate( rayDir.xz, 3.14 );
}
else if( CurScene == 3.0 )
{
p= vec3( -25. , 0., CurTime * 20.0 - 19.0);
rayDir.xy= rotate( rayDir.xy, -0.2 );
}
else if( CurScene == 4.0 )
{
p= vec3( 0., 40.0, CurTime *8.);
rayDir.xy= rotate( rayDir.xy, -CurTime );
CurAnim= 0;
}
else if( CurScene == 5.0 )
{
p= vec3( 0., 40.0, CurTime * -64. + 56.);
rayDir.xy= rotate( rayDir.xy, -1.0 );
CurAnim= 0.4*CurTime*CurTime;
}
else if( CurScene == 6.0 )
{
p= vec3( 0., 12.0, CurTime * -12.0);
rayDir.xy= rotate( rayDir.xy, CurTime - 1.5);
rayDir.xz= rotate( rayDir.xz, CurTime );
}
else if( CurScene == 7.0 )
{
p= vec3( -4., CurTime * 64. + 4.0, 0.);
rayDir.xy= rotate( rayDir.xy, -1.0 );
rayDir.xz= rotate( rayDir.xz, -CurTime );
}
else if( CurScene == 8.0 )
{
p= vec3( 8.0, 8.0, CurTime * 24. - 32.);
rayDir.xy= rotate( rayDir.xy, -0.3 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= 0;
}
else if( CurScene == 9.0 )
{
p= vec3( CurTime * 14., 18.0, 0.);
rayDir.xy= rotate( rayDir.xy, -CurTime-0.5 );
CurAnim= CurTime*CurTime;
}
else if( CurScene == 10.0 )
{
p= vec3( 2.0, CurTime * 4. + 2.0, CurTime * 12.+ 7.);
rayDir.xy= rotate( rayDir.xy, -0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime );
}
else if( CurScene == 11.0 )
{
p= vec3( CurTime * 70. - 80., CurTime * -4. + 6.0, CurTime * 64.- 56.);
rayDir.xy= rotate( rayDir.xy, -0.2 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= 4.*CurTime;
}
else if( CurScene == 12.0 )
{
p= vec3( 30.,-8.,-8.);
rayDir.xy= rotate( rayDir.xy, 0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime + 3.0 );
CurAnim= 0.4*CurTime*CurTime;
}
else if( CurScene == 13.0 )
{
p= vec3( -60.,12.,0.);
rayDir.xy= rotate( rayDir.xy, CurTime - 1.5 );
}
else if( CurScene == 14.0 )
{
p= vec3( -22.,0.,-8.);
//rayDir.xy= rotate( rayDir.xy, 0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime + 2.0 );
//CurAnim= 0.4*Y.y;
}
else if( CurScene == 15.0 )
{
p= vec3( 80. * CurTime, 7. ,-0.);
rayDir.xz= rotate( rayDir.xz, 3.*CurTime );
}
if( CurScene == 16.0 )
{
p.x = 43.0;
rayDir.xz= rotate( rayDir.xz, pi2/2.);
CurAnim= CurTime*CurTime;
}
/////////////////////////////////////////////////////////////////////
//Debugzeug fuer Kamerasteuerung
if( true )
{
p.x= gl_ModelViewMatrix[0][0];
p.y= gl_ModelViewMatrix[0][1];
p.z= gl_ModelViewMatrix[0][2];
float a1= gl_ModelViewMatrix[1][1];
float c1,s1;vec3 q1= vec3((Z.xy - 0.5), 0.8);
c1 = cos(a1); s1 = sin(a1);
rayDir.y = c1 * q1.y - s1 * q1.z;
rayDir.x= q1.x;
rayDir.z = s1 * q1.y + c1 * q1.z;
a1= gl_ModelViewMatrix[1][0];
q1=rayDir;
c1 = cos(a1); s1 = sin(a1);
rayDir.x = c1 * q1.x + s1 * q1.z;
rayDir.z = -s1 * q1.x + c1 * q1.z;
}
//Ende Debugzeug fuer Kamerasteuerung
/////////////////////////////////////////////////////////////////////
rayDir = normalize(rayDir);
cRes= vec3( .0 );
cFac=1.0;
float t=0.0,y,z;
m=0;
while (m++<2)
{
//bis zu einer Oberflaeche steppen
//for (CurStep=1.0;t<220.0 && CurStep>t*.003;t+=0.01+max(0.0, CurStep),RayStep=rayDir*t )
for (CurStep=1.0;t<220.0 && CurStep>t*.003;t+=CurStep,RayStep=rayDir*t )
CurStep = f(p+RayStep);
vec3 NextPos = p+RayStep;
VolLight = 0.0;
if( p.y < LightHeight && NextPos.y > LightHeight)
{
float f = (p.y - LightHeight) / (p.y - NextPos.y);
p += RayStep*f;
VolLight = l(p.xz) * smoothstep( 220.0,0.0, f * t );
}
//Startpunkt und Richtung fuer reflektierten Strahl;
p= NextPos;
vec3 n = vec3(0.04, 0.0, 0.0);
n= normalize(vec3( f(p + n.xyy) - f(p - n.xyy), f(p + n.yxy) - f(p - n.yxy), f(p + n.yyx) - f(p - n.yyx) ));
//n= normalize(n);
//CurStep ab hier == Reflektion !!!
mat(p);
float Ambient= 0.45 + 0.4 * dot( n,vec3(0,1.0,0) );
ToRes(vec3(0.7,1.0,0.9)*VolLight,1.0-VolLight);
L= smoothstep( 0.,128., t );
ToRes(vec3( 0.0, 0.0, 0.05 )*L,1.0-L); // FogColor
if( t > 220.0 )
break;
rayDir= reflect( rayDir, n );
//float ao(vec3 p, vec3 n, float d, float i) {
y= 6.0;
for (z=1.0;y>0.;y--)
z-=(y*.5-f(p+n*y*.5))/exp2(y);
CurColor*= z*Ambient;
//CurColor*= .4 + .3 * ( dot(normalize(LightPos-p),n) );
cRes+= cFac*CurColor;//*(1.0-Reflect);
cFac*= CurStep;// Reflect * (1.0-t/tmax);
t= 0.5;
RayStep=rayDir*t;
}
gl_FragColor.xyz = cRes;// + Y.w;// + cFac*FogColor;
}

View File

@@ -0,0 +1,512 @@
#version 130
const int shader= 1;
// Parameters from our host
// x: Scene.Zeit
// y: Base drum envelope
// z: Snare drum envelope
// w: undefinded
in vec4 Y;
// Position of the fragment
in vec2 Z;
// All data of our world
float L, CurScene, CurTime, CurAnim, cFac, CurStep, VolLight, pi2= 6.28319, LightHeight = 50.0;
int m;
vec3 cRes, CurColor, RayStep;
vec2 rotate(vec2 v,float y)
{
return cos(y)*v+sin(y)*vec2(-v.y,v.x);
}
//repeat around y axis w times
//void rp(inout vec3 p, float trans, float w)
float repeatr(inout vec2 v,float x, float y)
{
float a= atan(v.y,v.x);
float z=mod(a,y)-y*.5;
v=(length(v))*vec2(cos(z),sin(z));
v.x-=x;
return a-z;
}
void repeat( inout float w, float y )
{
w= mod( w - y*.5, y ) - y*.5;
}
void repeate( inout float w, float y, float z )
{
w= max( abs(w)-z, mod( w - y*.5, y ) - y*.5);
}
float CBox( in vec3 p, in vec3 box, float rad )
{
return length( max( abs(p) - box + vec3(rad), 0.0 ) ) - rad;
}
float plasm(float x, float a, float b,float c)
{
return sin(x+a+c*sin(x+b));
}
vec3 shad2move()
{
return vec3( CurTime*19.0, 24.0 - cos(CurAnim*9.0) * 8.0, cos(CurAnim*5.0) * 24.0);
}
void schad3transform( inout vec3 p )
{
p.xz = rotate(p.xz, 0.2 * cos( pow(abs(p.x),0.4 - CurTime * 0.1)) );
p.yx = rotate(p.yx, 0.2 * cos( pow(abs(p.x),0.3 + CurTime * 0.1)) );
}
float f0(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
repeat(p.x, 0.5);
return max( length(p.x) - 0.1, CBox( p, vec3(1000.,1.4,1.4), .5));
}
if( shader == 1 )
{
p -= shad2move();
//p.y = rotate(p.yz, 50. *CurAnim );
p.x = length (p.xz)+4*Y.y - 12.5;
repeat (p.x, 24.0);
return length( max( abs(p.xy) - vec2(3., .2), 0.0 ) ) - 0.2;
}
if( shader == 2 )
{
float d = p.x;
repeat(p.x, pi2);
p.y -= 0.3 * cos( (p.z + d - p.x)*.5);
p.z += 128.0 * CurTime * cos(0.7 * (d-p.x) );
repeat(p.z, 2.4);
return CBox( p, vec3(1.0, 0.1, 1.0), 0.1);
}
if( shader == 3 )
{
p.x -= 128. * CurAnim;
repeat(p.x, 64.);
p.x = length( p.x ) - 11.;
return (p.x < 0.0 ? length( p.yz ): length( p )) - 5.0 ;
}
}
float f1(vec3 p)
{
if( shader == 0 )
{
float d = p.y - 5.;
p.x *= 1.0;
repeat(p.x, 20.);
repeatr(p.yz, 28.0, pi2 / 9.0);
return max( d, CBox( p, vec3(10.,2.0,10.), 3.));
}
if( shader == 1 )
{
vec3 o= p;
repeat(p.x, 8.0);
repeat(p.z, 8.0);
o -= shad2move();
p.xz = rotate(p.xz, atan(o.x, o.z) );
p.yz = rotate(p.yz, atan(length(o.xz), 48.0) );
float d = CBox( p, vec3(2.5 , 2.0, 2.5), 0.8);
p.y += 12.;
return max(d, length(p)- 12.);
}
if( shader == 2 )
{
float d = p.z;
repeat(p.z, pi2);
p.y += 0.3 * cos( (p.x + d - p.z)*.5);
return CBox( p, vec3(1000.0, 0.1, 2.0), 0.1);
}
if( shader == 3 )
{
p.z = length(p.z) + 15.;
float d = length(p.y) - 15.;
repeat(p.x, 100.);
//repeat(p.y, 9.);
repeatr(p.zy, 85.0, pi2 / 40.0);
repeatr(p.zx, 58.0, pi2 / 50.0);
return max( d, CBox( p, vec3(4.,3.,1.), 1.)); //max( length(p) - 64., CBox( p, vec3(4.,4.,80.), 1.));
}
}
float f2(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
p.x += 256.0 * CurAnim;
repeat(p.x, 32.0);
return length(vec2(length(p.yz) - 3.0,p.x)) - 1.- Y.y;
}
if( shader == 1 )
{
return length(p-shad2move()) - 12.0;
}
if( shader == 2 )
{
p.y -= 8.;
float d = p.x;
repeat(p.x, 32.0);
p.yz = rotate(p.yz, plasm(d-p.x, 2., CurAnim, 1.0)- Y.z );
p.xz = rotate(p.xz, plasm(d-p.x, 1., CurAnim, 2.0) );
return CBox( p, vec3(8.0), 6. - CurAnim);
}
if( shader == 3 )
{
p.yz = rotate(p.yz, plasm(round(p.x / 8.0), 1., 4.0*CurTime, 2.0) );
repeat(p.x, 8.0);
repeatr(p.yz, 0.0, pi2 / 10.0);
return max( abs(length(p.yz) - 6.0)-.2, abs(length(p.xz) - 2.+0.5*Y.y)-.3);
}
}
float f3(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
return CBox( p, vec3(1000.,1.,1.), .1);
}
if( shader == 1 )
{
p.y += 20.;
repeat( p.x, 6.3);
repeat( p.z, 1.3);
//repeatr(p.xz, .0, pi2 / 4.0);
return CBox( p, vec3(3.0, 15.0, 0.5), 0.4);
}
if( shader == 2 )
{
p.y -= 20.;
repeat( p.x, 20.0);
repeat( p.z, 20.0);
repeatr(p.xz, .0, pi2 / 4.0);
return CBox( p, vec3(1000.0, 1.0, 1.0), 0.2);
}
if( shader == 3 )
{
repeat(p.z, 6.);
repeat(p.x, 5.5);
repeatr(p.xz, 2.0, pi2 / 6.0);
return max( abs(1.-length(p.xz))-0.1,abs(length(p.y)-15.0)-0.1);
}
}
float f(vec3 p)
{
return (Y.y * 0.003+0.001) * plasm(p.x+Y.y*9., p.y, p.z, 1.0-Y.y) + min( min( min( f0(p), f1(p) ), f2(p) ), f3(p) );
}
float l(vec2 p)
{
float d = floor(0.5 - p.y/32.0) + floor(0.5 - p.x/70.0) * 3.;
if( shader == 1 || shader == 2 )
{
d= plasm( 33.0 * floor(0.5 - p.y/20.0), 17.0 * floor(0.5 - p.x/20.0), floor(CurTime * 8.0), 1.0);
repeate( p.x, 20.0, 60.0 );
repeat( p.y, 20.0);
L = length( max( abs(p) - vec2(3.0), 0.0 ) ) + 2.0;// max( length(p.x), length(p.y));
if (d > 0.5)
L /= 1.0 - 0.5 * Y.y;
else
L /= 1.0 - 0.5 * Y.z;
//float sync = shader == 1 ? Y.z : Y.y;
//repeate( p.x, 20.0, 60.0 );
//repeate( p.y, 20.0, 100.0 );
//vec2 q = p;
//q.y += 10;
//repeat (q.y, 40.0);
//repeat( p.y, 20.0);
//repeat( p.x, 20.0);
//L = length( max( abs(p) - vec2(3.0), 0.0 ) ) + 1.0;// max( length(p.x), length(p.y));
//L = L * step(q.y, 0) + L * step(0, q.y) / (1.0 - 0.3 * sync);
//L /= (1.0 - Y.y) * (step(0, q.y));
}
else
{
repeate( p.y, 32.0, 32.0 );
repeat( p.x, 70.0 );
p.x = length(p.x) - 25.0;
L = 2.0 + (p.x < 0. ? length(p.y) : length(p));
L *= 1.0 - 0.5 * Y.z;
}
if( CurScene == 0 )
return max(0., 4.0 * smoothstep(10.,-pow(sin(d+CurTime*15.0*CurTime*220.0)+CurTime*15.0-4.0,.2),L));
return 4.0 * smoothstep(10.,0.0,L);
}
void mat(vec3 p)
{
CurColor = vec3(1.,1.,0.);
CurStep= .3;
//CurNormal.y= 1.5;
float z= f0(p);
if( z > f1(p) )
{
z= f1(p);
CurColor = vec3(0.1);
CurStep= 0.85;
//CurNormal.y= 0.15;
}
if( z > f2(p) )
{
z= f2(p);
CurColor = vec3(0.6,0,0.15);
CurStep= .2;
//CurNormal.y= 0.0;
}
if( z > f3(p) )
{
//Wz= f3(p);
CurColor = vec3(.25);// + animTex(p.zy / 10.0) * 0.6;
CurStep= .1;
m=2;
}
}
void ToRes(vec3 Color, float Factor)
{
cRes+= Color * cFac;
cFac*= Factor;
}
void main()
{
CurScene= floor(Y.x);
CurTime= Y.x - CurScene;
CurAnim= CurTime;
// Get the look direction for the current pixel (always look forwards)
vec3 rayDir = vec3( 0.6, (Z.yx - 0.5));
//Kamera sitzt an dieser Position
vec3 p;
if( CurScene == 0.0 )
{
p= vec3( CurTime * 120. - 120. , -24.0, .0);
rayDir.xy= rotate( rayDir.xy, CurTime - 0.9 );
//rayDir.xz= rotate( rayDir.xz, CurTime );
//rayDir.yz= rotate( rayDir.yz, 0.9 - CurTime );
}
else if( CurScene == 1.0 )
{
p= vec3( 0., 5.0, -2.0);
rayDir.xy= rotate( rayDir.xy, -0.4 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= CurTime*CurTime;
}
else if( CurScene == 2.0 )
{
p= vec3( -CurTime * 200. + 140, -2., 5.0);
rayDir.xy= rotate( rayDir.xy, CurTime-0.8 );
rayDir.xz= rotate( rayDir.xz, 3.14 );
}
else if( CurScene == 3.0 )
{
p= vec3( -25. , 0., CurTime * 20.0 - 19.0);
rayDir.xy= rotate( rayDir.xy, -0.2 );
}
else if( CurScene == 4.0 )
{
p= vec3( 0., 40.0, CurTime *8.);
rayDir.xy= rotate( rayDir.xy, -CurTime );
CurAnim= 0;
}
else if( CurScene == 5.0 )
{
p= vec3( 0., 40.0, CurTime * -64. + 56.);
rayDir.xy= rotate( rayDir.xy, -1.0 );
CurAnim= 0.4*CurTime*CurTime;
}
else if( CurScene == 6.0 )
{
p= vec3( 0., 12.0, CurTime * -12.0);
rayDir.xy= rotate( rayDir.xy, CurTime - 1.5);
rayDir.xz= rotate( rayDir.xz, CurTime );
}
else if( CurScene == 7.0 )
{
p= vec3( -4., CurTime * 64. + 4.0, 0.);
rayDir.xy= rotate( rayDir.xy, -1.0 );
rayDir.xz= rotate( rayDir.xz, -CurTime );
}
else if( CurScene == 8.0 )
{
p= vec3( 8.0, 8.0, CurTime * 24. - 32.);
rayDir.xy= rotate( rayDir.xy, -0.3 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= 0;
}
else if( CurScene == 9.0 )
{
p= vec3( CurTime * 14., 18.0, 0.);
rayDir.xy= rotate( rayDir.xy, -CurTime-0.5 );
CurAnim= CurTime*CurTime;
}
else if( CurScene == 10.0 )
{
p= vec3( 2.0, CurTime * 4. + 2.0, CurTime * 12.+ 7.);
rayDir.xy= rotate( rayDir.xy, -0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime );
}
else if( CurScene == 11.0 )
{
p= vec3( CurTime * 70. - 80., CurTime * -4. + 6.0, CurTime * 64.- 56.);
rayDir.xy= rotate( rayDir.xy, -0.2 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= 4.*CurTime;
}
else if( CurScene == 12.0 )
{
p= vec3( 30.,-8.,-8.);
rayDir.xy= rotate( rayDir.xy, 0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime + 3.0 );
CurAnim= 0.4*CurTime*CurTime;
}
else if( CurScene == 13.0 )
{
p= vec3( -60.,12.,0.);
rayDir.xy= rotate( rayDir.xy, CurTime - 1.5 );
}
else if( CurScene == 14.0 )
{
p= vec3( -22.,0.,-8.);
//rayDir.xy= rotate( rayDir.xy, 0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime + 2.0 );
//CurAnim= 0.4*Y.y;
}
else if( CurScene == 15.0 )
{
p= vec3( 80. * CurTime, 7. ,-0.);
rayDir.xz= rotate( rayDir.xz, 3.*CurTime );
}
if( CurScene == 16.0 )
{
p.x = 43.0;
rayDir.xz= rotate( rayDir.xz, pi2/2.);
CurAnim= CurTime*CurTime;
}
rayDir = normalize(rayDir);
cRes= vec3( .0 );
cFac=1.0;
float t=0.0,y,z;
m=0;
while (m++<2)
{
//bis zu einer Oberflaeche steppen
//for (CurStep=1.0;t<220.0 && CurStep>t*.003;t+=0.01+max(0.0, CurStep),RayStep=rayDir*t )
for (CurStep=1.0;t<220.0 && CurStep>t*.003;t+=CurStep,RayStep=rayDir*t )
CurStep = f(p+RayStep);
vec3 NextPos = p+RayStep;
VolLight = 0.0;
if( p.y < LightHeight && NextPos.y > LightHeight)
{
float f = (p.y - LightHeight) / (p.y - NextPos.y);
p += RayStep*f;
VolLight = l(p.xz) * smoothstep( 220.0,0.0, f * t );
}
//Startpunkt und Richtung fuer reflektierten Strahl;
p= NextPos;
vec3 n = vec3(0.04, 0.0, 0.0);
n= normalize(vec3( f(p + n.xyy) - f(p - n.xyy), f(p + n.yxy) - f(p - n.yxy), f(p + n.yyx) - f(p - n.yyx) ));
//n= normalize(n);
//CurStep ab hier == Reflektion !!!
mat(p);
float Ambient= 0.45 + 0.4 * dot( n,vec3(0,1.0,0) );
ToRes(vec3(0.7,1.0,0.9)*VolLight,1.0-VolLight);
L= smoothstep( 0.,128., t );
ToRes(vec3( 0.0, 0.0, 0.05 )*L,1.0-L); // FogColor
if( t > 220.0 )
break;
rayDir= reflect( rayDir, n );
//float ao(vec3 p, vec3 n, float d, float i) {
y= 6.0;
for (z=1.0;y>0.;y--)
z-=(y*.5-f(p+n*y*.5))/exp2(y);
CurColor*= z*Ambient;
//CurColor*= .4 + .3 * ( dot(normalize(LightPos-p),n) );
cRes+= cFac*CurColor;//*(1.0-Reflect);
cFac*= CurStep;// Reflect * (1.0-t/tmax);
t= 0.5;
RayStep=rayDir*t;
}
gl_FragColor.xyz = cRes;// + Y.w;// + cFac*FogColor;
}

View File

@@ -0,0 +1,512 @@
#version 130
const int shader= 1;
// Parameters from our host
// x: Scene.Zeit
// y: Base drum envelope
// z: Snare drum envelope
// w: undefinded
in vec4 Y;
// Position of the fragment
in vec2 Z;
// All data of our world
float L, CurScene, CurTime, CurAnim, cFac, CurStep, VolLight, pi2= 6.28319, LightHeight = 50.0;
int m;
vec3 cRes, CurColor, RayStep;
vec2 rotate(vec2 v,float y)
{
return cos(y)*v+sin(y)*vec2(-v.y,v.x);
}
//repeat around y axis w times
//void rp(inout vec3 p, float trans, float w)
float repeatr(inout vec2 v,float x, float y)
{
float a= atan(v.y,v.x);
float z=mod(a,y)-y*.5;
v=(length(v))*vec2(cos(z),sin(z));
v.x-=x;
return a-z;
}
void repeat( inout float w, float y )
{
w= mod( w - y*.5, y ) - y*.5;
}
void repeate( inout float w, float y, float z )
{
w= max( abs(w)-z, mod( w - y*.5, y ) - y*.5);
}
float CBox( in vec3 p, in vec3 box, float rad )
{
return length( max( abs(p) - box + vec3(rad), 0.0 ) ) - rad;
}
float plasm(float x, float a, float b,float c)
{
return sin(x+a+c*sin(x+b));
}
vec3 shad2move()
{
return vec3( CurTime*19.0, 24.0 - cos(CurAnim*9.0) * 8.0, cos(CurAnim*5.0) * 24.0);
}
void schad3transform( inout vec3 p )
{
p.xz = rotate(p.xz, 0.2 * cos( pow(abs(p.x),0.4 - CurTime * 0.1)) );
p.yx = rotate(p.yx, 0.2 * cos( pow(abs(p.x),0.3 + CurTime * 0.1)) );
}
float f0(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
repeat(p.x, 0.5);
return max( length(p.x) - 0.1, CBox( p, vec3(1000.,1.4,1.4), .5));
}
if( shader == 1 )
{
p -= shad2move();
//p.y = rotate(p.yz, 50. *CurAnim );
p.x = length (p.xz)+4*Y.y - 12.5;
repeat (p.x, 24.0);
return length( max( abs(p.xy) - vec2(3., .2), 0.0 ) ) - 0.2;
}
if( shader == 2 )
{
float d = p.x;
repeat(p.x, pi2);
p.y -= 0.3 * cos( (p.z + d - p.x)*.5);
p.z += 128.0 * CurTime * cos(0.7 * (d-p.x) );
repeat(p.z, 2.4);
return CBox( p, vec3(1.0, 0.1, 1.0), 0.1);
}
if( shader == 3 )
{
p.x -= 128. * CurAnim;
repeat(p.x, 64.);
p.x = length( p.x ) - 11.;
return (p.x < 0.0 ? length( p.yz ): length( p )) - 5.0 ;
}
}
float f1(vec3 p)
{
if( shader == 0 )
{
float d = p.y - 5.;
p.x *= 1.0;
repeat(p.x, 20.);
repeatr(p.yz, 28.0, pi2 / 9.0);
return max( d, CBox( p, vec3(10.,2.0,10.), 3.));
}
if( shader == 1 )
{
vec3 o= p;
repeat(p.x, 8.0);
repeat(p.z, 8.0);
o -= shad2move();
p.xz = rotate(p.xz, atan(o.x, o.z) );
p.yz = rotate(p.yz, atan(length(o.xz), 48.0) );
float d = CBox( p, vec3(2.5 , 2.0, 2.5), 0.8);
p.y += 12.;
return max(d, length(p)- 12.);
}
if( shader == 2 )
{
float d = p.z;
repeat(p.z, pi2);
p.y += 0.3 * cos( (p.x + d - p.z)*.5);
return CBox( p, vec3(1000.0, 0.1, 2.0), 0.1);
}
if( shader == 3 )
{
p.z = length(p.z) + 15.;
float d = length(p.y) - 15.;
repeat(p.x, 100.);
//repeat(p.y, 9.);
repeatr(p.zy, 85.0, pi2 / 40.0);
repeatr(p.zx, 58.0, pi2 / 50.0);
return max( d, CBox( p, vec3(4.,3.,1.), 1.)); //max( length(p) - 64., CBox( p, vec3(4.,4.,80.), 1.));
}
}
float f2(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
p.x += 256.0 * CurAnim;
repeat(p.x, 32.0);
return length(vec2(length(p.yz) - 3.0,p.x)) - 1.- Y.y;
}
if( shader == 1 )
{
return length(p-shad2move()) - 12.0;
}
if( shader == 2 )
{
p.y -= 8.;
float d = p.x;
repeat(p.x, 32.0);
p.yz = rotate(p.yz, plasm(d-p.x, 2., CurAnim, 1.0)- Y.z );
p.xz = rotate(p.xz, plasm(d-p.x, 1., CurAnim, 2.0) );
return CBox( p, vec3(8.0), 6. - CurAnim);
}
if( shader == 3 )
{
p.yz = rotate(p.yz, plasm(round(p.x / 8.0), 1., 4.0*CurTime, 2.0) );
repeat(p.x, 8.0);
repeatr(p.yz, 0.0, pi2 / 10.0);
return max( abs(length(p.yz) - 6.0)-.2, abs(length(p.xz) - 2.+0.5*Y.y)-.3);
}
}
float f3(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
return CBox( p, vec3(1000.,1.,1.), .1);
}
if( shader == 1 )
{
p.y += 20.;
repeat( p.x, 6.3);
repeat( p.z, 1.3);
//repeatr(p.xz, .0, pi2 / 4.0);
return CBox( p, vec3(3.0, 15.0, 0.5), 0.4);
}
if( shader == 2 )
{
p.y -= 20.;
repeat( p.x, 20.0);
repeat( p.z, 20.0);
repeatr(p.xz, .0, pi2 / 4.0);
return CBox( p, vec3(1000.0, 1.0, 1.0), 0.2);
}
if( shader == 3 )
{
repeat(p.z, 6.);
repeat(p.x, 5.5);
repeatr(p.xz, 2.0, pi2 / 6.0);
return max( abs(1.-length(p.xz))-0.1,abs(length(p.y)-15.0)-0.1);
}
}
float f(vec3 p)
{
return (Y.y * 0.003+0.001) * plasm(p.x+Y.y*9., p.y, p.z, 1.0-Y.y) + min( min( min( f0(p), f1(p) ), f2(p) ), f3(p) );
}
float l(vec2 p)
{
float d = floor(0.5 - p.y/32.0) + floor(0.5 - p.x/70.0) * 3.;
if( shader == 1 || shader == 2 )
{
d= plasm( 33.0 * floor(0.5 - p.y/20.0), 17.0 * floor(0.5 - p.x/20.0), floor(CurTime * 8.0), 1.0);
repeate( p.x, 20.0, 60.0 );
repeat( p.y, 20.0);
L = length( max( abs(p) - vec2(3.0), 0.0 ) ) + 2.0;// max( length(p.x), length(p.y));
if (d > 0.5)
L /= 1.0 - 0.5 * Y.y;
else
L /= 1.0 - 0.5 * Y.z;
//float sync = shader == 1 ? Y.z : Y.y;
//repeate( p.x, 20.0, 60.0 );
//repeate( p.y, 20.0, 100.0 );
//vec2 q = p;
//q.y += 10;
//repeat (q.y, 40.0);
//repeat( p.y, 20.0);
//repeat( p.x, 20.0);
//L = length( max( abs(p) - vec2(3.0), 0.0 ) ) + 1.0;// max( length(p.x), length(p.y));
//L = L * step(q.y, 0) + L * step(0, q.y) / (1.0 - 0.3 * sync);
//L /= (1.0 - Y.y) * (step(0, q.y));
}
else
{
repeate( p.y, 32.0, 32.0 );
repeat( p.x, 70.0 );
p.x = length(p.x) - 25.0;
L = 2.0 + (p.x < 0. ? length(p.y) : length(p));
L *= 1.0 - 0.5 * Y.z;
}
if( CurScene == 0 )
return max(0., 4.0 * smoothstep(10.,-pow(sin(d+CurTime*15.0*CurTime*220.0)+CurTime*15.0-4.0,.2),L));
return 4.0 * smoothstep(10.,0.0,L);
}
void mat(vec3 p)
{
CurColor = vec3(1.,1.,0.);
CurStep= .3;
//CurNormal.y= 1.5;
float z= f0(p);
if( z > f1(p) )
{
z= f1(p);
CurColor = vec3(0.1);
CurStep= 0.85;
//CurNormal.y= 0.15;
}
if( z > f2(p) )
{
z= f2(p);
CurColor = vec3(0.6,0,0.15);
CurStep= .2;
//CurNormal.y= 0.0;
}
if( z > f3(p) )
{
//Wz= f3(p);
CurColor = vec3(.25);// + animTex(p.zy / 10.0) * 0.6;
CurStep= .1;
m=2;
}
}
void ToRes(vec3 Color, float Factor)
{
cRes+= Color * cFac;
cFac*= Factor;
}
void main()
{
CurScene= floor(Y.x);
CurTime= Y.x - CurScene;
CurAnim= CurTime;
// Get the look direction for the current pixel (always look forwards)
vec3 rayDir = vec3( 0.6, (Z.yx - 0.5));
//Kamera sitzt an dieser Position
vec3 p;
if( CurScene == 0.0 )
{
p= vec3( CurTime * 120. - 120. , -24.0, .0);
rayDir.xy= rotate( rayDir.xy, CurTime - 0.9 );
//rayDir.xz= rotate( rayDir.xz, CurTime );
//rayDir.yz= rotate( rayDir.yz, 0.9 - CurTime );
}
else if( CurScene == 1.0 )
{
p= vec3( 0., 5.0, -2.0);
rayDir.xy= rotate( rayDir.xy, -0.4 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= CurTime*CurTime;
}
else if( CurScene == 2.0 )
{
p= vec3( -CurTime * 200. + 140, -2., 5.0);
rayDir.xy= rotate( rayDir.xy, CurTime-0.8 );
rayDir.xz= rotate( rayDir.xz, 3.14 );
}
else if( CurScene == 3.0 )
{
p= vec3( -25. , 0., CurTime * 20.0 - 19.0);
rayDir.xy= rotate( rayDir.xy, -0.2 );
}
else if( CurScene == 4.0 )
{
p= vec3( 0., 40.0, CurTime *8.);
rayDir.xy= rotate( rayDir.xy, -CurTime );
CurAnim= 0;
}
else if( CurScene == 5.0 )
{
p= vec3( 0., 40.0, CurTime * -64. + 56.);
rayDir.xy= rotate( rayDir.xy, -1.0 );
CurAnim= 0.4*CurTime*CurTime;
}
else if( CurScene == 6.0 )
{
p= vec3( 0., 12.0, CurTime * -12.0);
rayDir.xy= rotate( rayDir.xy, CurTime - 1.5);
rayDir.xz= rotate( rayDir.xz, CurTime );
}
else if( CurScene == 7.0 )
{
p= vec3( -4., CurTime * 64. + 4.0, 0.);
rayDir.xy= rotate( rayDir.xy, -1.0 );
rayDir.xz= rotate( rayDir.xz, -CurTime );
}
else if( CurScene == 8.0 )
{
p= vec3( 8.0, 8.0, CurTime * 24. - 32.);
rayDir.xy= rotate( rayDir.xy, -0.3 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= 0;
}
else if( CurScene == 9.0 )
{
p= vec3( CurTime * 14., 18.0, 0.);
rayDir.xy= rotate( rayDir.xy, -CurTime-0.5 );
CurAnim= CurTime*CurTime;
}
else if( CurScene == 10.0 )
{
p= vec3( 2.0, CurTime * 4. + 2.0, CurTime * 12.+ 7.);
rayDir.xy= rotate( rayDir.xy, -0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime );
}
else if( CurScene == 11.0 )
{
p= vec3( CurTime * 70. - 80., CurTime * -4. + 6.0, CurTime * 64.- 56.);
rayDir.xy= rotate( rayDir.xy, -0.2 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= 4.*CurTime;
}
else if( CurScene == 12.0 )
{
p= vec3( 30.,-8.,-8.);
rayDir.xy= rotate( rayDir.xy, 0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime + 3.0 );
CurAnim= 0.4*CurTime*CurTime;
}
else if( CurScene == 13.0 )
{
p= vec3( -60.,12.,0.);
rayDir.xy= rotate( rayDir.xy, CurTime - 1.5 );
}
else if( CurScene == 14.0 )
{
p= vec3( -22.,0.,-8.);
//rayDir.xy= rotate( rayDir.xy, 0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime + 2.0 );
//CurAnim= 0.4*Y.y;
}
else if( CurScene == 15.0 )
{
p= vec3( 80. * CurTime, 7. ,-0.);
rayDir.xz= rotate( rayDir.xz, 3.*CurTime );
}
if( CurScene == 16.0 )
{
p.x = 43.0;
rayDir.xz= rotate( rayDir.xz, pi2/2.);
CurAnim= CurTime*CurTime;
}
/////////////////////////////////////////////////////////////////////
//Debugzeug fuer Kamerasteuerung
if( true )
{
p.x= gl_ModelViewMatrix[0][0];
p.y= gl_ModelViewMatrix[0][1];
p.z= gl_ModelViewMatrix[0][2];
float a1= gl_ModelViewMatrix[1][1];
float c1,s1;vec3 q1= vec3((Z.xy - 0.5), 0.8);
c1 = cos(a1); s1 = sin(a1);
rayDir.y = c1 * q1.y - s1 * q1.z;
rayDir.x= q1.x;
rayDir.z = s1 * q1.y + c1 * q1.z;
a1= gl_ModelViewMatrix[1][0];
q1=rayDir;
c1 = cos(a1); s1 = sin(a1);
rayDir.x = c1 * q1.x + s1 * q1.z;
rayDir.z = -s1 * q1.x + c1 * q1.z;
}
//Ende Debugzeug fuer Kamerasteuerung
/////////////////////////////////////////////////////////////////////
rayDir = normalize(rayDir);
cRes= vec3( .0 );
cFac=1.0;
float t=0.0,y,z;
m=0;
while (m++<2)
{
//bis zu einer Oberflaeche steppen
//for (CurStep=1.0;t<220.0 && CurStep>t*.003;t+=0.01+max(0.0, CurStep),RayStep=rayDir*t )
for (CurStep=1.0;t<220.0 && CurStep>t*.003;t+=CurStep,RayStep=rayDir*t )
CurStep = f(p+RayStep);
vec3 NextPos = p+RayStep;
VolLight = 0.0;
if( p.y < LightHeight && NextPos.y > LightHeight)
{
float f = (p.y - LightHeight) / (p.y - NextPos.y);
p += RayStep*f;
VolLight = l(p.xz) * smoothstep( 220.0,0.0, f * t );
}
//Startpunkt und Richtung fuer reflektierten Strahl;
p= NextPos;
vec3 n = vec3(0.04, 0.0, 0.0);
n= normalize(vec3( f(p + n.xyy) - f(p - n.xyy), f(p + n.yxy) - f(p - n.yxy), f(p + n.yyx) - f(p - n.yyx) ));
//n= normalize(n);
//CurStep ab hier == Reflektion !!!
mat(p);
float Ambient= 0.45 + 0.4 * dot( n,vec3(0,1.0,0) );
ToRes(vec3(0.7,1.0,0.9)*VolLight,1.0-VolLight);
L= smoothstep( 0.,128., t );
ToRes(vec3( 0.0, 0.0, 0.05 )*L,1.0-L); // FogColor
if( t > 220.0 )
break;
rayDir= reflect( rayDir, n );
//float ao(vec3 p, vec3 n, float d, float i) {
y= 6.0;
for (z=1.0;y>0.;y--)
z-=(y*.5-f(p+n*y*.5))/exp2(y);
CurColor*= z*Ambient;
//CurColor*= .4 + .3 * ( dot(normalize(LightPos-p),n) );
cRes+= cFac*CurColor;//*(1.0-Reflect);
cFac*= CurStep;// Reflect * (1.0-t/tmax);
t= 0.5;
RayStep=rayDir*t;
}
gl_FragColor.xyz = cRes;// + Y.w;// + cFac*FogColor;
}

View File

@@ -0,0 +1,512 @@
#version 130
const int shader= 2;
// Parameters from our host
// x: Scene.Zeit
// y: Base drum envelope
// z: Snare drum envelope
// w: undefinded
in vec4 Y;
// Position of the fragment
in vec2 Z;
// All data of our world
float L, CurScene, CurTime, CurAnim, cFac, CurStep, VolLight, pi2= 6.28319, LightHeight = 50.0;
int m;
vec3 cRes, CurColor, RayStep;
vec2 rotate(vec2 v,float y)
{
return cos(y)*v+sin(y)*vec2(-v.y,v.x);
}
//repeat around y axis w times
//void rp(inout vec3 p, float trans, float w)
float repeatr(inout vec2 v,float x, float y)
{
float a= atan(v.y,v.x);
float z=mod(a,y)-y*.5;
v=(length(v))*vec2(cos(z),sin(z));
v.x-=x;
return a-z;
}
void repeat( inout float w, float y )
{
w= mod( w - y*.5, y ) - y*.5;
}
void repeate( inout float w, float y, float z )
{
w= max( abs(w)-z, mod( w - y*.5, y ) - y*.5);
}
float CBox( in vec3 p, in vec3 box, float rad )
{
return length( max( abs(p) - box + vec3(rad), 0.0 ) ) - rad;
}
float plasm(float x, float a, float b,float c)
{
return sin(x+a+c*sin(x+b));
}
vec3 shad2move()
{
return vec3( CurTime*19.0, 24.0 - cos(CurAnim*9.0) * 8.0, cos(CurAnim*5.0) * 24.0);
}
void schad3transform( inout vec3 p )
{
p.xz = rotate(p.xz, 0.2 * cos( pow(abs(p.x),0.4 - CurTime * 0.1)) );
p.yx = rotate(p.yx, 0.2 * cos( pow(abs(p.x),0.3 + CurTime * 0.1)) );
}
float f0(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
repeat(p.x, 0.5);
return max( length(p.x) - 0.1, CBox( p, vec3(1000.,1.4,1.4), .5));
}
if( shader == 1 )
{
p -= shad2move();
//p.y = rotate(p.yz, 50. *CurAnim );
p.x = length (p.xz)+4*Y.y - 12.5;
repeat (p.x, 24.0);
return length( max( abs(p.xy) - vec2(3., .2), 0.0 ) ) - 0.2;
}
if( shader == 2 )
{
float d = p.x;
repeat(p.x, pi2);
p.y -= 0.3 * cos( (p.z + d - p.x)*.5);
p.z += 128.0 * CurTime * cos(0.7 * (d-p.x) );
repeat(p.z, 2.4);
return CBox( p, vec3(1.0, 0.1, 1.0), 0.1);
}
if( shader == 3 )
{
p.x -= 128. * CurAnim;
repeat(p.x, 64.);
p.x = length( p.x ) - 11.;
return (p.x < 0.0 ? length( p.yz ): length( p )) - 5.0 ;
}
}
float f1(vec3 p)
{
if( shader == 0 )
{
float d = p.y - 5.;
p.x *= 1.0;
repeat(p.x, 20.);
repeatr(p.yz, 28.0, pi2 / 9.0);
return max( d, CBox( p, vec3(10.,2.0,10.), 3.));
}
if( shader == 1 )
{
vec3 o= p;
repeat(p.x, 8.0);
repeat(p.z, 8.0);
o -= shad2move();
p.xz = rotate(p.xz, atan(o.x, o.z) );
p.yz = rotate(p.yz, atan(length(o.xz), 48.0) );
float d = CBox( p, vec3(2.5 , 2.0, 2.5), 0.8);
p.y += 12.;
return max(d, length(p)- 12.);
}
if( shader == 2 )
{
float d = p.z;
repeat(p.z, pi2);
p.y += 0.3 * cos( (p.x + d - p.z)*.5);
return CBox( p, vec3(1000.0, 0.1, 2.0), 0.1);
}
if( shader == 3 )
{
p.z = length(p.z) + 15.;
float d = length(p.y) - 15.;
repeat(p.x, 100.);
//repeat(p.y, 9.);
repeatr(p.zy, 85.0, pi2 / 40.0);
repeatr(p.zx, 58.0, pi2 / 50.0);
return max( d, CBox( p, vec3(4.,3.,1.), 1.)); //max( length(p) - 64., CBox( p, vec3(4.,4.,80.), 1.));
}
}
float f2(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
p.x += 256.0 * CurAnim;
repeat(p.x, 32.0);
return length(vec2(length(p.yz) - 3.0,p.x)) - 1.- Y.y;
}
if( shader == 1 )
{
return length(p-shad2move()) - 12.0;
}
if( shader == 2 )
{
p.y -= 8.;
float d = p.x;
repeat(p.x, 32.0);
p.yz = rotate(p.yz, plasm(d-p.x, 2., CurAnim, 1.0)- Y.z );
p.xz = rotate(p.xz, plasm(d-p.x, 1., CurAnim, 2.0) );
return CBox( p, vec3(8.0), 6. - CurAnim);
}
if( shader == 3 )
{
p.yz = rotate(p.yz, plasm(round(p.x / 8.0), 1., 4.0*CurTime, 2.0) );
repeat(p.x, 8.0);
repeatr(p.yz, 0.0, pi2 / 10.0);
return max( abs(length(p.yz) - 6.0)-.2, abs(length(p.xz) - 2.+0.5*Y.y)-.3);
}
}
float f3(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
return CBox( p, vec3(1000.,1.,1.), .1);
}
if( shader == 1 )
{
p.y += 20.;
repeat( p.x, 6.3);
repeat( p.z, 1.3);
//repeatr(p.xz, .0, pi2 / 4.0);
return CBox( p, vec3(3.0, 15.0, 0.5), 0.4);
}
if( shader == 2 )
{
p.y -= 20.;
repeat( p.x, 20.0);
repeat( p.z, 20.0);
repeatr(p.xz, .0, pi2 / 4.0);
return CBox( p, vec3(1000.0, 1.0, 1.0), 0.2);
}
if( shader == 3 )
{
repeat(p.z, 6.);
repeat(p.x, 5.5);
repeatr(p.xz, 2.0, pi2 / 6.0);
return max( abs(1.-length(p.xz))-0.1,abs(length(p.y)-15.0)-0.1);
}
}
float f(vec3 p)
{
return (Y.y * 0.003+0.001) * plasm(p.x+Y.y*9., p.y, p.z, 1.0-Y.y) + min( min( min( f0(p), f1(p) ), f2(p) ), f3(p) );
}
float l(vec2 p)
{
float d = floor(0.5 - p.y/32.0) + floor(0.5 - p.x/70.0) * 3.;
if( shader == 1 || shader == 2 )
{
d= plasm( 33.0 * floor(0.5 - p.y/20.0), 17.0 * floor(0.5 - p.x/20.0), floor(CurTime * 8.0), 1.0);
repeate( p.x, 20.0, 60.0 );
repeat( p.y, 20.0);
L = length( max( abs(p) - vec2(3.0), 0.0 ) ) + 2.0;// max( length(p.x), length(p.y));
if (d > 0.5)
L /= 1.0 - 0.5 * Y.y;
else
L /= 1.0 - 0.5 * Y.z;
//float sync = shader == 1 ? Y.z : Y.y;
//repeate( p.x, 20.0, 60.0 );
//repeate( p.y, 20.0, 100.0 );
//vec2 q = p;
//q.y += 10;
//repeat (q.y, 40.0);
//repeat( p.y, 20.0);
//repeat( p.x, 20.0);
//L = length( max( abs(p) - vec2(3.0), 0.0 ) ) + 1.0;// max( length(p.x), length(p.y));
//L = L * step(q.y, 0) + L * step(0, q.y) / (1.0 - 0.3 * sync);
//L /= (1.0 - Y.y) * (step(0, q.y));
}
else
{
repeate( p.y, 32.0, 32.0 );
repeat( p.x, 70.0 );
p.x = length(p.x) - 25.0;
L = 2.0 + (p.x < 0. ? length(p.y) : length(p));
L *= 1.0 - 0.5 * Y.z;
}
if( CurScene == 0 )
return max(0., 4.0 * smoothstep(10.,-pow(sin(d+CurTime*15.0*CurTime*220.0)+CurTime*15.0-4.0,.2),L));
return 4.0 * smoothstep(10.,0.0,L);
}
void mat(vec3 p)
{
CurColor = vec3(1.,1.,0.);
CurStep= .3;
//CurNormal.y= 1.5;
float z= f0(p);
if( z > f1(p) )
{
z= f1(p);
CurColor = vec3(0.1);
CurStep= 0.85;
//CurNormal.y= 0.15;
}
if( z > f2(p) )
{
z= f2(p);
CurColor = vec3(0.6,0,0.15);
CurStep= .2;
//CurNormal.y= 0.0;
}
if( z > f3(p) )
{
//Wz= f3(p);
CurColor = vec3(.25);// + animTex(p.zy / 10.0) * 0.6;
CurStep= .1;
m=2;
}
}
void ToRes(vec3 Color, float Factor)
{
cRes+= Color * cFac;
cFac*= Factor;
}
void main()
{
CurScene= floor(Y.x);
CurTime= Y.x - CurScene;
CurAnim= CurTime;
// Get the look direction for the current pixel (always look forwards)
vec3 rayDir = vec3( 0.6, (Z.yx - 0.5));
//Kamera sitzt an dieser Position
vec3 p;
if( CurScene == 0.0 )
{
p= vec3( CurTime * 120. - 120. , -24.0, .0);
rayDir.xy= rotate( rayDir.xy, CurTime - 0.9 );
//rayDir.xz= rotate( rayDir.xz, CurTime );
//rayDir.yz= rotate( rayDir.yz, 0.9 - CurTime );
}
else if( CurScene == 1.0 )
{
p= vec3( 0., 5.0, -2.0);
rayDir.xy= rotate( rayDir.xy, -0.4 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= CurTime*CurTime;
}
else if( CurScene == 2.0 )
{
p= vec3( -CurTime * 200. + 140, -2., 5.0);
rayDir.xy= rotate( rayDir.xy, CurTime-0.8 );
rayDir.xz= rotate( rayDir.xz, 3.14 );
}
else if( CurScene == 3.0 )
{
p= vec3( -25. , 0., CurTime * 20.0 - 19.0);
rayDir.xy= rotate( rayDir.xy, -0.2 );
}
else if( CurScene == 4.0 )
{
p= vec3( 0., 40.0, CurTime *8.);
rayDir.xy= rotate( rayDir.xy, -CurTime );
CurAnim= 0;
}
else if( CurScene == 5.0 )
{
p= vec3( 0., 40.0, CurTime * -64. + 56.);
rayDir.xy= rotate( rayDir.xy, -1.0 );
CurAnim= 0.4*CurTime*CurTime;
}
else if( CurScene == 6.0 )
{
p= vec3( 0., 12.0, CurTime * -12.0);
rayDir.xy= rotate( rayDir.xy, CurTime - 1.5);
rayDir.xz= rotate( rayDir.xz, CurTime );
}
else if( CurScene == 7.0 )
{
p= vec3( -4., CurTime * 64. + 4.0, 0.);
rayDir.xy= rotate( rayDir.xy, -1.0 );
rayDir.xz= rotate( rayDir.xz, -CurTime );
}
else if( CurScene == 8.0 )
{
p= vec3( 8.0, 8.0, CurTime * 24. - 32.);
rayDir.xy= rotate( rayDir.xy, -0.3 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= 0;
}
else if( CurScene == 9.0 )
{
p= vec3( CurTime * 14., 18.0, 0.);
rayDir.xy= rotate( rayDir.xy, -CurTime-0.5 );
CurAnim= CurTime*CurTime;
}
else if( CurScene == 10.0 )
{
p= vec3( 2.0, CurTime * 4. + 2.0, CurTime * 12.+ 7.);
rayDir.xy= rotate( rayDir.xy, -0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime );
}
else if( CurScene == 11.0 )
{
p= vec3( CurTime * 70. - 80., CurTime * -4. + 6.0, CurTime * 64.- 56.);
rayDir.xy= rotate( rayDir.xy, -0.2 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= 4.*CurTime;
}
else if( CurScene == 12.0 )
{
p= vec3( 30.,-8.,-8.);
rayDir.xy= rotate( rayDir.xy, 0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime + 3.0 );
CurAnim= 0.4*CurTime*CurTime;
}
else if( CurScene == 13.0 )
{
p= vec3( -60.,12.,0.);
rayDir.xy= rotate( rayDir.xy, CurTime - 1.5 );
}
else if( CurScene == 14.0 )
{
p= vec3( -22.,0.,-8.);
//rayDir.xy= rotate( rayDir.xy, 0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime + 2.0 );
//CurAnim= 0.4*Y.y;
}
else if( CurScene == 15.0 )
{
p= vec3( 80. * CurTime, 7. ,-0.);
rayDir.xz= rotate( rayDir.xz, 3.*CurTime );
}
if( CurScene == 16.0 )
{
p.x = 43.0;
rayDir.xz= rotate( rayDir.xz, pi2/2.);
CurAnim= CurTime*CurTime;
}
rayDir = normalize(rayDir);
cRes= vec3( .0 );
cFac=1.0;
float t=0.0,y,z;
m=0;
while (m++<2)
{
//bis zu einer Oberflaeche steppen
//for (CurStep=1.0;t<220.0 && CurStep>t*.003;t+=0.01+max(0.0, CurStep),RayStep=rayDir*t )
for (CurStep=1.0;t<220.0 && CurStep>t*.003;t+=CurStep,RayStep=rayDir*t )
CurStep = f(p+RayStep);
vec3 NextPos = p+RayStep;
VolLight = 0.0;
if( p.y < LightHeight && NextPos.y > LightHeight)
{
float f = (p.y - LightHeight) / (p.y - NextPos.y);
p += RayStep*f;
VolLight = l(p.xz) * smoothstep( 220.0,0.0, f * t );
}
//Startpunkt und Richtung fuer reflektierten Strahl;
p= NextPos;
vec3 n = vec3(0.04, 0.0, 0.0);
n= normalize(vec3( f(p + n.xyy) - f(p - n.xyy), f(p + n.yxy) - f(p - n.yxy), f(p + n.yyx) - f(p - n.yyx) ));
//n= normalize(n);
//CurStep ab hier == Reflektion !!!
mat(p);
float Ambient= 0.45 + 0.4 * dot( n,vec3(0,1.0,0) );
ToRes(vec3(0.7,1.0,0.9)*VolLight,1.0-VolLight);
L= smoothstep( 0.,128., t );
ToRes(vec3( 0.0, 0.0, 0.05 )*L,1.0-L); // FogColor
if( t > 220.0 )
break;
rayDir= reflect( rayDir, n );
//float ao(vec3 p, vec3 n, float d, float i) {
y= 6.0;
for (z=1.0;y>0.;y--)
z-=(y*.5-f(p+n*y*.5))/exp2(y);
CurColor*= z*Ambient;
//CurColor*= .4 + .3 * ( dot(normalize(LightPos-p),n) );
cRes+= cFac*CurColor;//*(1.0-Reflect);
cFac*= CurStep;// Reflect * (1.0-t/tmax);
t= 0.5;
RayStep=rayDir*t;
}
gl_FragColor.xyz = cRes;// + Y.w;// + cFac*FogColor;
}

View File

@@ -0,0 +1,512 @@
#version 130
const int shader= 2;
// Parameters from our host
// x: Scene.Zeit
// y: Base drum envelope
// z: Snare drum envelope
// w: undefinded
in vec4 Y;
// Position of the fragment
in vec2 Z;
// All data of our world
float L, CurScene, CurTime, CurAnim, cFac, CurStep, VolLight, pi2= 6.28319, LightHeight = 50.0;
int m;
vec3 cRes, CurColor, RayStep;
vec2 rotate(vec2 v,float y)
{
return cos(y)*v+sin(y)*vec2(-v.y,v.x);
}
//repeat around y axis w times
//void rp(inout vec3 p, float trans, float w)
float repeatr(inout vec2 v,float x, float y)
{
float a= atan(v.y,v.x);
float z=mod(a,y)-y*.5;
v=(length(v))*vec2(cos(z),sin(z));
v.x-=x;
return a-z;
}
void repeat( inout float w, float y )
{
w= mod( w - y*.5, y ) - y*.5;
}
void repeate( inout float w, float y, float z )
{
w= max( abs(w)-z, mod( w - y*.5, y ) - y*.5);
}
float CBox( in vec3 p, in vec3 box, float rad )
{
return length( max( abs(p) - box + vec3(rad), 0.0 ) ) - rad;
}
float plasm(float x, float a, float b,float c)
{
return sin(x+a+c*sin(x+b));
}
vec3 shad2move()
{
return vec3( CurTime*19.0, 24.0 - cos(CurAnim*9.0) * 8.0, cos(CurAnim*5.0) * 24.0);
}
void schad3transform( inout vec3 p )
{
p.xz = rotate(p.xz, 0.2 * cos( pow(abs(p.x),0.4 - CurTime * 0.1)) );
p.yx = rotate(p.yx, 0.2 * cos( pow(abs(p.x),0.3 + CurTime * 0.1)) );
}
float f0(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
repeat(p.x, 0.5);
return max( length(p.x) - 0.1, CBox( p, vec3(1000.,1.4,1.4), .5));
}
if( shader == 1 )
{
p -= shad2move();
//p.y = rotate(p.yz, 50. *CurAnim );
p.x = length (p.xz)+4*Y.y - 12.5;
repeat (p.x, 24.0);
return length( max( abs(p.xy) - vec2(3., .2), 0.0 ) ) - 0.2;
}
if( shader == 2 )
{
float d = p.x;
repeat(p.x, pi2);
p.y -= 0.3 * cos( (p.z + d - p.x)*.5);
p.z += 128.0 * CurTime * cos(0.7 * (d-p.x) );
repeat(p.z, 2.4);
return CBox( p, vec3(1.0, 0.1, 1.0), 0.1);
}
if( shader == 3 )
{
p.x -= 128. * CurAnim;
repeat(p.x, 64.);
p.x = length( p.x ) - 11.;
return (p.x < 0.0 ? length( p.yz ): length( p )) - 5.0 ;
}
}
float f1(vec3 p)
{
if( shader == 0 )
{
float d = p.y - 5.;
p.x *= 1.0;
repeat(p.x, 20.);
repeatr(p.yz, 28.0, pi2 / 9.0);
return max( d, CBox( p, vec3(10.,2.0,10.), 3.));
}
if( shader == 1 )
{
vec3 o= p;
repeat(p.x, 8.0);
repeat(p.z, 8.0);
o -= shad2move();
p.xz = rotate(p.xz, atan(o.x, o.z) );
p.yz = rotate(p.yz, atan(length(o.xz), 48.0) );
float d = CBox( p, vec3(2.5 , 2.0, 2.5), 0.8);
p.y += 12.;
return max(d, length(p)- 12.);
}
if( shader == 2 )
{
float d = p.z;
repeat(p.z, pi2);
p.y += 0.3 * cos( (p.x + d - p.z)*.5);
return CBox( p, vec3(1000.0, 0.1, 2.0), 0.1);
}
if( shader == 3 )
{
p.z = length(p.z) + 15.;
float d = length(p.y) - 15.;
repeat(p.x, 100.);
//repeat(p.y, 9.);
repeatr(p.zy, 85.0, pi2 / 40.0);
repeatr(p.zx, 58.0, pi2 / 50.0);
return max( d, CBox( p, vec3(4.,3.,1.), 1.)); //max( length(p) - 64., CBox( p, vec3(4.,4.,80.), 1.));
}
}
float f2(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
p.x += 256.0 * CurAnim;
repeat(p.x, 32.0);
return length(vec2(length(p.yz) - 3.0,p.x)) - 1.- Y.y;
}
if( shader == 1 )
{
return length(p-shad2move()) - 12.0;
}
if( shader == 2 )
{
p.y -= 8.;
float d = p.x;
repeat(p.x, 32.0);
p.yz = rotate(p.yz, plasm(d-p.x, 2., CurAnim, 1.0)- Y.z );
p.xz = rotate(p.xz, plasm(d-p.x, 1., CurAnim, 2.0) );
return CBox( p, vec3(8.0), 6. - CurAnim);
}
if( shader == 3 )
{
p.yz = rotate(p.yz, plasm(round(p.x / 8.0), 1., 4.0*CurTime, 2.0) );
repeat(p.x, 8.0);
repeatr(p.yz, 0.0, pi2 / 10.0);
return max( abs(length(p.yz) - 6.0)-.2, abs(length(p.xz) - 2.+0.5*Y.y)-.3);
}
}
float f3(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
return CBox( p, vec3(1000.,1.,1.), .1);
}
if( shader == 1 )
{
p.y += 20.;
repeat( p.x, 6.3);
repeat( p.z, 1.3);
//repeatr(p.xz, .0, pi2 / 4.0);
return CBox( p, vec3(3.0, 15.0, 0.5), 0.4);
}
if( shader == 2 )
{
p.y -= 20.;
repeat( p.x, 20.0);
repeat( p.z, 20.0);
repeatr(p.xz, .0, pi2 / 4.0);
return CBox( p, vec3(1000.0, 1.0, 1.0), 0.2);
}
if( shader == 3 )
{
repeat(p.z, 6.);
repeat(p.x, 5.5);
repeatr(p.xz, 2.0, pi2 / 6.0);
return max( abs(1.-length(p.xz))-0.1,abs(length(p.y)-15.0)-0.1);
}
}
float f(vec3 p)
{
return (Y.y * 0.003+0.001) * plasm(p.x+Y.y*9., p.y, p.z, 1.0-Y.y) + min( min( min( f0(p), f1(p) ), f2(p) ), f3(p) );
}
float l(vec2 p)
{
float d = floor(0.5 - p.y/32.0) + floor(0.5 - p.x/70.0) * 3.;
if( shader == 1 || shader == 2 )
{
d= plasm( 33.0 * floor(0.5 - p.y/20.0), 17.0 * floor(0.5 - p.x/20.0), floor(CurTime * 8.0), 1.0);
repeate( p.x, 20.0, 60.0 );
repeat( p.y, 20.0);
L = length( max( abs(p) - vec2(3.0), 0.0 ) ) + 2.0;// max( length(p.x), length(p.y));
if (d > 0.5)
L /= 1.0 - 0.5 * Y.y;
else
L /= 1.0 - 0.5 * Y.z;
//float sync = shader == 1 ? Y.z : Y.y;
//repeate( p.x, 20.0, 60.0 );
//repeate( p.y, 20.0, 100.0 );
//vec2 q = p;
//q.y += 10;
//repeat (q.y, 40.0);
//repeat( p.y, 20.0);
//repeat( p.x, 20.0);
//L = length( max( abs(p) - vec2(3.0), 0.0 ) ) + 1.0;// max( length(p.x), length(p.y));
//L = L * step(q.y, 0) + L * step(0, q.y) / (1.0 - 0.3 * sync);
//L /= (1.0 - Y.y) * (step(0, q.y));
}
else
{
repeate( p.y, 32.0, 32.0 );
repeat( p.x, 70.0 );
p.x = length(p.x) - 25.0;
L = 2.0 + (p.x < 0. ? length(p.y) : length(p));
L *= 1.0 - 0.5 * Y.z;
}
if( CurScene == 0 )
return max(0., 4.0 * smoothstep(10.,-pow(sin(d+CurTime*15.0*CurTime*220.0)+CurTime*15.0-4.0,.2),L));
return 4.0 * smoothstep(10.,0.0,L);
}
void mat(vec3 p)
{
CurColor = vec3(1.,1.,0.);
CurStep= .3;
//CurNormal.y= 1.5;
float z= f0(p);
if( z > f1(p) )
{
z= f1(p);
CurColor = vec3(0.1);
CurStep= 0.85;
//CurNormal.y= 0.15;
}
if( z > f2(p) )
{
z= f2(p);
CurColor = vec3(0.6,0,0.15);
CurStep= .2;
//CurNormal.y= 0.0;
}
if( z > f3(p) )
{
//Wz= f3(p);
CurColor = vec3(.25);// + animTex(p.zy / 10.0) * 0.6;
CurStep= .1;
m=2;
}
}
void ToRes(vec3 Color, float Factor)
{
cRes+= Color * cFac;
cFac*= Factor;
}
void main()
{
CurScene= floor(Y.x);
CurTime= Y.x - CurScene;
CurAnim= CurTime;
// Get the look direction for the current pixel (always look forwards)
vec3 rayDir = vec3( 0.6, (Z.yx - 0.5));
//Kamera sitzt an dieser Position
vec3 p;
if( CurScene == 0.0 )
{
p= vec3( CurTime * 120. - 120. , -24.0, .0);
rayDir.xy= rotate( rayDir.xy, CurTime - 0.9 );
//rayDir.xz= rotate( rayDir.xz, CurTime );
//rayDir.yz= rotate( rayDir.yz, 0.9 - CurTime );
}
else if( CurScene == 1.0 )
{
p= vec3( 0., 5.0, -2.0);
rayDir.xy= rotate( rayDir.xy, -0.4 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= CurTime*CurTime;
}
else if( CurScene == 2.0 )
{
p= vec3( -CurTime * 200. + 140, -2., 5.0);
rayDir.xy= rotate( rayDir.xy, CurTime-0.8 );
rayDir.xz= rotate( rayDir.xz, 3.14 );
}
else if( CurScene == 3.0 )
{
p= vec3( -25. , 0., CurTime * 20.0 - 19.0);
rayDir.xy= rotate( rayDir.xy, -0.2 );
}
else if( CurScene == 4.0 )
{
p= vec3( 0., 40.0, CurTime *8.);
rayDir.xy= rotate( rayDir.xy, -CurTime );
CurAnim= 0;
}
else if( CurScene == 5.0 )
{
p= vec3( 0., 40.0, CurTime * -64. + 56.);
rayDir.xy= rotate( rayDir.xy, -1.0 );
CurAnim= 0.4*CurTime*CurTime;
}
else if( CurScene == 6.0 )
{
p= vec3( 0., 12.0, CurTime * -12.0);
rayDir.xy= rotate( rayDir.xy, CurTime - 1.5);
rayDir.xz= rotate( rayDir.xz, CurTime );
}
else if( CurScene == 7.0 )
{
p= vec3( -4., CurTime * 64. + 4.0, 0.);
rayDir.xy= rotate( rayDir.xy, -1.0 );
rayDir.xz= rotate( rayDir.xz, -CurTime );
}
else if( CurScene == 8.0 )
{
p= vec3( 8.0, 8.0, CurTime * 24. - 32.);
rayDir.xy= rotate( rayDir.xy, -0.3 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= 0;
}
else if( CurScene == 9.0 )
{
p= vec3( CurTime * 14., 18.0, 0.);
rayDir.xy= rotate( rayDir.xy, -CurTime-0.5 );
CurAnim= CurTime*CurTime;
}
else if( CurScene == 10.0 )
{
p= vec3( 2.0, CurTime * 4. + 2.0, CurTime * 12.+ 7.);
rayDir.xy= rotate( rayDir.xy, -0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime );
}
else if( CurScene == 11.0 )
{
p= vec3( CurTime * 70. - 80., CurTime * -4. + 6.0, CurTime * 64.- 56.);
rayDir.xy= rotate( rayDir.xy, -0.2 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= 4.*CurTime;
}
else if( CurScene == 12.0 )
{
p= vec3( 30.,-8.,-8.);
rayDir.xy= rotate( rayDir.xy, 0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime + 3.0 );
CurAnim= 0.4*CurTime*CurTime;
}
else if( CurScene == 13.0 )
{
p= vec3( -60.,12.,0.);
rayDir.xy= rotate( rayDir.xy, CurTime - 1.5 );
}
else if( CurScene == 14.0 )
{
p= vec3( -22.,0.,-8.);
//rayDir.xy= rotate( rayDir.xy, 0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime + 2.0 );
//CurAnim= 0.4*Y.y;
}
else if( CurScene == 15.0 )
{
p= vec3( 80. * CurTime, 7. ,-0.);
rayDir.xz= rotate( rayDir.xz, 3.*CurTime );
}
if( CurScene == 16.0 )
{
p.x = 43.0;
rayDir.xz= rotate( rayDir.xz, pi2/2.);
CurAnim= CurTime*CurTime;
}
/////////////////////////////////////////////////////////////////////
//Debugzeug fuer Kamerasteuerung
if( true )
{
p.x= gl_ModelViewMatrix[0][0];
p.y= gl_ModelViewMatrix[0][1];
p.z= gl_ModelViewMatrix[0][2];
float a1= gl_ModelViewMatrix[1][1];
float c1,s1;vec3 q1= vec3((Z.xy - 0.5), 0.8);
c1 = cos(a1); s1 = sin(a1);
rayDir.y = c1 * q1.y - s1 * q1.z;
rayDir.x= q1.x;
rayDir.z = s1 * q1.y + c1 * q1.z;
a1= gl_ModelViewMatrix[1][0];
q1=rayDir;
c1 = cos(a1); s1 = sin(a1);
rayDir.x = c1 * q1.x + s1 * q1.z;
rayDir.z = -s1 * q1.x + c1 * q1.z;
}
//Ende Debugzeug fuer Kamerasteuerung
/////////////////////////////////////////////////////////////////////
rayDir = normalize(rayDir);
cRes= vec3( .0 );
cFac=1.0;
float t=0.0,y,z;
m=0;
while (m++<2)
{
//bis zu einer Oberflaeche steppen
//for (CurStep=1.0;t<220.0 && CurStep>t*.003;t+=0.01+max(0.0, CurStep),RayStep=rayDir*t )
for (CurStep=1.0;t<220.0 && CurStep>t*.003;t+=CurStep,RayStep=rayDir*t )
CurStep = f(p+RayStep);
vec3 NextPos = p+RayStep;
VolLight = 0.0;
if( p.y < LightHeight && NextPos.y > LightHeight)
{
float f = (p.y - LightHeight) / (p.y - NextPos.y);
p += RayStep*f;
VolLight = l(p.xz) * smoothstep( 220.0,0.0, f * t );
}
//Startpunkt und Richtung fuer reflektierten Strahl;
p= NextPos;
vec3 n = vec3(0.04, 0.0, 0.0);
n= normalize(vec3( f(p + n.xyy) - f(p - n.xyy), f(p + n.yxy) - f(p - n.yxy), f(p + n.yyx) - f(p - n.yyx) ));
//n= normalize(n);
//CurStep ab hier == Reflektion !!!
mat(p);
float Ambient= 0.45 + 0.4 * dot( n,vec3(0,1.0,0) );
ToRes(vec3(0.7,1.0,0.9)*VolLight,1.0-VolLight);
L= smoothstep( 0.,128., t );
ToRes(vec3( 0.0, 0.0, 0.05 )*L,1.0-L); // FogColor
if( t > 220.0 )
break;
rayDir= reflect( rayDir, n );
//float ao(vec3 p, vec3 n, float d, float i) {
y= 6.0;
for (z=1.0;y>0.;y--)
z-=(y*.5-f(p+n*y*.5))/exp2(y);
CurColor*= z*Ambient;
//CurColor*= .4 + .3 * ( dot(normalize(LightPos-p),n) );
cRes+= cFac*CurColor;//*(1.0-Reflect);
cFac*= CurStep;// Reflect * (1.0-t/tmax);
t= 0.5;
RayStep=rayDir*t;
}
gl_FragColor.xyz = cRes;// + Y.w;// + cFac*FogColor;
}

View File

@@ -0,0 +1,512 @@
#version 130
const int shader= 3;
// Parameters from our host
// x: Scene.Zeit
// y: Base drum envelope
// z: Snare drum envelope
// w: undefinded
in vec4 Y;
// Position of the fragment
in vec2 Z;
// All data of our world
float L, CurScene, CurTime, CurAnim, cFac, CurStep, VolLight, pi2= 6.28319, LightHeight = 50.0;
int m;
vec3 cRes, CurColor, RayStep;
vec2 rotate(vec2 v,float y)
{
return cos(y)*v+sin(y)*vec2(-v.y,v.x);
}
//repeat around y axis w times
//void rp(inout vec3 p, float trans, float w)
float repeatr(inout vec2 v,float x, float y)
{
float a= atan(v.y,v.x);
float z=mod(a,y)-y*.5;
v=(length(v))*vec2(cos(z),sin(z));
v.x-=x;
return a-z;
}
void repeat( inout float w, float y )
{
w= mod( w - y*.5, y ) - y*.5;
}
void repeate( inout float w, float y, float z )
{
w= max( abs(w)-z, mod( w - y*.5, y ) - y*.5);
}
float CBox( in vec3 p, in vec3 box, float rad )
{
return length( max( abs(p) - box + vec3(rad), 0.0 ) ) - rad;
}
float plasm(float x, float a, float b,float c)
{
return sin(x+a+c*sin(x+b));
}
vec3 shad2move()
{
return vec3( CurTime*19.0, 24.0 - cos(CurAnim*9.0) * 8.0, cos(CurAnim*5.0) * 24.0);
}
void schad3transform( inout vec3 p )
{
p.xz = rotate(p.xz, 0.2 * cos( pow(abs(p.x),0.4 - CurTime * 0.1)) );
p.yx = rotate(p.yx, 0.2 * cos( pow(abs(p.x),0.3 + CurTime * 0.1)) );
}
float f0(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
repeat(p.x, 0.5);
return max( length(p.x) - 0.1, CBox( p, vec3(1000.,1.4,1.4), .5));
}
if( shader == 1 )
{
p -= shad2move();
//p.y = rotate(p.yz, 50. *CurAnim );
p.x = length (p.xz)+4*Y.y - 12.5;
repeat (p.x, 24.0);
return length( max( abs(p.xy) - vec2(3., .2), 0.0 ) ) - 0.2;
}
if( shader == 2 )
{
float d = p.x;
repeat(p.x, pi2);
p.y -= 0.3 * cos( (p.z + d - p.x)*.5);
p.z += 128.0 * CurTime * cos(0.7 * (d-p.x) );
repeat(p.z, 2.4);
return CBox( p, vec3(1.0, 0.1, 1.0), 0.1);
}
if( shader == 3 )
{
p.x -= 128. * CurAnim;
repeat(p.x, 64.);
p.x = length( p.x ) - 11.;
return (p.x < 0.0 ? length( p.yz ): length( p )) - 5.0 ;
}
}
float f1(vec3 p)
{
if( shader == 0 )
{
float d = p.y - 5.;
p.x *= 1.0;
repeat(p.x, 20.);
repeatr(p.yz, 28.0, pi2 / 9.0);
return max( d, CBox( p, vec3(10.,2.0,10.), 3.));
}
if( shader == 1 )
{
vec3 o= p;
repeat(p.x, 8.0);
repeat(p.z, 8.0);
o -= shad2move();
p.xz = rotate(p.xz, atan(o.x, o.z) );
p.yz = rotate(p.yz, atan(length(o.xz), 48.0) );
float d = CBox( p, vec3(2.5 , 2.0, 2.5), 0.8);
p.y += 12.;
return max(d, length(p)- 12.);
}
if( shader == 2 )
{
float d = p.z;
repeat(p.z, pi2);
p.y += 0.3 * cos( (p.x + d - p.z)*.5);
return CBox( p, vec3(1000.0, 0.1, 2.0), 0.1);
}
if( shader == 3 )
{
p.z = length(p.z) + 15.;
float d = length(p.y) - 15.;
repeat(p.x, 100.);
//repeat(p.y, 9.);
repeatr(p.zy, 85.0, pi2 / 40.0);
repeatr(p.zx, 58.0, pi2 / 50.0);
return max( d, CBox( p, vec3(4.,3.,1.), 1.)); //max( length(p) - 64., CBox( p, vec3(4.,4.,80.), 1.));
}
}
float f2(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
p.x += 256.0 * CurAnim;
repeat(p.x, 32.0);
return length(vec2(length(p.yz) - 3.0,p.x)) - 1.- Y.y;
}
if( shader == 1 )
{
return length(p-shad2move()) - 12.0;
}
if( shader == 2 )
{
p.y -= 8.;
float d = p.x;
repeat(p.x, 32.0);
p.yz = rotate(p.yz, plasm(d-p.x, 2., CurAnim, 1.0)- Y.z );
p.xz = rotate(p.xz, plasm(d-p.x, 1., CurAnim, 2.0) );
return CBox( p, vec3(8.0), 6. - CurAnim);
}
if( shader == 3 )
{
p.yz = rotate(p.yz, plasm(round(p.x / 8.0), 1., 4.0*CurTime, 2.0) );
repeat(p.x, 8.0);
repeatr(p.yz, 0.0, pi2 / 10.0);
return max( abs(length(p.yz) - 6.0)-.2, abs(length(p.xz) - 2.+0.5*Y.y)-.3);
}
}
float f3(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
return CBox( p, vec3(1000.,1.,1.), .1);
}
if( shader == 1 )
{
p.y += 20.;
repeat( p.x, 6.3);
repeat( p.z, 1.3);
//repeatr(p.xz, .0, pi2 / 4.0);
return CBox( p, vec3(3.0, 15.0, 0.5), 0.4);
}
if( shader == 2 )
{
p.y -= 20.;
repeat( p.x, 20.0);
repeat( p.z, 20.0);
repeatr(p.xz, .0, pi2 / 4.0);
return CBox( p, vec3(1000.0, 1.0, 1.0), 0.2);
}
if( shader == 3 )
{
repeat(p.z, 6.);
repeat(p.x, 5.5);
repeatr(p.xz, 2.0, pi2 / 6.0);
return max( abs(1.-length(p.xz))-0.1,abs(length(p.y)-15.0)-0.1);
}
}
float f(vec3 p)
{
return (Y.y * 0.003+0.001) * plasm(p.x+Y.y*9., p.y, p.z, 1.0-Y.y) + min( min( min( f0(p), f1(p) ), f2(p) ), f3(p) );
}
float l(vec2 p)
{
float d = floor(0.5 - p.y/32.0) + floor(0.5 - p.x/70.0) * 3.;
if( shader == 1 || shader == 2 )
{
d= plasm( 33.0 * floor(0.5 - p.y/20.0), 17.0 * floor(0.5 - p.x/20.0), floor(CurTime * 8.0), 1.0);
repeate( p.x, 20.0, 60.0 );
repeat( p.y, 20.0);
L = length( max( abs(p) - vec2(3.0), 0.0 ) ) + 2.0;// max( length(p.x), length(p.y));
if (d > 0.5)
L /= 1.0 - 0.5 * Y.y;
else
L /= 1.0 - 0.5 * Y.z;
//float sync = shader == 1 ? Y.z : Y.y;
//repeate( p.x, 20.0, 60.0 );
//repeate( p.y, 20.0, 100.0 );
//vec2 q = p;
//q.y += 10;
//repeat (q.y, 40.0);
//repeat( p.y, 20.0);
//repeat( p.x, 20.0);
//L = length( max( abs(p) - vec2(3.0), 0.0 ) ) + 1.0;// max( length(p.x), length(p.y));
//L = L * step(q.y, 0) + L * step(0, q.y) / (1.0 - 0.3 * sync);
//L /= (1.0 - Y.y) * (step(0, q.y));
}
else
{
repeate( p.y, 32.0, 32.0 );
repeat( p.x, 70.0 );
p.x = length(p.x) - 25.0;
L = 2.0 + (p.x < 0. ? length(p.y) : length(p));
L *= 1.0 - 0.5 * Y.z;
}
if( CurScene == 0 )
return max(0., 4.0 * smoothstep(10.,-pow(sin(d+CurTime*15.0*CurTime*220.0)+CurTime*15.0-4.0,.2),L));
return 4.0 * smoothstep(10.,0.0,L);
}
void mat(vec3 p)
{
CurColor = vec3(1.,1.,0.);
CurStep= .3;
//CurNormal.y= 1.5;
float z= f0(p);
if( z > f1(p) )
{
z= f1(p);
CurColor = vec3(0.1);
CurStep= 0.85;
//CurNormal.y= 0.15;
}
if( z > f2(p) )
{
z= f2(p);
CurColor = vec3(0.6,0,0.15);
CurStep= .2;
//CurNormal.y= 0.0;
}
if( z > f3(p) )
{
//Wz= f3(p);
CurColor = vec3(.25);// + animTex(p.zy / 10.0) * 0.6;
CurStep= .1;
m=2;
}
}
void ToRes(vec3 Color, float Factor)
{
cRes+= Color * cFac;
cFac*= Factor;
}
void main()
{
CurScene= floor(Y.x);
CurTime= Y.x - CurScene;
CurAnim= CurTime;
// Get the look direction for the current pixel (always look forwards)
vec3 rayDir = vec3( 0.6, (Z.yx - 0.5));
//Kamera sitzt an dieser Position
vec3 p;
if( CurScene == 0.0 )
{
p= vec3( CurTime * 120. - 120. , -24.0, .0);
rayDir.xy= rotate( rayDir.xy, CurTime - 0.9 );
//rayDir.xz= rotate( rayDir.xz, CurTime );
//rayDir.yz= rotate( rayDir.yz, 0.9 - CurTime );
}
else if( CurScene == 1.0 )
{
p= vec3( 0., 5.0, -2.0);
rayDir.xy= rotate( rayDir.xy, -0.4 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= CurTime*CurTime;
}
else if( CurScene == 2.0 )
{
p= vec3( -CurTime * 200. + 140, -2., 5.0);
rayDir.xy= rotate( rayDir.xy, CurTime-0.8 );
rayDir.xz= rotate( rayDir.xz, 3.14 );
}
else if( CurScene == 3.0 )
{
p= vec3( -25. , 0., CurTime * 20.0 - 19.0);
rayDir.xy= rotate( rayDir.xy, -0.2 );
}
else if( CurScene == 4.0 )
{
p= vec3( 0., 40.0, CurTime *8.);
rayDir.xy= rotate( rayDir.xy, -CurTime );
CurAnim= 0;
}
else if( CurScene == 5.0 )
{
p= vec3( 0., 40.0, CurTime * -64. + 56.);
rayDir.xy= rotate( rayDir.xy, -1.0 );
CurAnim= 0.4*CurTime*CurTime;
}
else if( CurScene == 6.0 )
{
p= vec3( 0., 12.0, CurTime * -12.0);
rayDir.xy= rotate( rayDir.xy, CurTime - 1.5);
rayDir.xz= rotate( rayDir.xz, CurTime );
}
else if( CurScene == 7.0 )
{
p= vec3( -4., CurTime * 64. + 4.0, 0.);
rayDir.xy= rotate( rayDir.xy, -1.0 );
rayDir.xz= rotate( rayDir.xz, -CurTime );
}
else if( CurScene == 8.0 )
{
p= vec3( 8.0, 8.0, CurTime * 24. - 32.);
rayDir.xy= rotate( rayDir.xy, -0.3 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= 0;
}
else if( CurScene == 9.0 )
{
p= vec3( CurTime * 14., 18.0, 0.);
rayDir.xy= rotate( rayDir.xy, -CurTime-0.5 );
CurAnim= CurTime*CurTime;
}
else if( CurScene == 10.0 )
{
p= vec3( 2.0, CurTime * 4. + 2.0, CurTime * 12.+ 7.);
rayDir.xy= rotate( rayDir.xy, -0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime );
}
else if( CurScene == 11.0 )
{
p= vec3( CurTime * 70. - 80., CurTime * -4. + 6.0, CurTime * 64.- 56.);
rayDir.xy= rotate( rayDir.xy, -0.2 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= 4.*CurTime;
}
else if( CurScene == 12.0 )
{
p= vec3( 30.,-8.,-8.);
rayDir.xy= rotate( rayDir.xy, 0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime + 3.0 );
CurAnim= 0.4*CurTime*CurTime;
}
else if( CurScene == 13.0 )
{
p= vec3( -60.,12.,0.);
rayDir.xy= rotate( rayDir.xy, CurTime - 1.5 );
}
else if( CurScene == 14.0 )
{
p= vec3( -22.,0.,-8.);
//rayDir.xy= rotate( rayDir.xy, 0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime + 2.0 );
//CurAnim= 0.4*Y.y;
}
else if( CurScene == 15.0 )
{
p= vec3( 80. * CurTime, 7. ,-0.);
rayDir.xz= rotate( rayDir.xz, 3.*CurTime );
}
if( CurScene == 16.0 )
{
p.x = 43.0;
rayDir.xz= rotate( rayDir.xz, pi2/2.);
CurAnim= CurTime*CurTime;
}
rayDir = normalize(rayDir);
cRes= vec3( .0 );
cFac=1.0;
float t=0.0,y,z;
m=0;
while (m++<2)
{
//bis zu einer Oberflaeche steppen
//for (CurStep=1.0;t<220.0 && CurStep>t*.003;t+=0.01+max(0.0, CurStep),RayStep=rayDir*t )
for (CurStep=1.0;t<220.0 && CurStep>t*.003;t+=CurStep,RayStep=rayDir*t )
CurStep = f(p+RayStep);
vec3 NextPos = p+RayStep;
VolLight = 0.0;
if( p.y < LightHeight && NextPos.y > LightHeight)
{
float f = (p.y - LightHeight) / (p.y - NextPos.y);
p += RayStep*f;
VolLight = l(p.xz) * smoothstep( 220.0,0.0, f * t );
}
//Startpunkt und Richtung fuer reflektierten Strahl;
p= NextPos;
vec3 n = vec3(0.04, 0.0, 0.0);
n= normalize(vec3( f(p + n.xyy) - f(p - n.xyy), f(p + n.yxy) - f(p - n.yxy), f(p + n.yyx) - f(p - n.yyx) ));
//n= normalize(n);
//CurStep ab hier == Reflektion !!!
mat(p);
float Ambient= 0.45 + 0.4 * dot( n,vec3(0,1.0,0) );
ToRes(vec3(0.7,1.0,0.9)*VolLight,1.0-VolLight);
L= smoothstep( 0.,128., t );
ToRes(vec3( 0.0, 0.0, 0.05 )*L,1.0-L); // FogColor
if( t > 220.0 )
break;
rayDir= reflect( rayDir, n );
//float ao(vec3 p, vec3 n, float d, float i) {
y= 6.0;
for (z=1.0;y>0.;y--)
z-=(y*.5-f(p+n*y*.5))/exp2(y);
CurColor*= z*Ambient;
//CurColor*= .4 + .3 * ( dot(normalize(LightPos-p),n) );
cRes+= cFac*CurColor;//*(1.0-Reflect);
cFac*= CurStep;// Reflect * (1.0-t/tmax);
t= 0.5;
RayStep=rayDir*t;
}
gl_FragColor.xyz = cRes;// + Y.w;// + cFac*FogColor;
}

View File

@@ -0,0 +1,512 @@
#version 130
const int shader= 3;
// Parameters from our host
// x: Scene.Zeit
// y: Base drum envelope
// z: Snare drum envelope
// w: undefinded
in vec4 Y;
// Position of the fragment
in vec2 Z;
// All data of our world
float L, CurScene, CurTime, CurAnim, cFac, CurStep, VolLight, pi2= 6.28319, LightHeight = 50.0;
int m;
vec3 cRes, CurColor, RayStep;
vec2 rotate(vec2 v,float y)
{
return cos(y)*v+sin(y)*vec2(-v.y,v.x);
}
//repeat around y axis w times
//void rp(inout vec3 p, float trans, float w)
float repeatr(inout vec2 v,float x, float y)
{
float a= atan(v.y,v.x);
float z=mod(a,y)-y*.5;
v=(length(v))*vec2(cos(z),sin(z));
v.x-=x;
return a-z;
}
void repeat( inout float w, float y )
{
w= mod( w - y*.5, y ) - y*.5;
}
void repeate( inout float w, float y, float z )
{
w= max( abs(w)-z, mod( w - y*.5, y ) - y*.5);
}
float CBox( in vec3 p, in vec3 box, float rad )
{
return length( max( abs(p) - box + vec3(rad), 0.0 ) ) - rad;
}
float plasm(float x, float a, float b,float c)
{
return sin(x+a+c*sin(x+b));
}
vec3 shad2move()
{
return vec3( CurTime*19.0, 24.0 - cos(CurAnim*9.0) * 8.0, cos(CurAnim*5.0) * 24.0);
}
void schad3transform( inout vec3 p )
{
p.xz = rotate(p.xz, 0.2 * cos( pow(abs(p.x),0.4 - CurTime * 0.1)) );
p.yx = rotate(p.yx, 0.2 * cos( pow(abs(p.x),0.3 + CurTime * 0.1)) );
}
float f0(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
repeat(p.x, 0.5);
return max( length(p.x) - 0.1, CBox( p, vec3(1000.,1.4,1.4), .5));
}
if( shader == 1 )
{
p -= shad2move();
//p.y = rotate(p.yz, 50. *CurAnim );
p.x = length (p.xz)+4*Y.y - 12.5;
repeat (p.x, 24.0);
return length( max( abs(p.xy) - vec2(3., .2), 0.0 ) ) - 0.2;
}
if( shader == 2 )
{
float d = p.x;
repeat(p.x, pi2);
p.y -= 0.3 * cos( (p.z + d - p.x)*.5);
p.z += 128.0 * CurTime * cos(0.7 * (d-p.x) );
repeat(p.z, 2.4);
return CBox( p, vec3(1.0, 0.1, 1.0), 0.1);
}
if( shader == 3 )
{
p.x -= 128. * CurAnim;
repeat(p.x, 64.);
p.x = length( p.x ) - 11.;
return (p.x < 0.0 ? length( p.yz ): length( p )) - 5.0 ;
}
}
float f1(vec3 p)
{
if( shader == 0 )
{
float d = p.y - 5.;
p.x *= 1.0;
repeat(p.x, 20.);
repeatr(p.yz, 28.0, pi2 / 9.0);
return max( d, CBox( p, vec3(10.,2.0,10.), 3.));
}
if( shader == 1 )
{
vec3 o= p;
repeat(p.x, 8.0);
repeat(p.z, 8.0);
o -= shad2move();
p.xz = rotate(p.xz, atan(o.x, o.z) );
p.yz = rotate(p.yz, atan(length(o.xz), 48.0) );
float d = CBox( p, vec3(2.5 , 2.0, 2.5), 0.8);
p.y += 12.;
return max(d, length(p)- 12.);
}
if( shader == 2 )
{
float d = p.z;
repeat(p.z, pi2);
p.y += 0.3 * cos( (p.x + d - p.z)*.5);
return CBox( p, vec3(1000.0, 0.1, 2.0), 0.1);
}
if( shader == 3 )
{
p.z = length(p.z) + 15.;
float d = length(p.y) - 15.;
repeat(p.x, 100.);
//repeat(p.y, 9.);
repeatr(p.zy, 85.0, pi2 / 40.0);
repeatr(p.zx, 58.0, pi2 / 50.0);
return max( d, CBox( p, vec3(4.,3.,1.), 1.)); //max( length(p) - 64., CBox( p, vec3(4.,4.,80.), 1.));
}
}
float f2(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
p.x += 256.0 * CurAnim;
repeat(p.x, 32.0);
return length(vec2(length(p.yz) - 3.0,p.x)) - 1.- Y.y;
}
if( shader == 1 )
{
return length(p-shad2move()) - 12.0;
}
if( shader == 2 )
{
p.y -= 8.;
float d = p.x;
repeat(p.x, 32.0);
p.yz = rotate(p.yz, plasm(d-p.x, 2., CurAnim, 1.0)- Y.z );
p.xz = rotate(p.xz, plasm(d-p.x, 1., CurAnim, 2.0) );
return CBox( p, vec3(8.0), 6. - CurAnim);
}
if( shader == 3 )
{
p.yz = rotate(p.yz, plasm(round(p.x / 8.0), 1., 4.0*CurTime, 2.0) );
repeat(p.x, 8.0);
repeatr(p.yz, 0.0, pi2 / 10.0);
return max( abs(length(p.yz) - 6.0)-.2, abs(length(p.xz) - 2.+0.5*Y.y)-.3);
}
}
float f3(vec3 p)
{
if( shader == 0 )
{
schad3transform(p);
return CBox( p, vec3(1000.,1.,1.), .1);
}
if( shader == 1 )
{
p.y += 20.;
repeat( p.x, 6.3);
repeat( p.z, 1.3);
//repeatr(p.xz, .0, pi2 / 4.0);
return CBox( p, vec3(3.0, 15.0, 0.5), 0.4);
}
if( shader == 2 )
{
p.y -= 20.;
repeat( p.x, 20.0);
repeat( p.z, 20.0);
repeatr(p.xz, .0, pi2 / 4.0);
return CBox( p, vec3(1000.0, 1.0, 1.0), 0.2);
}
if( shader == 3 )
{
repeat(p.z, 6.);
repeat(p.x, 5.5);
repeatr(p.xz, 2.0, pi2 / 6.0);
return max( abs(1.-length(p.xz))-0.1,abs(length(p.y)-15.0)-0.1);
}
}
float f(vec3 p)
{
return (Y.y * 0.003+0.001) * plasm(p.x+Y.y*9., p.y, p.z, 1.0-Y.y) + min( min( min( f0(p), f1(p) ), f2(p) ), f3(p) );
}
float l(vec2 p)
{
float d = floor(0.5 - p.y/32.0) + floor(0.5 - p.x/70.0) * 3.;
if( shader == 1 || shader == 2 )
{
d= plasm( 33.0 * floor(0.5 - p.y/20.0), 17.0 * floor(0.5 - p.x/20.0), floor(CurTime * 8.0), 1.0);
repeate( p.x, 20.0, 60.0 );
repeat( p.y, 20.0);
L = length( max( abs(p) - vec2(3.0), 0.0 ) ) + 2.0;// max( length(p.x), length(p.y));
if (d > 0.5)
L /= 1.0 - 0.5 * Y.y;
else
L /= 1.0 - 0.5 * Y.z;
//float sync = shader == 1 ? Y.z : Y.y;
//repeate( p.x, 20.0, 60.0 );
//repeate( p.y, 20.0, 100.0 );
//vec2 q = p;
//q.y += 10;
//repeat (q.y, 40.0);
//repeat( p.y, 20.0);
//repeat( p.x, 20.0);
//L = length( max( abs(p) - vec2(3.0), 0.0 ) ) + 1.0;// max( length(p.x), length(p.y));
//L = L * step(q.y, 0) + L * step(0, q.y) / (1.0 - 0.3 * sync);
//L /= (1.0 - Y.y) * (step(0, q.y));
}
else
{
repeate( p.y, 32.0, 32.0 );
repeat( p.x, 70.0 );
p.x = length(p.x) - 25.0;
L = 2.0 + (p.x < 0. ? length(p.y) : length(p));
L *= 1.0 - 0.5 * Y.z;
}
if( CurScene == 0 )
return max(0., 4.0 * smoothstep(10.,-pow(sin(d+CurTime*15.0*CurTime*220.0)+CurTime*15.0-4.0,.2),L));
return 4.0 * smoothstep(10.,0.0,L);
}
void mat(vec3 p)
{
CurColor = vec3(1.,1.,0.);
CurStep= .3;
//CurNormal.y= 1.5;
float z= f0(p);
if( z > f1(p) )
{
z= f1(p);
CurColor = vec3(0.1);
CurStep= 0.85;
//CurNormal.y= 0.15;
}
if( z > f2(p) )
{
z= f2(p);
CurColor = vec3(0.6,0,0.15);
CurStep= .2;
//CurNormal.y= 0.0;
}
if( z > f3(p) )
{
//Wz= f3(p);
CurColor = vec3(.25);// + animTex(p.zy / 10.0) * 0.6;
CurStep= .1;
m=2;
}
}
void ToRes(vec3 Color, float Factor)
{
cRes+= Color * cFac;
cFac*= Factor;
}
void main()
{
CurScene= floor(Y.x);
CurTime= Y.x - CurScene;
CurAnim= CurTime;
// Get the look direction for the current pixel (always look forwards)
vec3 rayDir = vec3( 0.6, (Z.yx - 0.5));
//Kamera sitzt an dieser Position
vec3 p;
if( CurScene == 0.0 )
{
p= vec3( CurTime * 120. - 120. , -24.0, .0);
rayDir.xy= rotate( rayDir.xy, CurTime - 0.9 );
//rayDir.xz= rotate( rayDir.xz, CurTime );
//rayDir.yz= rotate( rayDir.yz, 0.9 - CurTime );
}
else if( CurScene == 1.0 )
{
p= vec3( 0., 5.0, -2.0);
rayDir.xy= rotate( rayDir.xy, -0.4 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= CurTime*CurTime;
}
else if( CurScene == 2.0 )
{
p= vec3( -CurTime * 200. + 140, -2., 5.0);
rayDir.xy= rotate( rayDir.xy, CurTime-0.8 );
rayDir.xz= rotate( rayDir.xz, 3.14 );
}
else if( CurScene == 3.0 )
{
p= vec3( -25. , 0., CurTime * 20.0 - 19.0);
rayDir.xy= rotate( rayDir.xy, -0.2 );
}
else if( CurScene == 4.0 )
{
p= vec3( 0., 40.0, CurTime *8.);
rayDir.xy= rotate( rayDir.xy, -CurTime );
CurAnim= 0;
}
else if( CurScene == 5.0 )
{
p= vec3( 0., 40.0, CurTime * -64. + 56.);
rayDir.xy= rotate( rayDir.xy, -1.0 );
CurAnim= 0.4*CurTime*CurTime;
}
else if( CurScene == 6.0 )
{
p= vec3( 0., 12.0, CurTime * -12.0);
rayDir.xy= rotate( rayDir.xy, CurTime - 1.5);
rayDir.xz= rotate( rayDir.xz, CurTime );
}
else if( CurScene == 7.0 )
{
p= vec3( -4., CurTime * 64. + 4.0, 0.);
rayDir.xy= rotate( rayDir.xy, -1.0 );
rayDir.xz= rotate( rayDir.xz, -CurTime );
}
else if( CurScene == 8.0 )
{
p= vec3( 8.0, 8.0, CurTime * 24. - 32.);
rayDir.xy= rotate( rayDir.xy, -0.3 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= 0;
}
else if( CurScene == 9.0 )
{
p= vec3( CurTime * 14., 18.0, 0.);
rayDir.xy= rotate( rayDir.xy, -CurTime-0.5 );
CurAnim= CurTime*CurTime;
}
else if( CurScene == 10.0 )
{
p= vec3( 2.0, CurTime * 4. + 2.0, CurTime * 12.+ 7.);
rayDir.xy= rotate( rayDir.xy, -0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime );
}
else if( CurScene == 11.0 )
{
p= vec3( CurTime * 70. - 80., CurTime * -4. + 6.0, CurTime * 64.- 56.);
rayDir.xy= rotate( rayDir.xy, -0.2 );
rayDir.xz= rotate( rayDir.xz, CurTime );
CurAnim= 4.*CurTime;
}
else if( CurScene == 12.0 )
{
p= vec3( 30.,-8.,-8.);
rayDir.xy= rotate( rayDir.xy, 0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime + 3.0 );
CurAnim= 0.4*CurTime*CurTime;
}
else if( CurScene == 13.0 )
{
p= vec3( -60.,12.,0.);
rayDir.xy= rotate( rayDir.xy, CurTime - 1.5 );
}
else if( CurScene == 14.0 )
{
p= vec3( -22.,0.,-8.);
//rayDir.xy= rotate( rayDir.xy, 0.2 );
rayDir.xz= rotate( rayDir.xz, -CurTime + 2.0 );
//CurAnim= 0.4*Y.y;
}
else if( CurScene == 15.0 )
{
p= vec3( 80. * CurTime, 7. ,-0.);
rayDir.xz= rotate( rayDir.xz, 3.*CurTime );
}
if( CurScene == 16.0 )
{
p.x = 43.0;
rayDir.xz= rotate( rayDir.xz, pi2/2.);
CurAnim= CurTime*CurTime;
}
/////////////////////////////////////////////////////////////////////
//Debugzeug fuer Kamerasteuerung
if( true )
{
p.x= gl_ModelViewMatrix[0][0];
p.y= gl_ModelViewMatrix[0][1];
p.z= gl_ModelViewMatrix[0][2];
float a1= gl_ModelViewMatrix[1][1];
float c1,s1;vec3 q1= vec3((Z.xy - 0.5), 0.8);
c1 = cos(a1); s1 = sin(a1);
rayDir.y = c1 * q1.y - s1 * q1.z;
rayDir.x= q1.x;
rayDir.z = s1 * q1.y + c1 * q1.z;
a1= gl_ModelViewMatrix[1][0];
q1=rayDir;
c1 = cos(a1); s1 = sin(a1);
rayDir.x = c1 * q1.x + s1 * q1.z;
rayDir.z = -s1 * q1.x + c1 * q1.z;
}
//Ende Debugzeug fuer Kamerasteuerung
/////////////////////////////////////////////////////////////////////
rayDir = normalize(rayDir);
cRes= vec3( .0 );
cFac=1.0;
float t=0.0,y,z;
m=0;
while (m++<2)
{
//bis zu einer Oberflaeche steppen
//for (CurStep=1.0;t<220.0 && CurStep>t*.003;t+=0.01+max(0.0, CurStep),RayStep=rayDir*t )
for (CurStep=1.0;t<220.0 && CurStep>t*.003;t+=CurStep,RayStep=rayDir*t )
CurStep = f(p+RayStep);
vec3 NextPos = p+RayStep;
VolLight = 0.0;
if( p.y < LightHeight && NextPos.y > LightHeight)
{
float f = (p.y - LightHeight) / (p.y - NextPos.y);
p += RayStep*f;
VolLight = l(p.xz) * smoothstep( 220.0,0.0, f * t );
}
//Startpunkt und Richtung fuer reflektierten Strahl;
p= NextPos;
vec3 n = vec3(0.04, 0.0, 0.0);
n= normalize(vec3( f(p + n.xyy) - f(p - n.xyy), f(p + n.yxy) - f(p - n.yxy), f(p + n.yyx) - f(p - n.yyx) ));
//n= normalize(n);
//CurStep ab hier == Reflektion !!!
mat(p);
float Ambient= 0.45 + 0.4 * dot( n,vec3(0,1.0,0) );
ToRes(vec3(0.7,1.0,0.9)*VolLight,1.0-VolLight);
L= smoothstep( 0.,128., t );
ToRes(vec3( 0.0, 0.0, 0.05 )*L,1.0-L); // FogColor
if( t > 220.0 )
break;
rayDir= reflect( rayDir, n );
//float ao(vec3 p, vec3 n, float d, float i) {
y= 6.0;
for (z=1.0;y>0.;y--)
z-=(y*.5-f(p+n*y*.5))/exp2(y);
CurColor*= z*Ambient;
//CurColor*= .4 + .3 * ( dot(normalize(LightPos-p),n) );
cRes+= cFac*CurColor;//*(1.0-Reflect);
cFac*= CurStep;// Reflect * (1.0-t/tmax);
t= 0.5;
RayStep=rayDir*t;
}
gl_FragColor.xyz = cRes;// + Y.w;// + cFac*FogColor;
}

284
evoke-64k/evk13-4k/mark_0.h Normal file
View File

@@ -0,0 +1,284 @@
/* File generated with Shader Minifier 1.1.1
* http://www.ctrl-alt-test.fr
*/
#ifndef MARK_0_H_
# define MARK_0_H_
# define I_Y "v"
# define I_Z "f"
const char mark_fs_0[] = ""
"#version 130\n"
"const int i=0;"
"in vec4 v;"
"in vec2 f;"
"float z,y,x,e,l,r,a=6.28319;"
"int m;"
"vec2 s;"
"vec3 n,c,w,p=vec3(.2,.22,.25);"
"vec2 h(vec2 x,float i)"
"{"
"return cos(i)*x+sin(i)*vec2(-x.y,x.x);"
"}"
"float h(inout vec2 y,float v,float x)"
"{"
"float i=atan(y.y,y.x),z=mod(i,x)-x*.5;"
"y=length(y)*vec2(cos(z),sin(z));"
"y.x-=v;"
"return i-z;"
"}"
"void d(inout float y,float x)"
"{"
"y=mod(y-x*.5,x)-x*.5;"
"}"
"void d(inout float y,float x,float z)"
"{"
"y=max(abs(y)-z,mod(y-x*.5,x)-x*.5);"
"}"
"float t(float y,float x)"
"{"
"return floor((y-x*.5)/x);"
"}"
"float o(vec3 x,float z)"
"{"
"return length(vec2(length(x.xz)-z,x.y));"
"}"
"float o(in vec3 x,in vec3 z,float i)"
"{"
"return length(max(abs(x)-z+vec3(i),0.))-i;"
"}"
"float d(float i,float x,float z,float y)"
"{"
"return sin(i+x+y*sin(i+z));"
"}"
"vec3 d()"
"{"
"return vec3(x*19.,24.-cos(e*9.)*8.,cos(e*5.)*24.);"
"}"
"void d(inout vec3 i)"
"{"
"i.xz=h(i.xz,.2*cos(pow(abs(i.x),.4-x*.1))),i.yx=h(i.yx,.2*cos(pow(abs(i.x),.3+x*.1)));"
"}"
"float h(vec3 v)"
"{"
"if(i==0)"
"return d(v),d(v.x,.5),max(length(v.x)-.1,o(v,vec3(1000.,1.4,1.4),.5));"
"else"
" if(i==1)"
"return length(v-d())-12.;"
"else"
" if(i==2)"
"{"
"float y=v.x;"
"d(v.x,a);"
"v.y-=.3*cos((v.z+y-v.x)*.5);"
"v.z+=128.*x*cos(.7*(y-v.x));"
"d(v.z,2.4);"
"return o(v,vec3(1.,.1,1.),.1);"
"}"
"else"
" return v.x-=128.*e,d(v.x,64.),v.x=length(v.x)-11.,(v.x<0.?length(v.yz):length(v))-5.;"
"}"
"float o(vec3 v)"
"{"
"if(i==0)"
"{"
"float y=v.y-5.;"
"d(v.x,20.);"
"h(v.yz,28.,a/9.);"
"return max(y,o(v,vec3(10.,2.,10.),3.));"
"}"
"else"
" if(i==1)"
"{"
"vec3 y=v;"
"d(v.x,8.);"
"d(v.z,8.);"
"y-=d();"
"v.xz=h(v.xz,atan(y.x,y.z));"
"v.yz=h(v.yz,atan(length(y.xz),48.));"
"float z=o(v,vec3(2.5,2.,2.5),.8);"
"v.y+=12.;"
"return max(z,length(v)-12.);"
"}"
"else"
" if(i==2)"
"{"
"float y=v.z;"
"d(v.z,a);"
"v.y+=.3*cos((v.x+y-v.z)*.5);"
"return o(v,vec3(1000.,.1,2.),.1);"
"}"
"else"
"{"
"v.z=length(v.z)+15.;"
"float y=length(v.y)-15.;"
"d(v.x,100.);"
"h(v.zy,85.,a/40.);"
"h(v.zx,58.,a/50.);"
"return max(y,o(v,vec3(4.,3.,1.),1.));"
"}"
"}"
"float t(vec3 y)"
"{"
"if(i==0)"
"return d(y),y.x+=256.*e,d(y.x,32.),length(vec2(length(y.yz)-3.,y.x))-1.-v.z;"
"else"
" if(i==1)"
"return y-=d(),y.x=length(y.xz)+4.*v.z,d(y.x,24.),length(max(abs(y.xy)-vec2(3.)+vec2(1.),0.))-1.;"
"else"
" if(i==2)"
"{"
"y.y-=8.;"
"float z=y.x;"
"d(y.x,32.);"
"y.yz=h(y.yz,d(z-y.x,2.,e,1.));"
"y.xz=h(y.xz,d(z-y.x,1.,e,2.));"
"return o(y,vec3(8.,8.,8.),10.-v.z);"
"}"
"else"
" return y.yz=h(y.yz,d(round(y.x/6.),1.,4.*x,2.)),d(y.x,6.),h(y.yz,0.,a/6.),max(abs(length(y.yz)-5.3)-.2,abs(length(y.xz)-2.+v.z)-.3);"
"}"
"float u(vec3 y)"
"{"
"if(i==0)"
"return d(y),o(y,vec3(1000.,1.,1.),.1);"
"else"
" if(i==1)"
"return y.y+=20.,d(y.x,6.3),d(y.z,1.3),o(y,vec3(3.,15.,.5),.4);"
"else"
" if(i==2)"
"return y.y-=20.,d(y.x,20.),d(y.z,20.),h(y.xz,0.,a/4.),o(y,vec3(1000.,1.,1.),.2);"
"else"
" return d(y.z,6.),d(y.x,5.5),h(y.xz,2.,a/6.),max(abs(1.-length(y.xz))-.1,abs(length(y.y)-15.)-.1);"
"}"
"float g(vec3 y)"
"{"
"return min(min(min(h(y),o(y)),t(y)),u(y));"
"}"
"float b(vec2 v)"
"{"
"if(i==1)"
"d(v.x,20.,100.),d(v.y,20.,100.),z=max(length(v.x),length(v.y));"
"else"
" if(i==2)"
"d(v.x,20.),d(v.y,20.),z=length(v)-1.;"
"else"
" d(v.x,32.),d(v.y,64.),v.y=length(v.y)-20.,z=v.y<0.?length(v.x):length(v);"
"return 4.*smoothstep(6.,0.,z);"
"}"
"float b(vec2 v,float y,float z)"
"{"
"d(v.x,y);"
"v.x=abs(v.x);"
"v.y=mod(v.y*3.+x*z,1.);"
"float i=v.x*.02-step(.5,v.y)-step(.7,v.y);"
"return step(.005,i);"
"}"
"vec3 F(vec2 y)"
"{"
"float v=b(y+vec2(.1,0.),.6,5.);"
"v=max(v,b(y+vec2(-.2,0.),.6,-3.));"
"return vec3(1.,1.,.3)*v;"
"}"
"void C(vec3 y)"
"{"
"c=vec3(.2,.6,.8);"
"r=.3;"
"s.y=1.5;"
"float v=h(y);"
"if(v>o(y))"
"v=o(y),c=vec3(.1,.1,.1),r=.7,s.y=.15;"
"if(v>t(y))"
"v=t(y),c=vec3(1.,.2,.2),r=.3,s.y=0.;"
"if(v>u(y))"
"c=vec3(.4,.4,.4),r=.1,m=2;"
"}"
"void C(vec3 x,float v)"
"{"
"n+=x*l,l*=v;"
"}"
"void main()"
"{"
"y=v.x;"
"x=v.y;"
"e=v.y;"
"vec3 i=vec3(.8,f.yx-.5),a;"
"if(y==0.)"
"a=vec3(x*120.-120.,-24.,0.),i.xy=h(i.xy,x-.9);"
"else"
" if(y==1.)"
"a=vec3(0.,5.,-2.),i.xy=h(i.xy,-.4),i.xz=h(i.xz,x),e=v.y*v.y;"
"else"
" if(y==2.)"
"a=vec3(-25.,0.,x*20.-19.),i.xy=h(i.xy,-.2);"
"else"
" if(y==3.)"
"a=vec3(-x*200.+140,-2.,5.),i.xy=h(i.xy,x-.8),i.xz=h(i.xz,3.14);"
"else"
" if(y==4.)"
"a=vec3(0.,40.,x*8.),i.xy=h(i.xy,-x),e=0;"
"else"
" if(y==5.)"
"a=vec3(0.,40.,x*-64.+56.),i.xy=h(i.xy,-1.),e=.4*v.y*v.y;"
"else"
" if(y==8.)"
"a=vec3(8.,8.,x*24.-32.),i.xy=h(i.xy,-.3),i.xz=h(i.xz,x),e=0;"
"else"
" if(y==9.)"
"a=vec3(x*8.,16.,0.),i.xy=h(i.xy,-x-.5),e=v.y*v.y;"
"else"
" if(y==10.)"
"a=vec3(2.,x*4.+2.,x*12.+4.),i.xy=h(i.xy,-.2),i.xz=h(i.xz,-x);"
"else"
" if(y==11.)"
"a=vec3(x*64.+48.,x*-4.+6.,x*64.-56.),i.xy=h(i.xy,-.2),i.xz=h(i.xz,x),e=4.*v.y;"
"else"
" if(y==12.)"
"a=vec3(30.,-8.,-8.),i.xy=h(i.xy,.2),i.xz=h(i.xz,-x+3.),e=.4*v.y*v.y;"
"else"
" if(y==13.)"
"a=vec3(-60.,12.,0.),i.xy=h(i.xy,x-1.);"
"i=normalize(i);"
"n=vec3(0.,0.,0.);"
"l=1.;"
"float d=0.,u,k;"
"m=0;"
"while(m++<2)"
"{"
"for(r=1.;d<250.&&r>d*.003;d+=r,w=i*d)"
"r=g(a+w);"
"vec3 t=a+w;"
"float o=0.,F=50.;"
"if(a.y<F&&t.y>F)"
"{"
"float Z=(a.y-F)/(a.y-t.y);"
"a+=w*Z;"
"o=b(a.xz)*smoothstep(220.,0.,Z*d);"
"}"
"a=t;"
"s=vec2(.04,0.);"
"vec3 Z=vec3(g(a+s.xyy)-g(a-s.xyy),g(a+s.yxy)-g(a-s.yxy),g(a+s.yyx)-g(a-s.yyx));"
"Z=normalize(Z);"
"C(a);"
"float Y=.45+.4*dot(Z,vec3(0,1.,0));"
"C(vec3(1.,1.,1.)*o,1.-o);"
"z=smoothstep(0.,128.,d);"
"C(p*z,1.-z);"
"if(d>250.)"
"{"
"break;"
"}"
"i=reflect(i,Z);"
"u=6.;"
"for(k=1.;u>0.;u--)"
"k-=(u*.5-g(a+Z*u*.5))/exp2(u);"
"c*=k*Y;"
"n+=l*c;"
"l*=r;"
"d=.5;"
"w=i*d;"
"}"
"gl_FragColor.xyz=n;"
"}";
#endif // MARK_0_H_

284
evoke-64k/evk13-4k/mark_1.h Normal file
View File

@@ -0,0 +1,284 @@
/* File generated with Shader Minifier 1.1.1
* http://www.ctrl-alt-test.fr
*/
#ifndef MARK_1_H_
# define MARK_1_H_
# define I_Y "v"
# define I_Z "f"
const char mark_fs_1[] = ""
"#version 130\n"
"const int i=1;"
"in vec4 v;"
"in vec2 f;"
"float z,y,x,e,l,r,a=6.28319;"
"int m;"
"vec2 s;"
"vec3 n,c,w,p=vec3(.2,.22,.25);"
"vec2 h(vec2 x,float i)"
"{"
"return cos(i)*x+sin(i)*vec2(-x.y,x.x);"
"}"
"float h(inout vec2 y,float v,float x)"
"{"
"float i=atan(y.y,y.x),z=mod(i,x)-x*.5;"
"y=length(y)*vec2(cos(z),sin(z));"
"y.x-=v;"
"return i-z;"
"}"
"void d(inout float y,float x)"
"{"
"y=mod(y-x*.5,x)-x*.5;"
"}"
"void d(inout float y,float x,float z)"
"{"
"y=max(abs(y)-z,mod(y-x*.5,x)-x*.5);"
"}"
"float t(float y,float x)"
"{"
"return floor((y-x*.5)/x);"
"}"
"float o(vec3 x,float z)"
"{"
"return length(vec2(length(x.xz)-z,x.y));"
"}"
"float o(in vec3 x,in vec3 z,float i)"
"{"
"return length(max(abs(x)-z+vec3(i),0.))-i;"
"}"
"float d(float i,float x,float z,float y)"
"{"
"return sin(i+x+y*sin(i+z));"
"}"
"vec3 d()"
"{"
"return vec3(x*19.,24.-cos(e*9.)*8.,cos(e*5.)*24.);"
"}"
"void d(inout vec3 i)"
"{"
"i.xz=h(i.xz,.2*cos(pow(abs(i.x),.4-x*.1))),i.yx=h(i.yx,.2*cos(pow(abs(i.x),.3+x*.1)));"
"}"
"float h(vec3 v)"
"{"
"if(i==0)"
"return d(v),d(v.x,.5),max(length(v.x)-.1,o(v,vec3(1000.,1.4,1.4),.5));"
"else"
" if(i==1)"
"return length(v-d())-12.;"
"else"
" if(i==2)"
"{"
"float y=v.x;"
"d(v.x,a);"
"v.y-=.3*cos((v.z+y-v.x)*.5);"
"v.z+=128.*x*cos(.7*(y-v.x));"
"d(v.z,2.4);"
"return o(v,vec3(1.,.1,1.),.1);"
"}"
"else"
" return v.x-=128.*e,d(v.x,64.),v.x=length(v.x)-11.,(v.x<0.?length(v.yz):length(v))-5.;"
"}"
"float o(vec3 v)"
"{"
"if(i==0)"
"{"
"float y=v.y-5.;"
"d(v.x,20.);"
"h(v.yz,28.,a/9.);"
"return max(y,o(v,vec3(10.,2.,10.),3.));"
"}"
"else"
" if(i==1)"
"{"
"vec3 y=v;"
"d(v.x,8.);"
"d(v.z,8.);"
"y-=d();"
"v.xz=h(v.xz,atan(y.x,y.z));"
"v.yz=h(v.yz,atan(length(y.xz),48.));"
"float z=o(v,vec3(2.5,2.,2.5),.8);"
"v.y+=12.;"
"return max(z,length(v)-12.);"
"}"
"else"
" if(i==2)"
"{"
"float y=v.z;"
"d(v.z,a);"
"v.y+=.3*cos((v.x+y-v.z)*.5);"
"return o(v,vec3(1000.,.1,2.),.1);"
"}"
"else"
"{"
"v.z=length(v.z)+15.;"
"float y=length(v.y)-15.;"
"d(v.x,100.);"
"h(v.zy,85.,a/40.);"
"h(v.zx,58.,a/50.);"
"return max(y,o(v,vec3(4.,3.,1.),1.));"
"}"
"}"
"float t(vec3 y)"
"{"
"if(i==0)"
"return d(y),y.x+=256.*e,d(y.x,32.),length(vec2(length(y.yz)-3.,y.x))-1.-v.z;"
"else"
" if(i==1)"
"return y-=d(),y.x=length(y.xz)+4.*v.z,d(y.x,24.),length(max(abs(y.xy)-vec2(3.)+vec2(1.),0.))-1.;"
"else"
" if(i==2)"
"{"
"y.y-=8.;"
"float z=y.x;"
"d(y.x,32.);"
"y.yz=h(y.yz,d(z-y.x,2.,e,1.));"
"y.xz=h(y.xz,d(z-y.x,1.,e,2.));"
"return o(y,vec3(8.,8.,8.),10.-v.z);"
"}"
"else"
" return y.yz=h(y.yz,d(round(y.x/6.),1.,4.*x,2.)),d(y.x,6.),h(y.yz,0.,a/6.),max(abs(length(y.yz)-5.3)-.2,abs(length(y.xz)-2.+v.z)-.3);"
"}"
"float u(vec3 y)"
"{"
"if(i==0)"
"return d(y),o(y,vec3(1000.,1.,1.),.1);"
"else"
" if(i==1)"
"return y.y+=20.,d(y.x,6.3),d(y.z,1.3),o(y,vec3(3.,15.,.5),.4);"
"else"
" if(i==2)"
"return y.y-=20.,d(y.x,20.),d(y.z,20.),h(y.xz,0.,a/4.),o(y,vec3(1000.,1.,1.),.2);"
"else"
" return d(y.z,6.),d(y.x,5.5),h(y.xz,2.,a/6.),max(abs(1.-length(y.xz))-.1,abs(length(y.y)-15.)-.1);"
"}"
"float g(vec3 y)"
"{"
"return min(min(min(h(y),o(y)),t(y)),u(y));"
"}"
"float b(vec2 v)"
"{"
"if(i==1)"
"d(v.x,20.,100.),d(v.y,20.,100.),z=max(length(v.x),length(v.y));"
"else"
" if(i==2)"
"d(v.x,20.),d(v.y,20.),z=length(v)-1.;"
"else"
" d(v.x,32.),d(v.y,64.),v.y=length(v.y)-20.,z=v.y<0.?length(v.x):length(v);"
"return 4.*smoothstep(6.,0.,z);"
"}"
"float b(vec2 v,float y,float z)"
"{"
"d(v.x,y);"
"v.x=abs(v.x);"
"v.y=mod(v.y*3.+x*z,1.);"
"float i=v.x*.02-step(.5,v.y)-step(.7,v.y);"
"return step(.005,i);"
"}"
"vec3 F(vec2 y)"
"{"
"float v=b(y+vec2(.1,0.),.6,5.);"
"v=max(v,b(y+vec2(-.2,0.),.6,-3.));"
"return vec3(1.,1.,.3)*v;"
"}"
"void C(vec3 y)"
"{"
"c=vec3(.2,.6,.8);"
"r=.3;"
"s.y=1.5;"
"float v=h(y);"
"if(v>o(y))"
"v=o(y),c=vec3(.1,.1,.1),r=.7,s.y=.15;"
"if(v>t(y))"
"v=t(y),c=vec3(1.,.2,.2),r=.3,s.y=0.;"
"if(v>u(y))"
"c=vec3(.4,.4,.4),r=.1,m=2;"
"}"
"void C(vec3 x,float v)"
"{"
"n+=x*l,l*=v;"
"}"
"void main()"
"{"
"y=v.x;"
"x=v.y;"
"e=v.y;"
"vec3 i=vec3(.8,f.yx-.5),a;"
"if(y==0.)"
"a=vec3(x*120.-120.,-24.,0.),i.xy=h(i.xy,x-.9);"
"else"
" if(y==1.)"
"a=vec3(0.,5.,-2.),i.xy=h(i.xy,-.4),i.xz=h(i.xz,x),e=v.y*v.y;"
"else"
" if(y==2.)"
"a=vec3(-25.,0.,x*20.-19.),i.xy=h(i.xy,-.2);"
"else"
" if(y==3.)"
"a=vec3(-x*200.+140,-2.,5.),i.xy=h(i.xy,x-.8),i.xz=h(i.xz,3.14);"
"else"
" if(y==4.)"
"a=vec3(0.,40.,x*8.),i.xy=h(i.xy,-x),e=0;"
"else"
" if(y==5.)"
"a=vec3(0.,40.,x*-64.+56.),i.xy=h(i.xy,-1.),e=.4*v.y*v.y;"
"else"
" if(y==8.)"
"a=vec3(8.,8.,x*24.-32.),i.xy=h(i.xy,-.3),i.xz=h(i.xz,x),e=0;"
"else"
" if(y==9.)"
"a=vec3(x*8.,16.,0.),i.xy=h(i.xy,-x-.5),e=v.y*v.y;"
"else"
" if(y==10.)"
"a=vec3(2.,x*4.+2.,x*12.+4.),i.xy=h(i.xy,-.2),i.xz=h(i.xz,-x);"
"else"
" if(y==11.)"
"a=vec3(x*64.+48.,x*-4.+6.,x*64.-56.),i.xy=h(i.xy,-.2),i.xz=h(i.xz,x),e=4.*v.y;"
"else"
" if(y==12.)"
"a=vec3(30.,-8.,-8.),i.xy=h(i.xy,.2),i.xz=h(i.xz,-x+3.),e=.4*v.y*v.y;"
"else"
" if(y==13.)"
"a=vec3(-60.,12.,0.),i.xy=h(i.xy,x-1.);"
"i=normalize(i);"
"n=vec3(0.,0.,0.);"
"l=1.;"
"float d=0.,u,k;"
"m=0;"
"while(m++<2)"
"{"
"for(r=1.;d<250.&&r>d*.003;d+=r,w=i*d)"
"r=g(a+w);"
"vec3 t=a+w;"
"float o=0.,F=50.;"
"if(a.y<F&&t.y>F)"
"{"
"float Z=(a.y-F)/(a.y-t.y);"
"a+=w*Z;"
"o=b(a.xz)*smoothstep(220.,0.,Z*d);"
"}"
"a=t;"
"s=vec2(.04,0.);"
"vec3 Z=vec3(g(a+s.xyy)-g(a-s.xyy),g(a+s.yxy)-g(a-s.yxy),g(a+s.yyx)-g(a-s.yyx));"
"Z=normalize(Z);"
"C(a);"
"float Y=.45+.4*dot(Z,vec3(0,1.,0));"
"C(vec3(1.,1.,1.)*o,1.-o);"
"z=smoothstep(0.,128.,d);"
"C(p*z,1.-z);"
"if(d>250.)"
"{"
"break;"
"}"
"i=reflect(i,Z);"
"u=6.;"
"for(k=1.;u>0.;u--)"
"k-=(u*.5-g(a+Z*u*.5))/exp2(u);"
"c*=k*Y;"
"n+=l*c;"
"l*=r;"
"d=.5;"
"w=i*d;"
"}"
"gl_FragColor.xyz=n;"
"}";
#endif // MARK_1_H_

284
evoke-64k/evk13-4k/mark_2.h Normal file
View File

@@ -0,0 +1,284 @@
/* File generated with Shader Minifier 1.1.1
* http://www.ctrl-alt-test.fr
*/
#ifndef MARK_2_H_
# define MARK_2_H_
# define I_Y "v"
# define I_Z "f"
const char mark_fs_2[] = ""
"#version 130\n"
"const int i=2;"
"in vec4 v;"
"in vec2 f;"
"float z,y,x,e,l,r,a=6.28319;"
"int m;"
"vec2 s;"
"vec3 n,c,w,p=vec3(.2,.22,.25);"
"vec2 h(vec2 x,float i)"
"{"
"return cos(i)*x+sin(i)*vec2(-x.y,x.x);"
"}"
"float h(inout vec2 y,float v,float x)"
"{"
"float i=atan(y.y,y.x),z=mod(i,x)-x*.5;"
"y=length(y)*vec2(cos(z),sin(z));"
"y.x-=v;"
"return i-z;"
"}"
"void d(inout float y,float x)"
"{"
"y=mod(y-x*.5,x)-x*.5;"
"}"
"void d(inout float y,float x,float z)"
"{"
"y=max(abs(y)-z,mod(y-x*.5,x)-x*.5);"
"}"
"float t(float y,float x)"
"{"
"return floor((y-x*.5)/x);"
"}"
"float o(vec3 x,float z)"
"{"
"return length(vec2(length(x.xz)-z,x.y));"
"}"
"float o(in vec3 x,in vec3 z,float i)"
"{"
"return length(max(abs(x)-z+vec3(i),0.))-i;"
"}"
"float d(float i,float x,float z,float y)"
"{"
"return sin(i+x+y*sin(i+z));"
"}"
"vec3 d()"
"{"
"return vec3(x*19.,24.-cos(e*9.)*8.,cos(e*5.)*24.);"
"}"
"void d(inout vec3 i)"
"{"
"i.xz=h(i.xz,.2*cos(pow(abs(i.x),.4-x*.1))),i.yx=h(i.yx,.2*cos(pow(abs(i.x),.3+x*.1)));"
"}"
"float h(vec3 v)"
"{"
"if(i==0)"
"return d(v),d(v.x,.5),max(length(v.x)-.1,o(v,vec3(1000.,1.4,1.4),.5));"
"else"
" if(i==1)"
"return length(v-d())-12.;"
"else"
" if(i==2)"
"{"
"float y=v.x;"
"d(v.x,a);"
"v.y-=.3*cos((v.z+y-v.x)*.5);"
"v.z+=128.*x*cos(.7*(y-v.x));"
"d(v.z,2.4);"
"return o(v,vec3(1.,.1,1.),.1);"
"}"
"else"
" return v.x-=128.*e,d(v.x,64.),v.x=length(v.x)-11.,(v.x<0.?length(v.yz):length(v))-5.;"
"}"
"float o(vec3 v)"
"{"
"if(i==0)"
"{"
"float y=v.y-5.;"
"d(v.x,20.);"
"h(v.yz,28.,a/9.);"
"return max(y,o(v,vec3(10.,2.,10.),3.));"
"}"
"else"
" if(i==1)"
"{"
"vec3 y=v;"
"d(v.x,8.);"
"d(v.z,8.);"
"y-=d();"
"v.xz=h(v.xz,atan(y.x,y.z));"
"v.yz=h(v.yz,atan(length(y.xz),48.));"
"float z=o(v,vec3(2.5,2.,2.5),.8);"
"v.y+=12.;"
"return max(z,length(v)-12.);"
"}"
"else"
" if(i==2)"
"{"
"float y=v.z;"
"d(v.z,a);"
"v.y+=.3*cos((v.x+y-v.z)*.5);"
"return o(v,vec3(1000.,.1,2.),.1);"
"}"
"else"
"{"
"v.z=length(v.z)+15.;"
"float y=length(v.y)-15.;"
"d(v.x,100.);"
"h(v.zy,85.,a/40.);"
"h(v.zx,58.,a/50.);"
"return max(y,o(v,vec3(4.,3.,1.),1.));"
"}"
"}"
"float t(vec3 y)"
"{"
"if(i==0)"
"return d(y),y.x+=256.*e,d(y.x,32.),length(vec2(length(y.yz)-3.,y.x))-1.-v.z;"
"else"
" if(i==1)"
"return y-=d(),y.x=length(y.xz)+4.*v.z,d(y.x,24.),length(max(abs(y.xy)-vec2(3.)+vec2(1.),0.))-1.;"
"else"
" if(i==2)"
"{"
"y.y-=8.;"
"float z=y.x;"
"d(y.x,32.);"
"y.yz=h(y.yz,d(z-y.x,2.,e,1.));"
"y.xz=h(y.xz,d(z-y.x,1.,e,2.));"
"return o(y,vec3(8.,8.,8.),10.-v.z);"
"}"
"else"
" return y.yz=h(y.yz,d(round(y.x/6.),1.,4.*x,2.)),d(y.x,6.),h(y.yz,0.,a/6.),max(abs(length(y.yz)-5.3)-.2,abs(length(y.xz)-2.+v.z)-.3);"
"}"
"float u(vec3 y)"
"{"
"if(i==0)"
"return d(y),o(y,vec3(1000.,1.,1.),.1);"
"else"
" if(i==1)"
"return y.y+=20.,d(y.x,6.3),d(y.z,1.3),o(y,vec3(3.,15.,.5),.4);"
"else"
" if(i==2)"
"return y.y-=20.,d(y.x,20.),d(y.z,20.),h(y.xz,0.,a/4.),o(y,vec3(1000.,1.,1.),.2);"
"else"
" return d(y.z,6.),d(y.x,5.5),h(y.xz,2.,a/6.),max(abs(1.-length(y.xz))-.1,abs(length(y.y)-15.)-.1);"
"}"
"float g(vec3 y)"
"{"
"return min(min(min(h(y),o(y)),t(y)),u(y));"
"}"
"float b(vec2 v)"
"{"
"if(i==1)"
"d(v.x,20.,100.),d(v.y,20.,100.),z=max(length(v.x),length(v.y));"
"else"
" if(i==2)"
"d(v.x,20.),d(v.y,20.),z=length(v)-1.;"
"else"
" d(v.x,32.),d(v.y,64.),v.y=length(v.y)-20.,z=v.y<0.?length(v.x):length(v);"
"return 4.*smoothstep(6.,0.,z);"
"}"
"float b(vec2 v,float y,float z)"
"{"
"d(v.x,y);"
"v.x=abs(v.x);"
"v.y=mod(v.y*3.+x*z,1.);"
"float i=v.x*.02-step(.5,v.y)-step(.7,v.y);"
"return step(.005,i);"
"}"
"vec3 F(vec2 y)"
"{"
"float v=b(y+vec2(.1,0.),.6,5.);"
"v=max(v,b(y+vec2(-.2,0.),.6,-3.));"
"return vec3(1.,1.,.3)*v;"
"}"
"void C(vec3 y)"
"{"
"c=vec3(.2,.6,.8);"
"r=.3;"
"s.y=1.5;"
"float v=h(y);"
"if(v>o(y))"
"v=o(y),c=vec3(.1,.1,.1),r=.7,s.y=.15;"
"if(v>t(y))"
"v=t(y),c=vec3(1.,.2,.2),r=.3,s.y=0.;"
"if(v>u(y))"
"c=vec3(.4,.4,.4),r=.1,m=2;"
"}"
"void C(vec3 x,float v)"
"{"
"n+=x*l,l*=v;"
"}"
"void main()"
"{"
"y=v.x;"
"x=v.y;"
"e=v.y;"
"vec3 i=vec3(.8,f.yx-.5),a;"
"if(y==0.)"
"a=vec3(x*120.-120.,-24.,0.),i.xy=h(i.xy,x-.9);"
"else"
" if(y==1.)"
"a=vec3(0.,5.,-2.),i.xy=h(i.xy,-.4),i.xz=h(i.xz,x),e=v.y*v.y;"
"else"
" if(y==2.)"
"a=vec3(-25.,0.,x*20.-19.),i.xy=h(i.xy,-.2);"
"else"
" if(y==3.)"
"a=vec3(-x*200.+140,-2.,5.),i.xy=h(i.xy,x-.8),i.xz=h(i.xz,3.14);"
"else"
" if(y==4.)"
"a=vec3(0.,40.,x*8.),i.xy=h(i.xy,-x),e=0;"
"else"
" if(y==5.)"
"a=vec3(0.,40.,x*-64.+56.),i.xy=h(i.xy,-1.),e=.4*v.y*v.y;"
"else"
" if(y==8.)"
"a=vec3(8.,8.,x*24.-32.),i.xy=h(i.xy,-.3),i.xz=h(i.xz,x),e=0;"
"else"
" if(y==9.)"
"a=vec3(x*8.,16.,0.),i.xy=h(i.xy,-x-.5),e=v.y*v.y;"
"else"
" if(y==10.)"
"a=vec3(2.,x*4.+2.,x*12.+4.),i.xy=h(i.xy,-.2),i.xz=h(i.xz,-x);"
"else"
" if(y==11.)"
"a=vec3(x*64.+48.,x*-4.+6.,x*64.-56.),i.xy=h(i.xy,-.2),i.xz=h(i.xz,x),e=4.*v.y;"
"else"
" if(y==12.)"
"a=vec3(30.,-8.,-8.),i.xy=h(i.xy,.2),i.xz=h(i.xz,-x+3.),e=.4*v.y*v.y;"
"else"
" if(y==13.)"
"a=vec3(-60.,12.,0.),i.xy=h(i.xy,x-1.);"
"i=normalize(i);"
"n=vec3(0.,0.,0.);"
"l=1.;"
"float d=0.,u,k;"
"m=0;"
"while(m++<2)"
"{"
"for(r=1.;d<250.&&r>d*.003;d+=r,w=i*d)"
"r=g(a+w);"
"vec3 t=a+w;"
"float o=0.,F=50.;"
"if(a.y<F&&t.y>F)"
"{"
"float Z=(a.y-F)/(a.y-t.y);"
"a+=w*Z;"
"o=b(a.xz)*smoothstep(220.,0.,Z*d);"
"}"
"a=t;"
"s=vec2(.04,0.);"
"vec3 Z=vec3(g(a+s.xyy)-g(a-s.xyy),g(a+s.yxy)-g(a-s.yxy),g(a+s.yyx)-g(a-s.yyx));"
"Z=normalize(Z);"
"C(a);"
"float Y=.45+.4*dot(Z,vec3(0,1.,0));"
"C(vec3(1.,1.,1.)*o,1.-o);"
"z=smoothstep(0.,128.,d);"
"C(p*z,1.-z);"
"if(d>250.)"
"{"
"break;"
"}"
"i=reflect(i,Z);"
"u=6.;"
"for(k=1.;u>0.;u--)"
"k-=(u*.5-g(a+Z*u*.5))/exp2(u);"
"c*=k*Y;"
"n+=l*c;"
"l*=r;"
"d=.5;"
"w=i*d;"
"}"
"gl_FragColor.xyz=n;"
"}";
#endif // MARK_2_H_

View File

@@ -0,0 +1,279 @@
/* File generated with Shader Minifier 1.1.1
* http://www.ctrl-alt-test.fr
*/
#ifndef MARK_SMALL_H_
# define MARK_SMALL_H_
# define I_Y "v"
# define I_Z "f"
char mark_fs_0[] = ""
"const int i=0;"
"in vec4 v;"
"in vec2 f;"
"float z,y,x,e,l,r,c,a=6.28319,m=50.;"
"int s;"
"vec3 n,d,w;"
"vec2 h(vec2 x,float i)"
"{"
"return cos(i)*x+sin(i)*vec2(-x.y,x.x);"
"}"
"float h(inout vec2 x,float z,float v)"
"{"
"float y=atan(x.y,x.x),i=mod(y,v)-v*.5;"
"x=length(x)*vec2(cos(i),sin(i));"
"x.x-=z;"
"return y-i;"
"}"
"void p(inout float y,float x)"
"{"
"y=mod(y-x*.5,x)-x*.5;"
"}"
"void p(inout float y,float x,float z)"
"{"
"y=max(abs(y)-z,mod(y-x*.5,x)-x*.5);"
"}"
"float t(in vec3 x,in vec3 z,float i)"
"{"
"return length(max(abs(x)-z+vec3(i),0.))-i;"
"}"
"float h(float y,float z,float x,float i)"
"{"
"return sin(y+z+i*sin(y+x));"
"}"
"vec3 h()"
"{"
"return vec3(x*19.,24.-cos(e*9.)*8.,cos(e*5.)*24.);"
"}"
"void h(inout vec3 i)"
"{"
"i.xz=h(i.xz,.2*cos(pow(abs(i.x),.4-x*.1))),i.yx=h(i.yx,.2*cos(pow(abs(i.x),.3+x*.1)));"
"}"
"float p(vec3 y)"
"{"
"if(i==0)"
"return h(y),p(y.x,.5),max(length(y.x)-.1,t(y,vec3(1000.,1.4,1.4),.5));"
"if(i==1)"
"return y-=h(),y.x=length(y.xz)+4*v.y-12.5,p(y.x,24.),length(max(abs(y.xy)-vec2(3.,.2),0.))-.2;"
"if(i==2)"
"{"
"y.y+=h(.1*y.x,.1*y.z,x*10.,1.);"
"float z=y.x;"
"p(y.x,a);"
"y.y-=.3*cos((y.z+z-y.x)*.5);"
"y.z+=128.*x*cos(.7*(z-y.x));"
"p(y.z,2.4);"
"return t(y,vec3(1.,.1,1.),.1);"
"}"
"if(i==3)"
"return y.x-=128.*e,p(y.x,64.),y.x=length(y.x)-11.,(y.x<0.?length(y.yz):length(y))-5.;"
"}"
"float t(vec3 y)"
"{"
"if(i==0)"
"{"
"float z=y.y-5.;"
"y.x*=1.;"
"p(y.x,20.);"
"h(y.yz,28.,a/9.);"
"return max(z,t(y,vec3(10.,2.,10.),3.));"
"}"
"if(i==1)"
"{"
"vec3 v=y;"
"p(y.x,8.);"
"p(y.z,8.);"
"v-=h();"
"y.xz=h(y.xz,atan(v.x,v.z));"
"y.yz=h(y.yz,atan(length(v.xz),48.));"
"float z=t(y,vec3(2.5,2.,2.5),.8);"
"y.y+=12.+h(.1*v.x,.1*v.z,x*10.,1.);"
"return max(z,length(y)-12.);"
"}"
"if(i==2)"
"{"
"y.y+=h(.1*y.x,.1*y.z,x*10.,1.);"
"float z=y.z;"
"p(y.z,a);"
"y.y+=.3*cos((y.x+z-y.z)*.5);"
"return t(y,vec3(1000.,.1,2.),.1);"
"}"
"if(i==3)"
"{"
"y.z=length(y.z)+15.;"
"float z=length(y.y)-15.;"
"p(y.x,100.);"
"float v=2.+h(5.*h(y.zy,85.,a/40.),6.*h(y.zx,55.,a/50.),x*20.,1.);"
"return max(z,t(y,vec3(4.,3.,v),1.));"
"}"
"}"
"float o(vec3 y)"
"{"
"if(i==0)"
"return h(y),y.x+=256.*e,p(y.x,32.),length(vec2(length(y.yz)-3.,y.x))-1.-v.y;"
"if(i==1)"
"return length(y-h())-12.;"
"if(i==2)"
"{"
"y.y-=8.;"
"float z=y.x;"
"p(y.x,32.);"
"y.yz=h(y.yz,h(z-y.x,2.,e,1.)-v.z);"
"y.xz=h(y.xz,h(z-y.x,1.,e,2.));"
"return t(y,vec3(8.),6.-e);"
"}"
"if(i==3)"
"return y.yz=h(y.yz,h(round(y.x/8.),1.,4.*x,2.)),p(y.x,8.),h(y.yz,0.,a/10.),max(abs(length(y.yz)-6.)-.2,abs(length(y.xz)-2.+.5*v.y)-.3);"
"}"
"float u(vec3 y)"
"{"
"if(i==0)"
"return h(y),t(y,vec3(1000.,1.,1.),.1);"
"if(i==1)"
"return y.y+=20.,p(y.x,6.3),p(y.z,1.3),t(y,vec3(3.,15.,.5),.4);"
"if(i==2)"
"return y.y-=20.,p(y.x,20.),p(y.z,20.),h(y.xz,0.,a/4.),t(y,vec3(1000.,1.,1.),.2);"
"if(i==3)"
"return p(y.z,6.),p(y.x,5.5),h(y.xz,2.,a/6.),max(abs(1.-length(y.xz))-.1,abs(length(y.y)-15.)-.1);"
"}"
"float g(vec3 y)"
"{"
"return(.003-v.y*.007)*h(y.x+v.y*9.,y.y,y.z,1.-v.y)+min(min(min(p(y),t(y)),o(y)),u(y));"
"}"
"float b(vec2 a)"
"{"
"float r=floor(.5-a.y/32.)+floor(.5-a.x/70.)*3.;"
"if(i==1||i==2)"
"{"
"r=h(33.*floor(.5-a.y/20.),5.*floor(.5-a.x/20.),17.*floor(x*16.+.5),1.);"
"p(a.x,20.,60.);"
"p(a.y,20.);"
"z=length(max(abs(a)-vec2(3.),0.))+2.5;"
"if(r>.5)"
"z+=2.*v.y;"
"}"
"else"
" p(a.y,32.,32.),p(a.x,70.),a.x=length(a.x)-25.,z=2.-v.z+(a.x<0.?length(a.y):length(a));"
"if(y==0)"
"return max(0.,4.*smoothstep(10.,-pow(sin(r+x*10.*x*220.)+sin(r)+x*10.-4.,.2),z));"
"return 4.*smoothstep(10.,0.,z);"
"}"
"void F(vec3 y)"
"{"
"d=vec3(0.,.65,.2);"
"r=.3;"
"float i=p(y);"
"if(i>t(y))"
"i=t(y),d=vec3(.1),r=.85;"
"if(i>o(y))"
"i=o(y),d=vec3(1.,0.,0.),r=.2;"
"if(i>u(y))"
#ifdef ULTRA
"d=vec3(.25),r=.1,s=3;"
#else
"d=vec3(.25),r=.1,s=2;"
#endif
"}"
"void F(vec3 x,float y)"
"{"
"n+=x*l,l*=y;"
"}"
"void main()"
"{"
"y=floor(v.x);"
"x=v.x-y;"
"e=x;"
"vec3 i=vec3(.6,f.yx-.5),p;"
"if(y==0.)"
"p=vec3(x*120.-120.,-24.,0.),i.xy=h(i.xy,x-.9);"
"else"
" if(y==1.)"
"p=vec3(0.,5.,-2.),i.xy=h(i.xy,-.4),i.xz=h(i.xz,x),e=x*x;"
"else"
" if(y==2.)"
"p=vec3(-x*200.+140,-2.,5.),i.xy=h(i.xy,x-.8),i.xz=h(i.xz,3.14);"
"else"
" if(y==3.)"
"p=vec3(-25.,0.,x*20.-19.),i.xy=h(i.xy,-.2);"
"else"
" if(y==4.)"
"p=vec3(0.,40.,x*8.),i.xy=h(i.xy,-x),e=0;"
"else"
" if(y==5.)"
"p=vec3(0.,40.,x*-64.+56.),i.xy=h(i.xy,-1.),e=.4*x*x;"
"else"
" if(y==6.)"
"p=vec3(0.,12.,x*-12.),i.xy=h(i.xy,x-1.5),i.xz=h(i.xz,x);"
"else"
" if(y==7.)"
"p=vec3(-4.,x*64.+4.,0.),i.xy=h(i.xy,-1.),i.xz=h(i.xz,-x);"
"else"
" if(y==8.)"
"p=vec3(8.,8.,x*24.-32.),i.xy=h(i.xy,-.3),i.xz=h(i.xz,x),e=0;"
"else"
" if(y==9.)"
"p=vec3(x*14.,18.,0.),i.xy=h(i.xy,-x-.5),e=x*x;"
"else"
" if(y==10.)"
"p=vec3(2.,x*4.+2.,x*12.+7.),i.xy=h(i.xy,-.2),i.xz=h(i.xz,-x);"
"else"
" if(y==11.)"
"p=vec3(x*70.-80.,x*-4.+6.,x*64.-56.),i.xy=h(i.xy,-.2),i.xz=h(i.xz,x),e=4.*x;"
"else"
" if(y==12.)"
"p=vec3(30.,-8.,-8.),i.xy=h(i.xy,.2),i.xz=h(i.xz,-x+3.),e=.4*x*x;"
"else"
" if(y==13.)"
"p=vec3(-60.,12.,0.),i.xy=h(i.xy,x-1.5);"
"else"
" if(y==14.)"
"p=vec3(-22.,0.,-8.),i.xz=h(i.xz,-x+2.);"
"else"
" if(y==15.)"
"p=vec3(80.*x,7.,0.),i.xz=h(i.xz,3.*x);"
"if(y==16.)"
"p.x=43.,i.xz=h(i.xz,a/2.),e=x*x;"
"i=normalize(i);"
"n=vec3(0.);"
"l=1.;"
"float t=0.,o,u;"
"s=0;"
#ifdef ULTRA
"while(s++<3)"
#else
"while(s++<2)"
#endif
"{"
"for(r=1.;t<220.&&r>t*.003;t+=r,w=i*t)"
"r=g(p+w);"
"vec3 k=p+w;"
"c=0.;"
"if(p.y<m&&k.y>m)"
"{"
"float C=(p.y-m)/(p.y-k.y);"
"p+=w*C;"
"c=b(p.xz)*smoothstep(220.,0.,C*t);"
"}"
"p=k;"
"vec3 C=vec3(.04,0.,0.);"
"C=normalize(vec3(g(p+C.xyy)-g(p-C.xyy),g(p+C.yxy)-g(p-C.yxy),g(p+C.yyx)-g(p-C.yyx)));"
"F(p);"
"float Z=.45+.4*dot(C,vec3(0,1.,0));"
"F(vec3(.7,1.,.9)*c,1.-c);"
"z=smoothstep(0.,128.,t);"
"F(vec3(0.,0.,.05)*z,1.-z);"
"if(t>220.)"
"break;"
"i=reflect(i,C);"
"o=6.;"
"for(u=1.;o>0.;o--)"
"u-=(o*.5-g(p+C*o*.5))/exp2(o);"
"d*=u*Z;"
"n+=l*d;"
"l*=r;"
"t=.5;"
"w=i*t;"
"}"
"gl_FragColor.xyz=n;"
"}";
#endif // MARK_SMALL_H_

Binary file not shown.

View File

View File

@@ -0,0 +1,191 @@
#pragma once
#pragma data_seg(".shaders")
static char* fsh =
"#define ve return\n" // Line 1
"#define ec float\n" // Line 1
"varying vec4 Y;" // Line 6
"varying vec2 Z;" // Line 9
"vec4 R(vec3 n,vec3 m,int k);" // Line 12
"vec3 T(vec4 j,vec3 l,vec3 m);" // Line 13
"vec3 f,b,a,h,e,d,X;" // Line 17
"ec g,W,c,V,U;ec A(vec2 j){" // Line 18
"int i=int(j.x*40+j.y*6400);" // Line 24
"i=(i<<13)^i;" // Line 25
"ve 1-ec((i*(i*i*15731+789221)+1376312589)&0x7fffffff)/1073741824;}ec B(vec2 k){" // Line 26
"k=mod(k,1000.);" // Line 33
"vec2 i=fract(k);" // Line 34
"k-=i;" // Line 35
"vec2 j=i*i*(3.-2.*i);" // Line 36
"ve mix(" // Line 37
"mix(A(k+vec2(0,0)),A(k+vec2(1,0)),j.x)," // Line 38
"mix(A(k+vec2(0,1)),A(k+vec2(1,1)),j.x),j.y);}ec C(ec i){" // Line 39
"ve i*.5+.5;}ec D(ec k,ec l,ec j){" // Line 46
"ec i=(" // Line 53
"C(sin(c*2*(k+l+Y.y*j)))+" // Line 54
"C(sin(c*(l-k-Y.y*j)))+" // Line 55
"C(sin(c*(l+Y.y*j)))+" // Line 56
"C(sin(c*3*(k-Y.y*j))))*.3;" // Line 57
"ve pow(i,2.);}vec3 E(vec3 j){" // Line 58
"int i=int(mod(gl_FragCoord.x,3.));" // Line 65
"if(i==0)j*=X.xyz;" // Line 66
"if(i==1)j*=X.yzx;" // Line 67
"if(i==2)j*=X.zxy;" // Line 68
"ve mix(j,vec3(C(B(Z*333+A(vec2(Y.y))*33333))),Y.x*.3+.03);}vec3 F(vec3 i){" // Line 69
"vec2 j=Z*2-1;" // Line 76
"ec k=j.x*(j.y+3);" // Line 77
"ve i+a*" // Line 78
"D(k+50*e.x,k+50*e.z,1.5)*" // Line 79
"(C(j.y))*min(-e.y*30,.3);}ec G(vec2 i){" // Line 80
"ve (-.035+pow((D(i.x*10,i.y*10,.0)*2-1),2.)*.05)" // Line 87
"-(i.x-.1)*.2;}vec3 H(vec3 i){" // Line 88
"ve normalize(vec3(" // Line 95
"G(i.xz-vec2(U,0))-G(i.xz+vec2(U,0))," // Line 96
"2*U," // Line 97
"G(i.xz-vec2(0,U))-G(i.xz+vec2(0,U))));}vec3 I(vec3 i,vec3 j){" // Line 98
"ve (.3+.7*max(dot(j,b),.0))*a*i;}vec3 J(vec3 i){" // Line 105
"ve normalize(vec3(" // Line 112
"D(i.x*160-cos(i.z*10)*12,i.z*140,4.)," // Line 113
"8," // Line 114
"D(i.z*160-sin(i.x*10)*12,i.x*140,4.))*2-1);}vec3 K(vec3 k,vec3 l){" // Line 115
"vec3 j=H(k);" // Line 122
"vec3 i=mix(" // Line 123
"vec3(.66,.55,.4)" // Line 125
"-.2*B(abs(k.xz*150))" // Line 128
"-.2*B(abs(k.yy+.002*B(abs(k.xz*150)))*3000)," // Line 131
"vec3(.1,.3,0)*(B(k.xz*7000.)*.4+.5)," // Line 134
"clamp(j.y*(D(k.x*111,k.z*111,.0)*.5-k.y*40),.0,1.));" // Line 137
"if(k.y<=0)" // Line 140
"i+=5*J(.8*k).x*min(.3,-k.y*8);" // Line 141
"ve I(i,j);}vec3 L(vec3 j,vec3 i){" // Line 144
"ve j.y<=-V*V?" // Line 151
"h:" // Line 152
"mix(vec3(-.5,-.25,0),vec3(2),1-(i.y*.5+.5));}vec3 M(vec3 k,vec3 j){" // Line 153
"vec3 m=J(k);" // Line 162
"vec4 l=R(k,refract(j,m,.9),2);" // Line 166
"ec i=clamp(pow(1.03*(1-length(l.xyz-k)),16.),.0,1.);" // Line 169
"ve mix(" // Line 172
"e.y<0?L(k,j):h," // Line 173
"mix(" // Line 174
"T(R(k,reflect(j,m),2),k,j)," // Line 175
"T(l,k,j)," // Line 176
"clamp(-d.y+i,.0,1.))," // Line 177
"l.w==3.?.5:pow(i,.5));}vec3 N(vec3 k,vec3 l){" // Line 178
"vec3 j,i;" // Line 186
"j=normalize(k-f);" // Line 189
"vec2 m=.5+.5*vec2(atan(j.z,j.x),acos(j.y))/c;" // Line 192
"m.x-=Y.y;" // Line 195
"i=mix(vec3(1),vec3(1,0,0),mod(step(fract(m.x*6),.5)+step(fract(m.y*6),.5),2.));" // Line 198
"ve I(i,j)" // Line 200
"+pow(max(dot(j,normalize(b-l)),.0),33.)*a;}ec O(vec3 n,vec3 m,ec l){" // Line 201
"ec i,j,k,p;" // Line 209
"i=0;" // Line 210
"vec3 o=n;" // Line 211
"for(ec q=0;q<l;q+=i)" // Line 214
"{" // Line 215
"o+=m*i;" // Line 217
"p=o.y;" // Line 218
"ec r=G(o.xz);" // Line 221
"if(p<=r)" // Line 223
"{" // Line 224
"ve q-i+i*(j-k)/(p-r+j-k);}" // Line 227
"j=r;" // Line 232
"k=p;" // Line 233
"i=.002+(q/W);}" // Line 237
"ve 9.;}ec P(vec3 m,vec3 l){" // Line 241
"vec3 k=m-f;" // Line 248
"ec i,j;" // Line 249
"i=dot(k,l);" // Line 250
"if(i>0)" // Line 251
"ve 9.;" // Line 252
"j=i*i-dot(k,k)+g*g;" // Line 253
"if(j>0)" // Line 254
"{" // Line 255
"ve -i-sqrt(j);}" // Line 256
"ve 9.;}ec Q(vec3 j,vec3 i){" // Line 258
"ec k=-j.y/i.y;" // Line 265
"ve k>=V?k:9.;}vec4 R(vec3 n,vec3 m,int k){" // Line 266
"ec p,i,o,l;" // Line 278
"p=k!=2?Q(n,m):9.;" // Line 281
"i=k!=3?P(n,m):9.;" // Line 282
"o=k!=1?O(n,m,min(.5,.002+min(p,i))):9.;" // Line 283
"W/=20;" // Line 286
"l=min(o,min(p,min(i,9.)));" // Line 289
"if(l==9)" // Line 292
"ve vec4(0);" // Line 293
"vec3 j=n+m*l;" // Line 296
"if(l==o)" // Line 299
"ve vec4(j,1);" // Line 300
"if(l==p)" // Line 301
"ve vec4(j,2);" // Line 302
"if(l==i)" // Line 303
"ve vec4(j,3);}vec3 S(vec4 j,vec3 l,vec3 m){" // Line 304
"vec3 k=l.y<V?h:L(e,m);" // Line 315
"ec i=clamp(length(j.xyz-l)*(e.y<=0?4:2),.0,1.);" // Line 318
"if(j.w==1)" // Line 322
"ve mix(K(j.xyz,m),k,i);" // Line 323
"if(j.w==2)" // Line 324
"ve mix(M(j.xyz,m),k,i);" // Line 325
"if(j.w==3)" // Line 326
"ve mix(" // Line 327
"mix(N(j.xyz,m),T(R(j.xyz,reflect(m,normalize(j.xyz-f)),3),j.xyz,m),.5)" // Line 329
",k,i);" // Line 330
"ve L(l,m);}vec3 T(vec4 j,vec3 l,vec3 m){" // Line 332
"vec3 k=l.y<V?h:L(e,m);" // Line 341
"ec i=clamp(length(j.xyz-l)*(e.y<=0?4:2),.0,1.);" // Line 344
"if(j.w==1)" // Line 347
"ve mix(K(j.xyz,m),k,i);" // Line 348
"if(j.w==2)" // Line 349
"ve mix(h,k,i);" // Line 350
"if(j.w==3)" // Line 351
"ve mix(N(j.xyz,m),k,i);" // Line 352
"ve k;}void main(){" // Line 354
"W=100;" // Line 368
"c=3.1416;" // Line 371
"X=vec3(1.2,.9,.9);" // Line 372
"V=.0001;" // Line 373
"U=.01;" // Line 374
"ec k=10;" // Line 377
"int j=int(Y.y);" // Line 380
"d=vec3((Z.xy-.5),1);" // Line 383
"if(j>22&&j<27)" // Line 386
"{" // Line 387
"k=min(1.,sin((Y.y-23)*c*.25)*12);" // Line 388
"e=vec3(.12,.005,Y.y*.08);" // Line 389
"d=vec3(gl_ModelViewMatrix*vec4(d,1));" // Line 390
"d.y+=.1*cos(Y.y*4);}" // Line 391
"else if(j>14&&j<23)" // Line 394
"{" // Line 395
"k=min(1.,sin((Y.y-15)*c*.125)*24);" // Line 396
"d+=vec3(0,.1*cos(Y.y*4),0);" // Line 397
"e=vec3(.08,.01*sin(Y.y*4)+.002,Y.y*.11);}" // Line 398
"else " // Line 402
"{" // Line 403
"e=vec3(.1,.004,.0)+vec3(.1,.005,20)" // Line 405
"*vec3(A(vec2(j,k++)),A(vec2(j,k++)),A(vec2(j,k++)));" // Line 406
"e=mix(" // Line 409
"e+vec3(.008)*vec3(A(vec2(j,k++)),A(vec2(j,k++)),A(vec2(j,k++)))," // Line 410
"e+vec3(.008)*vec3(A(vec2(j,k++)),A(vec2(j,k++)),A(vec2(j,k++)))," // Line 411
"Y.y-j);" // Line 413
"e.y+=G(e.xz)+.02;" // Line 416
"e+=.02*H(e);" // Line 419
"k=min(1.,step(-28.,-Y.y)*sin((Y.y-j)*c)*3);}" // Line 422
"d=normalize(d);" // Line 425
"if(j>22&&j<27)" // Line 429
"f=e+.1*vec3(gl_ModelViewMatrix*vec4(0,0,1,1));" // Line 430
"else " // Line 432
"f=e+.02*vec3(sin(Y.y),0,5+cos(Y.y));" // Line 433
"f.y+=.01+G(f.xz);" // Line 435
"g=j<14?.0:U*.5+U*Y.z;" // Line 436
"f+=2*g*H(f);" // Line 437
"b=vec3(.58,.58,-.58);" // Line 440
"a=vec3(1.2);" // Line 441
"h=vec3(.3,.33,.4);" // Line 442
"if(e.y<=0)" // Line 445
"{" // Line 446
"W*=.75;" // Line 448
"a*=.8;}" // Line 451
"vec3 i=S(R(e,d,0),e,d);" // Line 455
"if(e.y<=0)" // Line 459
"i=F(i);" // Line 460
"gl_FragColor.xyz=E(step(2.,Y.y)*k*i);}";

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 843 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 549 KiB

View File

@@ -0,0 +1,163 @@
/* File generated with Shader Minifier 1.0.3
* http://www.ctrl-alt-test.fr
*/
#ifndef SHADER_CODE_H_
# define SHADER_CODE_H_
# define V_Y "v"
# define V_Z "m"
const char *mark_fs = ""
"varying vec4 v;"
"varying vec2 m;"
"vec3 f,z;"
"float x=6.28319;"
"vec2 n(vec2 f,float v)"
"{"
"return cos(v)*f+sin(v)*vec2(-f.y,f.x);"
"}"
"void i(inout vec3 v,float f)"
"{"
"float z=mod(atan(v.z,v.x),f)-f*.5;"
"v.xz=length(v.xz)*vec2(cos(z),sin(z));"
"}"
"float i(vec3 v,float f,float z)"
"{"
"return length(vec2(length(v.xz)-f,v.y))-z;"
"}"
"float s(vec3 v,float z)"
"{"
"return length(v)-z;"
"}"
"float i(vec3 v)"
"{"
"return v.y+.6;"
"}"
"float n(vec3 v)"
"{"
"return min(s(v+vec3(0,8.,0),8.5),i(v,2.3,.5));"
"}"
"float s(vec3 v)"
"{"
"float z=max(s(v,6.),v.y);"
"i(v,x/64.);"
"v.x=abs(v.x-5.)-2.;"
"float f=mix(length(v.yz),length(v.xyz),step(0.,v.x));"
"return min(z,f-.4);"
"}"
"float l(vec3 f)"
"{"
"return f.y-=4.,f.xz=n(f.xz,v.y*6.),i(f,x/12.),f.yz=n(f.yz,x/4.),min(i(f,2.,.15),s(f,1.5));"
"}"
"float h(vec3 v)"
"{"
"return min(min(min(i(v),n(v)),s(v)),l(v));"
"}"
"int g(vec3 v)"
"{"
"float z=1000.;"
"int f;"
"if(i(v)<z)"
"z=i(v),f=0;"
"if(n(v)<z)"
"z=n(v),f=1;"
"if(s(v)<z)"
"z=s(v),f=2;"
"if(l(v)<z)"
"z=l(v),f=3;"
"return f;"
"}"
"vec3 p(vec3 v)"
"{"
"vec3 z=vec3(.04,0.,0.),f;"
"f.x=h(v+z.xyy)-h(v-z.xyy);"
"f.y=h(v+z.yxy)-h(v-z.yxy);"
"f.z=h(v+z.yyx)-h(v-z.yyx);"
"return normalize(f);"
"}"
"float e(vec3 v)"
"{"
"float z=1.;"
"for(float f=.2;f<12.;f=f*1.1+.125)"
"z+=min(h(v+vec3(0.,1.,0.)*f),0.);"
"return clamp(z,.2,1.);"
"}"
"float e(vec3 v,vec3 f,float z,float i)"
"{"
"float x,y=sign(z);"
"for(x=y*.5+.5;i>0.;i--)"
"x-=(i*z-h(v+f*i*z*y))/exp2(i);"
"return x;"
"}"
"vec3 t(vec3 v)"
"{"
"float z=.3+.3*dot(v,vec3(0.,1.,0.));"
"i(v,x/16.);"
"v.x=abs(v.x-.2)-.08;"
"float f=mix(abs(v.z),length(v.xz),step(0.,v.x));"
"z+=pow(smoothstep(.1,0.,f),15.);"
"return vec3(z);"
"}"
"float c(vec3 v)"
"{"
"float z=abs(v.y-.9);"
"return.4+.3*(1-z);"
"}"
"void main()"
"{"
"int x=int(v.y);"
"float y=mod(v.y,1.);"
"z=vec3(m.xy-.5,1);"
"f=vec3(-30.-y*5.,3.,-16.+y*24.);"
"z.xz=n(z.xz,y*-2.5);"
"if(false)"
"{"
"f.x=gl_ModelViewMatrix[0][0];"
"f.y=gl_ModelViewMatrix[0][1];"
"f.z=gl_ModelViewMatrix[0][2];"
"float i=gl_ModelViewMatrix[1][1],s,r;"
"vec3 l=vec3(m.xy-.5,1);"
"s=cos(i);"
"r=sin(i);"
"z.y=s*l.y-r*l.z;"
"z.x=l.x;"
"z.z=r*l.y+s*l.z;"
"i=gl_ModelViewMatrix[1][0];"
"l=z;"
"s=cos(i);"
"r=sin(i);"
"z.x=s*l.x+r*l.z;"
"z.z=-r*l.x+s*l.z;"
"}"
"z=normalize(z);"
"vec3 i=vec3(0.,0.,0.);"
"float s=1.,l=0.,r=256.,a;"
"while(s>.1)"
"{"
"for(a=1.;l<r&&a>.05;l+=a)"
"a=h(f+z*l);"
"if(l<r)"
"{"
"f+=z*l;"
"vec3 o=p(f);"
"z=reflect(z,o);"
"l=.1;"
"vec3 d=vec3(.3,.2,.1);"
"float u=.125;"
"int M=g(f);"
"if(M==1)"
"d=vec3(.1,.1,.1),u=.8;"
"if(M==2)"
"d=vec3(.4,.3,.03),u=.2;"
"if(M==3)"
"d=vec3(.7,0.,0.),u=.2;"
"d*=c(o)*e(f)*e(f,o,.4,10.);"
"i+=s*d;"
"s*=u;"
"}"
"else"
" i+=s*t(z),s=0.;"
"}"
"gl_FragColor.xyz=i;"
"}";
#endif // SHADER_CODE_H_

127
evoke-64k/evk13-4k/small.h Normal file
View File

@@ -0,0 +1,127 @@
#pragma once
#pragma code_seg("sm0")
DWORD x_Ftol(float af_Value)
{
DWORD ldw_RetVal;
__asm fld af_Value
__asm fistp ldw_RetVal
return ldw_RetVal;
}
#pragma code_seg("sm1")
__forceinline float x_Frac(float af_Value)
{
return af_Value - x_Ftol(af_Value);
}
#pragma code_seg("sm2")
__forceinline float x_Abs(float af_Value)
{
__asm fld af_Value
__asm fabs
}
#pragma code_seg("sm3")
float x_Sin(float af_Value)
{
__asm fld af_Value
__asm fsin
}
#pragma code_seg("sm4")
float x_Sign(float af_Value)
{
if (af_Value != 0)
return af_Value / x_Abs(af_Value);
return 1.0f;
}
#pragma code_seg("sm5")
float x_Sqrt(float af_Value)
{
__asm fld af_Value
__asm fsqrt
}
#pragma code_seg("sm7")
__forceinline void x_MemCopy(void* av_Dest_, const void* av_Src_, size_t ai_Size)
{
__asm mov esi, av_Src_
__asm mov edi, av_Dest_
__asm mov ecx, ai_Size
__asm rep movsb
}
#pragma code_seg("sm8")
float x_Fmod(float x, float y)
{
__asm fld y
__asm fld x
__asm fprem
__asm fxch
__asm fstp x
}
#pragma data_seg("smA")
static unsigned long seed=0x12345678;
#pragma code_seg("sm9")
__forceinline void x_Randomize(unsigned long x)
{
seed = x;
}
#pragma code_seg("smB")
float x_Rand()
{
seed = seed * 0x76364873 + 1234567;
return (float)(seed & 0x7FFFFFFF) * (const float)(2.0f / (float)0x7FFFFFFF) - 1.0f;
}
#pragma code_seg("smS")
__forceinline size_t x_Strlen(const char* as_String)
{
size_t li_Length = 0;
while (*as_String++) ++li_Length;
return li_Length;
}
#pragma code_seg("smP")
float x_Pow(float x, float y){
float r;
__asm{
fld y
fld x
fyl2x
fld1
fld st(1)
fprem
f2xm1
faddp st(1),st
fscale
fxch st(1)
fstp st(0)
fstp r
}
return r;
}
extern "C"
{
int _fltused = 1;
}

View File

@@ -0,0 +1,23 @@
/O1
/Oi
/Os
/D "WIN32"
/D "NDEBUG"
/D "_WINDOWS"
/FD
/MT
/GS-
/GR-
/Fp".\obj\bp4k_Compress_Slow/cmath.pch"
/FAs
/Fa".\obj\bp4k_Compress_Slow/"
/Fo".\obj\bp4k_Compress_Slow/"
/Fd".\obj\bp4k_Compress_Slow/"
/FR".\obj\bp4k_Compress_Slow\\"
/W0
/nologo
/c
/Zi
/Gz
/TP
/errorReport:prompt

Binary file not shown.