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

1629
uc16-4k/4klang.asm Normal file

File diff suppressed because it is too large Load Diff

22
uc16-4k/4klang.h Normal file
View File

@@ -0,0 +1,22 @@
// some useful song defines for 4klang
#define SAMPLE_RATE 44100
#define BPM 145.065796
#define MAX_INSTRUMENTS 10
#define MAX_PATTERNS 102
#define PATTERN_SIZE_SHIFT 4
#define PATTERN_SIZE (1 << PATTERN_SIZE_SHIFT)
#define MAX_TICKS (MAX_PATTERNS*PATTERN_SIZE)
#define SAMPLES_PER_TICK 4560
#define MAX_SAMPLES (SAMPLES_PER_TICK*MAX_TICKS)
#define POLYPHONY 2
#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;

981
uc16-4k/4klang.inc Normal file
View File

@@ -0,0 +1,981 @@
%macro export_func 1
global _%1
_%1:
%endmacro
%define USE_SECTIONS
%define SAMPLE_RATE 44100
%define MAX_INSTRUMENTS 10
%define MAX_VOICES 2
%define HLD 1
%define BPM 145.065796
%define MAX_PATTERNS 102
%define PATTERN_SIZE_SHIFT 4
%define PATTERN_SIZE (1 << PATTERN_SIZE_SHIFT)
%define MAX_TICKS (MAX_PATTERNS*PATTERN_SIZE)
%define SAMPLES_PER_TICK 4560
%define DEF_LFO_NORMALIZE 0.0000548246
%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_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_MOD_PM
%define GO4K_USE_VCO_MOD_TM
%define GO4K_USE_VCO_MOD_CM
%define GO4K_USE_VCO_STEREO
%define GO4K_USE_VCF_CHECK
%define GO4K_USE_VCF_HIGH
%define GO4K_USE_VCF_BAND
%define GO4K_USE_VCF_PEAK
%define GO4K_USE_VCF_STEREO
%define GO4K_USE_DST_CHECK
%define GO4K_USE_DST_SH
%define GO4K_USE_DST_STEREO
%define GO4K_USE_DLL_NOTE_SYNC
%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_PAN_MOD
%define GO4K_USE_OUT_MOD_GM
%define GO4K_USE_WAVESHAPER_CLIP
%define MAX_DELAY 65536
%define MAX_UNITS 48
%define MAX_UNIT_SLOTS 9
%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
%define VCO_STEREO 0x40
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
.phase2 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 STEREO 0x10
%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
.low2 resd 1
.high2 resd 1
.band2 resd 1
.size
endstruc
GO4K_DST_ID equ 4
%macro GO4K_DST 3
db %1
%ifdef GO4K_USE_DST_SH
db %2
%ifdef GO4K_USE_DST_STEREO
db %3
%endif
%else
%ifdef GO4K_USE_DST_STEREO
db %3
%endif
%endif
%endmacro
%define DRIVE(val) val
%define SNHFREQ(val) val
%define FLAGS(val) val
struc go4kDST_val
.drive resd 1
%ifdef GO4K_USE_DST_SH
.snhfreq resd 1
%endif
.flags resd 1
.size
endstruc
struc go4kDST_wrk
.out resd 1
.snhphase resd 1
.dm resd 1
.sm resd 1
.out2 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
%define FOP_MULP2 0xa
struc go4kFOP_val
.flags resd 1
.size
endstruc
struc go4kFOP_wrk
.size
endstruc
GO4K_FST_ID equ 7
%macro GO4K_FST 2
db %1
dw %2
%endmacro
%define AMOUNT(val) val
%define DEST(val) val
%define FST_SET 0x0000
%define FST_ADD 0x4000
%define FST_POP 0x8000
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 %1
%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
dw %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 MAX_UNITS*MAX_UNIT_SLOTS
.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, 0, 0, 0, 0, 0, 0, 0, 0,
db 78, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0,
db 75, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 78, HLD, 0, 0, 0, 0, 90, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 75, HLD, 0, 0, 0, 0, 87, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 0, 0, 82, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0,
db 0, 0, 83, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 0, 0, 80, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 0, 0, 82, HLD, 0, 0, 0, 0, 94, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 0, 0, 83, HLD, 0, 0, 0, 0, 95, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 0, 0, 80, HLD, 0, 0, 0, 0, 92, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 0, 0, 0, 0, 73, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0,
db 0, 0, 0, 0, 75, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 0, 0, 0, 0, 71, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 0, 0, 0, 0, 73, HLD, 0, 0, 0, 0, 85, HLD, HLD, HLD, HLD, HLD,
db 0, 0, 0, 0, 75, HLD, 0, 0, 0, 0, 87, HLD, HLD, HLD, HLD, HLD,
db 0, 0, 0, 0, 71, HLD, 0, 0, 0, 0, 83, HLD, HLD, HLD, HLD, HLD,
db 42, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 39, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 35, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 37, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 47, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0,
db 48, 0, 48, 0, 0, 0, 48, 0, 48, 0, 48, 0, 0, 0, 48, 0,
db 0, 0, 0, 0, 0, 0, 48, 0, 48, 0, 48, 0, 0, 0, 48, 0,
db 60, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 60, HLD,
db 60, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0,
db 60, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 0, 0, 0, 0, 0, 0, 0, 0, 48, HLD, HLD, HLD, HLD, HLD, 48, HLD,
db 0, 0, 0, 0, 0, 0, 0, 0, 60, HLD, HLD, HLD, HLD, HLD, 0, 0,
db 0, 0, 0, 0, 0, 0, 0, 0, 48, HLD, HLD, HLD, HLD, HLD, 0, 0,
db 0, 0, 0, 0, 0, 0, 0, 0, 70, HLD, 0, 0, 71, HLD, 73, HLD,
db 0, 0, 73, HLD, HLD, HLD, 0, 0, 0, 0, 73, HLD, 0, 0, 75, HLD,
db 0, 0, 73, HLD, HLD, HLD, 0, 0, 0, 0, 78, HLD, 0, 0, 77, HLD,
db 0, 0, 73, HLD, HLD, HLD, 0, 0, 0, 0, 78, HLD, 0, 80, 82, HLD,
db HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 80, HLD,
db 0, 0, 0, 0, 0, 0, 0, 0, 78, HLD, 0, 0, 77, HLD, 75, HLD,
db 0, 0, 75, HLD, HLD, HLD, 0, 0, 0, 0, 71, HLD, 0, 0, 73, HLD,
db 0, 0, 0, 0, 0, 0, 0, 0, 82, HLD, 0, 0, 83, HLD, 85, HLD,
db 0, 0, 85, HLD, HLD, HLD, 0, 0, 0, 0, 85, HLD, 0, 0, 87, HLD,
db 0, 0, 85, HLD, HLD, HLD, 0, 0, 0, 0, 90, HLD, 0, 0, 89, HLD,
db 0, 0, 85, HLD, HLD, HLD, 0, 0, 0, 0, 90, HLD, 0, 92, 94, HLD,
db HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 92, HLD,
db 90, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 0, 0, 0, 0, 0, 0, 0, 0, 90, HLD, 0, 0, 89, HLD, 87, HLD,
db 0, 0, 87, HLD, HLD, HLD, 0, 0, 0, 0, 83, HLD, 0, 0, 85, HLD,
db 0, 0, 0, 0, 0, 0, 0, 0, 78, HLD, 0, 0, 80, HLD, 82, HLD,
db 0, 0, 82, HLD, HLD, HLD, 0, 0, 0, 0, 82, HLD, 0, 0, 83, HLD,
db 0, 0, 82, HLD, HLD, HLD, 0, 0, 0, 0, 87, HLD, 0, 0, 85, HLD,
db 0, 0, 82, HLD, HLD, HLD, 0, 0, 0, 0, 85, HLD, 0, 89, 90, HLD,
db HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 89, HLD,
db 87, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 0, 0, 0, 0, 0, 0, 0, 0, 87, HLD, 0, 0, 85, HLD, 83, HLD,
db 0, 0, 83, HLD, HLD, HLD, 0, 0, 0, 0, 80, HLD, 0, 0, 78, HLD,
db HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 77, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 78, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 80, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 72, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
go4k_patterns_end
%ifdef USE_SECTIONS
section .g4kmuc2 data align=1
%else
section .data
%endif
go4k_pattern_lists
Instrument0List db 1, 2, 1, 2, 3, 2, 1, 2, 1, 2, 1, 2, 3, 2, 1, 2, 4, 2, 4, 2, 5, 2, 4, 2, 4, 2, 4, 2, 5, 2, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 2, 5, 2, 4, 2, 4, 2, 4, 2, 5, 2, 4, 2, 0, 0, 4, 2, 5, 2, 4, 2, 4, 2, 4, 2, 5, 2, 4, 2, 4, 2, 4, 2, 5, 2, 4, 2, 4, 2, 4, 2, 5, 2, 4, 2, 1, 2, 0, 0, 0, 0,
Instrument1List db 6, 7, 8, 7, 9, 7, 8, 7, 6, 7, 8, 7, 9, 7, 8, 7, 10, 7, 11, 7, 12, 7, 11, 7, 10, 7, 11, 7, 12, 7, 11, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 7, 12, 7, 11, 7, 10, 7, 11, 7, 12, 7, 11, 7, 0, 0, 11, 7, 12, 7, 11, 7, 10, 7, 11, 7, 12, 7, 11, 7, 10, 7, 11, 7, 12, 7, 11, 7, 10, 7, 11, 7, 12, 7, 11, 7, 6, 7, 0, 0, 0, 0,
Instrument2List db 13, 14, 15, 14, 16, 14, 13, 14, 13, 14, 15, 14, 16, 14, 13, 14, 17, 14, 18, 14, 19, 14, 17, 14, 17, 14, 18, 14, 19, 14, 17, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 14, 19, 14, 17, 14, 17, 14, 18, 14, 19, 14, 17, 14, 0, 0, 18, 14, 19, 14, 17, 14, 17, 14, 18, 14, 19, 14, 17, 14, 17, 14, 18, 14, 19, 14, 17, 14, 17, 14, 18, 14, 19, 14, 17, 14, 13, 14, 0, 0, 0, 0,
Instrument3List db 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 21, 23, 21, 24, 21, 20, 21, 22, 21, 23, 21, 24, 21, 20, 21, 22, 21, 23, 21, 24, 21, 20, 21, 22, 21, 23, 21, 24, 21, 20, 21, 22, 21, 23, 21, 24, 21, 0, 0, 25, 21, 23, 21, 24, 21, 20, 21, 22, 21, 23, 21, 24, 21, 0, 0, 25, 21, 23, 21, 24, 21, 20, 21, 22, 21, 23, 21, 24, 21, 20, 21, 22, 21, 23, 21, 24, 21, 20, 21, 22, 21, 23, 21, 24, 21, 20, 21, 0, 0, 0, 0,
Instrument4List db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 28, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 28, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0, 0,
Instrument5List db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 2, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 31, 2, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 0, 0, 0, 0, 0, 0,
Instrument6List db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 33, 32, 34, 32, 34, 32, 34, 32, 33, 32, 34, 32, 34, 32, 34, 32, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 0, 32, 34, 32, 34, 32, 34, 32, 33, 32, 34, 32, 34, 32, 34, 32, 0, 32, 34, 32, 34, 32, 34, 32, 33, 32, 34, 32, 34, 32, 34, 32, 33, 32, 34, 32, 34, 32, 34, 32, 33, 32, 34, 32, 34, 32, 34, 32, 21, 21, 21, 21, 21, 14,
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, 35, 36, 21, 0, 35, 37, 21, 0, 35, 38, 39, 1, 40, 41, 21, 0, 42, 43, 21, 0, 42, 44, 21, 0, 42, 45, 46, 47, 48, 49, 21, 0, 42, 43, 21, 0, 42, 44, 21, 0, 42, 45, 46, 47, 48, 49, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Instrument8List 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, 50, 51, 21, 0, 50, 52, 21, 0, 50, 53, 54, 55, 56, 57, 58, 59, 50, 51, 21, 0, 50, 52, 21, 0, 50, 53, 54, 55, 56, 57, 58, 59, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Instrument9List 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, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, 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, 60, 0, 0, 0, 0, 0,
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_FOP_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_DST_ID
db GO4K_VCF_ID
db GO4K_VCF_ID
db GO4K_DLL_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_FST_ID
db GO4K_PAN_ID
db GO4K_OUT_ID
GO4K_END_CMDDEF
GO4K_BEGIN_CMDDEF(Instrument1)
db GO4K_ENV_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_DST_ID
db GO4K_VCF_ID
db GO4K_VCF_ID
db GO4K_DLL_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_FST_ID
db GO4K_PAN_ID
db GO4K_OUT_ID
GO4K_END_CMDDEF
GO4K_BEGIN_CMDDEF(Instrument2)
db GO4K_ENV_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_DST_ID
db GO4K_VCF_ID
db GO4K_VCF_ID
db GO4K_DLL_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_FST_ID
db GO4K_PAN_ID
db GO4K_OUT_ID
GO4K_END_CMDDEF
GO4K_BEGIN_CMDDEF(Instrument3)
db GO4K_ENV_ID
db GO4K_VCO_ID
db GO4K_FST_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_FOP_ID
db GO4K_FOP_ID
db GO4K_VCF_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_FOP_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_VCF_ID
db GO4K_DST_ID
db GO4K_DLL_ID
db GO4K_FST_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_ENV_ID
db GO4K_DST_ID
db GO4K_FST_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_PAN_ID
db GO4K_OUT_ID
GO4K_END_CMDDEF
GO4K_BEGIN_CMDDEF(Instrument6)
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_FOP_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_DST_ID
db GO4K_PAN_ID
db GO4K_OUT_ID
GO4K_END_CMDDEF
GO4K_BEGIN_CMDDEF(Instrument7)
db GO4K_ENV_ID
db GO4K_ENV_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_FST_ID
db GO4K_FOP_ID
db GO4K_ENV_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_DLL_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_DST_ID
db GO4K_ENV_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_FST_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_VCF_ID
db GO4K_VCF_ID
db GO4K_DLL_ID
db GO4K_PAN_ID
db GO4K_OUT_ID
GO4K_END_CMDDEF
GO4K_BEGIN_CMDDEF(Instrument8)
db GO4K_ENV_ID
db GO4K_ENV_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_FST_ID
db GO4K_FOP_ID
db GO4K_ENV_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_DLL_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_DST_ID
db GO4K_ENV_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_FST_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_VCF_ID
db GO4K_VCF_ID
db GO4K_DLL_ID
db GO4K_PAN_ID
db GO4K_OUT_ID
GO4K_END_CMDDEF
GO4K_BEGIN_CMDDEF(Instrument9)
db GO4K_ENV_ID
db GO4K_FST_ID
db GO4K_ENV_ID
db GO4K_DST_ID
db GO4K_FST_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_PAN_ID
db GO4K_OUT_ID
GO4K_END_CMDDEF
GO4K_BEGIN_CMDDEF(Global)
db GO4K_ACC_ID
db GO4K_DLL_ID
db GO4K_FOP_ID
db GO4K_DLL_ID
db GO4K_FOP_ID
db GO4K_ACC_ID
db GO4K_FOP_ID
db GO4K_DST_ID
db GO4K_VCF_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(16),DECAY(0),SUSTAIN(128),RELEASE(80),GAIN(96)
GO4K_VCO TRANSPOSE(59),DETUNE(70),PHASE(0),GATES(0),COLOR(126),SHAPE(64),GAIN(88),FLAGS(SINE|VCO_STEREO)
GO4K_FOP OP(FOP_ADDP)
GO4K_VCO TRANSPOSE(76),DETUNE(66),PHASE(0),GATES(0),COLOR(124),SHAPE(64),GAIN(48),FLAGS(SINE|VCO_STEREO)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_ADDP)
GO4K_VCO TRANSPOSE(92),DETUNE(66),PHASE(0),GATES(0),COLOR(120),SHAPE(64),GAIN(8),FLAGS(SINE|VCO_STEREO)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_ADDP)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(39),GAIN(64),FLAGS(NOISE)
GO4K_DST DRIVE(24), SNHFREQ(32), FLAGS(0)
GO4K_VCF FREQUENCY(64),RESONANCE(128),VCFTYPE(LOWPASS)
GO4K_VCF FREQUENCY(32),RESONANCE(128),VCFTYPE(HIGHPASS)
GO4K_DLL PREGAIN(64),DRY(128),FEEDBACK(64),DAMP(64),FREQUENCY(73),DEPTH(47),DELAY(0),COUNT(1)
GO4K_FOP OP(FOP_ADDP)
GO4K_VCF FREQUENCY(80),RESONANCE(64),VCFTYPE(LOWPASS)
GO4K_FOP OP(FOP_MULP)
GO4K_FST AMOUNT(72),DEST(18*MAX_UNIT_SLOTS+0+FST_SET)
GO4K_PAN PANNING(64)
GO4K_OUT GAIN(4), AUXSEND(12)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument1)
GO4K_ENV ATTAC(16),DECAY(0),SUSTAIN(128),RELEASE(80),GAIN(96)
GO4K_VCO TRANSPOSE(59),DETUNE(70),PHASE(0),GATES(0),COLOR(126),SHAPE(64),GAIN(88),FLAGS(SINE|VCO_STEREO)
GO4K_FOP OP(FOP_ADDP)
GO4K_VCO TRANSPOSE(76),DETUNE(66),PHASE(0),GATES(0),COLOR(124),SHAPE(64),GAIN(48),FLAGS(SINE|VCO_STEREO)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_ADDP)
GO4K_VCO TRANSPOSE(92),DETUNE(66),PHASE(0),GATES(0),COLOR(120),SHAPE(64),GAIN(8),FLAGS(SINE|VCO_STEREO)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_ADDP)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(39),GAIN(64),FLAGS(NOISE)
GO4K_DST DRIVE(24), SNHFREQ(32), FLAGS(0)
GO4K_VCF FREQUENCY(64),RESONANCE(128),VCFTYPE(LOWPASS)
GO4K_VCF FREQUENCY(32),RESONANCE(128),VCFTYPE(HIGHPASS)
GO4K_DLL PREGAIN(64),DRY(128),FEEDBACK(64),DAMP(64),FREQUENCY(73),DEPTH(47),DELAY(0),COUNT(1)
GO4K_FOP OP(FOP_ADDP)
GO4K_VCF FREQUENCY(80),RESONANCE(64),VCFTYPE(LOWPASS)
GO4K_FOP OP(FOP_MULP)
GO4K_FST AMOUNT(72),DEST(18*MAX_UNIT_SLOTS+0+FST_SET)
GO4K_PAN PANNING(64)
GO4K_OUT GAIN(4), AUXSEND(12)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument2)
GO4K_ENV ATTAC(16),DECAY(0),SUSTAIN(128),RELEASE(80),GAIN(96)
GO4K_VCO TRANSPOSE(59),DETUNE(70),PHASE(0),GATES(0),COLOR(126),SHAPE(64),GAIN(88),FLAGS(SINE|VCO_STEREO)
GO4K_FOP OP(FOP_ADDP)
GO4K_VCO TRANSPOSE(76),DETUNE(66),PHASE(0),GATES(0),COLOR(124),SHAPE(64),GAIN(48),FLAGS(SINE|VCO_STEREO)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_ADDP)
GO4K_VCO TRANSPOSE(92),DETUNE(66),PHASE(0),GATES(0),COLOR(120),SHAPE(64),GAIN(8),FLAGS(SINE|VCO_STEREO)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_ADDP)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(39),GAIN(64),FLAGS(NOISE)
GO4K_DST DRIVE(24), SNHFREQ(32), FLAGS(0)
GO4K_VCF FREQUENCY(64),RESONANCE(128),VCFTYPE(LOWPASS)
GO4K_VCF FREQUENCY(32),RESONANCE(128),VCFTYPE(HIGHPASS)
GO4K_DLL PREGAIN(64),DRY(128),FEEDBACK(64),DAMP(64),FREQUENCY(73),DEPTH(47),DELAY(0),COUNT(1)
GO4K_FOP OP(FOP_ADDP)
GO4K_VCF FREQUENCY(80),RESONANCE(64),VCFTYPE(LOWPASS)
GO4K_FOP OP(FOP_MULP)
GO4K_FST AMOUNT(72),DEST(18*MAX_UNIT_SLOTS+0+FST_SET)
GO4K_PAN PANNING(64)
GO4K_OUT GAIN(4), AUXSEND(12)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument3)
GO4K_ENV ATTAC(0),DECAY(32),SUSTAIN(112),RELEASE(64),GAIN(128)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(85),COLOR(128),SHAPE(64),GAIN(117),FLAGS(SINE)
GO4K_FST AMOUNT(112),DEST(6*MAX_UNIT_SLOTS+4+FST_SET)
GO4K_FST AMOUNT(112),DEST(7*MAX_UNIT_SLOTS+5+FST_SET)
GO4K_FST AMOUNT(40),DEST(8*MAX_UNIT_SLOTS+5+FST_SET)
GO4K_FOP OP(FOP_POP)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(64),GAIN(128),FLAGS(TRISAW)
GO4K_VCO TRANSPOSE(64),DETUNE(80),PHASE(80),GATES(85),COLOR(80),SHAPE(64),GAIN(128),FLAGS(TRISAW)
GO4K_VCO TRANSPOSE(64),DETUNE(48),PHASE(48),GATES(85),COLOR(48),SHAPE(64),GAIN(128),FLAGS(TRISAW)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_ADDP)
GO4K_VCF FREQUENCY(48),RESONANCE(88),VCFTYPE(LOWPASS)
GO4K_VCF FREQUENCY(48),RESONANCE(88),VCFTYPE(LOWPASS)
GO4K_FOP OP(FOP_MULP)
GO4K_PAN PANNING(64)
GO4K_DLL PREGAIN(64),DRY(128),FEEDBACK(64),DAMP(64),FREQUENCY(0),DEPTH(0),DELAY(17),COUNT(1)
GO4K_FOP OP(FOP_XCH)
GO4K_DLL PREGAIN(64),DRY(128),FEEDBACK(64),DAMP(64),FREQUENCY(0),DEPTH(0),DELAY(17),COUNT(1)
GO4K_FOP OP(FOP_XCH)
GO4K_OUT GAIN(48), AUXSEND(16)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument4)
GO4K_ENV ATTAC(0),DECAY(62),SUSTAIN(24),RELEASE(72),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(64),RESONANCE(128),VCFTYPE(PEAK)
GO4K_VCF FREQUENCY(72),RESONANCE(128),VCFTYPE(PEAK)
GO4K_DST DRIVE(64), SNHFREQ(128), FLAGS(0)
GO4K_DLL PREGAIN(64),DRY(128),FEEDBACK(64),DAMP(64),FREQUENCY(0),DEPTH(0),DELAY(18),COUNT(1)
GO4K_FST AMOUNT(128),DEST(8*MAX_UNIT_SLOTS+0+FST_SET)
GO4K_PAN PANNING(64)
GO4K_OUT GAIN(8), AUXSEND(4)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument5)
GO4K_ENV ATTAC(16),DECAY(64),SUSTAIN(0),RELEASE(72),GAIN(128)
GO4K_FST AMOUNT(112),DEST(0*MAX_UNIT_SLOTS+2+FST_SET)
GO4K_ENV ATTAC(0),DECAY(48),SUSTAIN(0),RELEASE(0),GAIN(128)
GO4K_DST DRIVE(32), SNHFREQ(128), FLAGS(0)
GO4K_FST AMOUNT(92),DEST(6*MAX_UNIT_SLOTS+1+FST_SET)
GO4K_FOP OP(FOP_POP)
GO4K_VCO TRANSPOSE(52),DETUNE(64),PHASE(0),GATES(85),COLOR(128),SHAPE(64),GAIN(128),FLAGS(SINE)
GO4K_FOP OP(FOP_MULP)
GO4K_PAN PANNING(64)
GO4K_OUT GAIN(112), AUXSEND(0)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument6)
GO4K_ENV ATTAC(16),DECAY(72),SUSTAIN(0),RELEASE(72),GAIN(128)
GO4K_FST AMOUNT(128),DEST(0*MAX_UNIT_SLOTS+2+FST_SET)
GO4K_ENV ATTAC(0),DECAY(56),SUSTAIN(0),RELEASE(0),GAIN(128)
GO4K_FST AMOUNT(108),DEST(6*MAX_UNIT_SLOTS+1+FST_SET)
GO4K_FST AMOUNT(72),DEST(7*MAX_UNIT_SLOTS+1+FST_SET)
GO4K_FOP OP(FOP_POP)
GO4K_VCO TRANSPOSE(32),DETUNE(64),PHASE(0),GATES(85),COLOR(128),SHAPE(32),GAIN(128),FLAGS(SINE)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(85),COLOR(128),SHAPE(80),GAIN(128),FLAGS(SINE)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(64),GAIN(72),FLAGS(NOISE)
GO4K_VCF FREQUENCY(96),RESONANCE(96),VCFTYPE(LOWPASS)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_MULP)
GO4K_VCF FREQUENCY(24),RESONANCE(32),VCFTYPE(HIGHPASS)
GO4K_DST DRIVE(48), SNHFREQ(128), FLAGS(0)
GO4K_PAN PANNING(72)
GO4K_OUT GAIN(48), AUXSEND(24)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument7)
GO4K_ENV ATTAC(56),DECAY(0),SUSTAIN(128),RELEASE(64),GAIN(128)
GO4K_ENV ATTAC(112),DECAY(64),SUSTAIN(64),RELEASE(64),GAIN(64)
GO4K_VCO TRANSPOSE(72),DETUNE(64),PHASE(0),GATES(0),COLOR(128),SHAPE(64),GAIN(64),FLAGS(SINE|LFO)
GO4K_FOP OP(FOP_MULP)
GO4K_FST AMOUNT(68),DEST(7*MAX_UNIT_SLOTS+1+FST_SET)
GO4K_FOP OP(FOP_POP)
GO4K_ENV ATTAC(49),DECAY(88),SUSTAIN(88),RELEASE(0),GAIN(128)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(120),SHAPE(4),GAIN(56),FLAGS(TRISAW)
GO4K_VCO TRANSPOSE(124),DETUNE(64),PHASE(0),GATES(85),COLOR(121),SHAPE(64),GAIN(24),FLAGS(NOISE|LFO)
GO4K_VCF FREQUENCY(64),RESONANCE(64),VCFTYPE(ALLPASS)
GO4K_FOP OP(FOP_ADDP)
GO4K_VCF FREQUENCY(40),RESONANCE(128),VCFTYPE(BANDSTOP)
GO4K_VCF FREQUENCY(72),RESONANCE(48),VCFTYPE(ALLPASS)
GO4K_FOP OP(FOP_MULP)
GO4K_VCF FREQUENCY(96),RESONANCE(128),VCFTYPE(ALLPASS)
GO4K_DLL PREGAIN(128),DRY(128),FEEDBACK(126),DAMP(48),FREQUENCY(0),DEPTH(0),DELAY(0),COUNT(1)
GO4K_FOP OP(FOP_MULP)
GO4K_VCF FREQUENCY(48),RESONANCE(64),VCFTYPE(LOWPASS)
GO4K_DST DRIVE(96), SNHFREQ(128), FLAGS(0)
GO4K_ENV ATTAC(80),DECAY(128),SUSTAIN(128),RELEASE(0),GAIN(128)
GO4K_VCO TRANSPOSE(76),DETUNE(64),PHASE(0),GATES(0),COLOR(128),SHAPE(64),GAIN(64),FLAGS(SINE|LFO)
GO4K_FOP OP(FOP_MULP)
GO4K_FST AMOUNT(72),DEST(29*MAX_UNIT_SLOTS+1+FST_SET)
GO4K_FOP OP(FOP_POP)
GO4K_VCF FREQUENCY(128),RESONANCE(128),VCFTYPE(BANDSTOP)
GO4K_VCF FREQUENCY(112),RESONANCE(128),VCFTYPE(LOWPASS)
GO4K_VCF FREQUENCY(92),RESONANCE(128),VCFTYPE(PEAK)
GO4K_DLL PREGAIN(64),DRY(128),FEEDBACK(64),DAMP(64),FREQUENCY(0),DEPTH(0),DELAY(19),COUNT(1)
GO4K_PAN PANNING(64)
GO4K_OUT GAIN(32), AUXSEND(8)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument8)
GO4K_ENV ATTAC(56),DECAY(0),SUSTAIN(128),RELEASE(64),GAIN(128)
GO4K_ENV ATTAC(112),DECAY(64),SUSTAIN(64),RELEASE(64),GAIN(64)
GO4K_VCO TRANSPOSE(76),DETUNE(64),PHASE(0),GATES(0),COLOR(128),SHAPE(64),GAIN(64),FLAGS(SINE|LFO)
GO4K_FOP OP(FOP_MULP)
GO4K_FST AMOUNT(68),DEST(7*MAX_UNIT_SLOTS+1+FST_SET)
GO4K_FOP OP(FOP_POP)
GO4K_ENV ATTAC(49),DECAY(88),SUSTAIN(88),RELEASE(0),GAIN(128)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(112),SHAPE(16),GAIN(56),FLAGS(TRISAW)
GO4K_VCO TRANSPOSE(124),DETUNE(64),PHASE(0),GATES(85),COLOR(121),SHAPE(64),GAIN(24),FLAGS(NOISE|LFO)
GO4K_VCF FREQUENCY(64),RESONANCE(64),VCFTYPE(ALLPASS)
GO4K_FOP OP(FOP_ADDP)
GO4K_VCF FREQUENCY(112),RESONANCE(128),VCFTYPE(PEAK)
GO4K_VCF FREQUENCY(64),RESONANCE(48),VCFTYPE(ALLPASS)
GO4K_FOP OP(FOP_MULP)
GO4K_VCF FREQUENCY(88),RESONANCE(128),VCFTYPE(ALLPASS)
GO4K_DLL PREGAIN(128),DRY(128),FEEDBACK(126),DAMP(48),FREQUENCY(0),DEPTH(0),DELAY(0),COUNT(1)
GO4K_FOP OP(FOP_MULP)
GO4K_VCF FREQUENCY(49),RESONANCE(60),VCFTYPE(LOWPASS)
GO4K_DST DRIVE(88), SNHFREQ(128), FLAGS(0)
GO4K_ENV ATTAC(80),DECAY(128),SUSTAIN(128),RELEASE(0),GAIN(128)
GO4K_VCO TRANSPOSE(72),DETUNE(64),PHASE(0),GATES(0),COLOR(128),SHAPE(64),GAIN(64),FLAGS(SINE|LFO)
GO4K_FOP OP(FOP_MULP)
GO4K_FST AMOUNT(72),DEST(29*MAX_UNIT_SLOTS+1+FST_SET)
GO4K_FOP OP(FOP_POP)
GO4K_VCF FREQUENCY(128),RESONANCE(128),VCFTYPE(BANDSTOP)
GO4K_VCF FREQUENCY(112),RESONANCE(128),VCFTYPE(LOWPASS)
GO4K_VCF FREQUENCY(92),RESONANCE(128),VCFTYPE(PEAK)
GO4K_DLL PREGAIN(64),DRY(128),FEEDBACK(64),DAMP(64),FREQUENCY(0),DEPTH(0),DELAY(19),COUNT(1)
GO4K_PAN PANNING(64)
GO4K_OUT GAIN(8), AUXSEND(8)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument9)
GO4K_ENV ATTAC(0),DECAY(32),SUSTAIN(96),RELEASE(80),GAIN(128)
GO4K_FST AMOUNT(128),DEST(0*MAX_UNIT_SLOTS+2+FST_SET)
GO4K_ENV ATTAC(0),DECAY(88),SUSTAIN(48),RELEASE(106),GAIN(128)
GO4K_DST DRIVE(29), SNHFREQ(128), FLAGS(0)
GO4K_FST AMOUNT(76),DEST(6*MAX_UNIT_SLOTS+1+FST_SET)
GO4K_FOP OP(FOP_POP)
GO4K_VCO TRANSPOSE(32),DETUNE(64),PHASE(32),GATES(85),COLOR(128),SHAPE(66),GAIN(128),FLAGS(SINE)
GO4K_FOP OP(FOP_MULP)
GO4K_PAN PANNING(64)
GO4K_OUT GAIN(16), AUXSEND(16)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Global)
GO4K_ACC ACCTYPE(AUX)
GO4K_DLL PREGAIN(40),DRY(128),FEEDBACK(125),DAMP(64),FREQUENCY(0),DEPTH(0),DELAY(1),COUNT(8)
GO4K_FOP OP(FOP_XCH)
GO4K_DLL PREGAIN(40),DRY(128),FEEDBACK(125),DAMP(64),FREQUENCY(0),DEPTH(0),DELAY(9),COUNT(8)
GO4K_FOP OP(FOP_XCH)
GO4K_ACC ACCTYPE(OUTPUT)
GO4K_FOP OP(FOP_ADDP2)
GO4K_DST DRIVE(64), SNHFREQ(128), FLAGS(STEREO)
GO4K_VCF FREQUENCY(8),RESONANCE(128),VCFTYPE(HIGHPASS|STEREO)
GO4K_OUT GAIN(56), 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 0
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 12160
dw 9120
dw 18240
%endif

BIN
uc16-4k/4klang.obj Normal file

Binary file not shown.

BIN
uc16-4k/8klang.merge Normal file

Binary file not shown.

119
uc16-4k/Shaders.cpp Normal file
View File

@@ -0,0 +1,119 @@
#include "Shaders.h"
#ifdef _DEBUG
#include <gl/GLU.h>
PFNGLCREATESHADERPROGRAMEXTPROC glCreateShaderProgram = NULL;
PFNGLGETPROGRAMIVPROC glGetProgramiv = NULL;
PFNGLUSEPROGRAMPROC glUseProgram = NULL;
PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog = NULL;
void useProgram(GLhandleARB ah_Program)
{
glUseProgram(ah_Program);
}
void initShaders()
{
glGetProgramiv = (PFNGLGETPROGRAMIVPROC)myGetProcAddress("glGetProgramiv");
glUseProgram = (PFNGLUSEPROGRAMPROC)myGetProcAddress("glUseProgram");
glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)myGetProcAddress("glGetProgramInfoLog");
glCreateShaderProgram = (PFNGLCREATESHADERPROGRAMEXTPROC)myGetProcAddress("glCreateShaderProgramEXT");
if (!(glCreateShaderProgram && glGetProgramiv && glUseProgram && glGetProgramInfoLog))
{
std::cerr << "Some shader functions are not available!" << std::endl;
}
}
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 createFragmentProgram(const char* as_FileName)
{
GLhandleARB lh_Program = 0;
char* ls_ShaderSource = textFileRead(as_FileName);
if (ls_ShaderSource == NULL)
{
std::cerr << "Error reading file: " << as_FileName << std::endl;
return lh_Program;
}
lh_Program = glCreateShaderProgram(GL_FRAGMENT_SHADER, ls_ShaderSource);
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 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);
}
}
#endif

16
uc16-4k/Shaders.h Normal file
View File

@@ -0,0 +1,16 @@
#pragma once
#define MAX_SHADER_ID 1
#include <windows.h>
#include <iostream>
#include <GL/gl.h>
#include "glext.h"
#define myGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
void initShaders();
GLhandleARB createFragmentProgram(const char* as_FileName);
void PrintErrors();
void useProgram(GLhandleARB ah_Program);
char* textFileRead(const char* as_FileName);
void printProgramInfoLog(GLhandleARB ah_Program);

2
uc16-4k/build.bat Normal file
View File

@@ -0,0 +1,2 @@
cl /c /GS- /Qpar- /analyze- /W0 /Gy- /Zc:wchar_t /Gm- /O1 /Ob2 /Fd"obj/party/vc140.pdb" /fp:fast /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "SCREENWIDTH"=%1 /D "SCREENHEIGHT"=%2 /errorReport:prompt /WX- /Zc:forScope /GR- /arch:IA32 /Gz /Oy /Oi /MT /Fa"obj/party/" /nologo /Fo"obj/party/" /Os /Fp"obj/party/intro.pch" main.compress.cpp
link /OUT:"bin/party/bf-detached_%1x%2.exe" "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" "obj/party/main.compress.obj" "4klang.obj" /ENTRY:"main" /SUBSYSTEM:WINDOWS /CRINKLER /COMPMODE:FAST /REPORT:report.html /RANGE:opengl32

58
uc16-4k/buildall.bat Normal file
View File

@@ -0,0 +1,58 @@
@echo off
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat"
mkdir bin\party
mkdir obj\party
REM 16:9
call build 1024 576
call build 1280 720
call build 1366 768
call build 1600 900
call build 1920 1080
call build 2048 1152
call build 2560 1440
call build 3200 1800
call build 3840 2160
call build 4096 2304
call build 7680 4320
call build 8192 4608
REM 16:10
call build 1024 640
call build 1152 720
call build 1280 800
call build 1440 900
call build 1680 1050
call build 1920 1200
call build 2048 1280
call build 2304 1440
call build 2560 1600
call build 2880 1800
call build 3840 2400
call build 5120 3200
call build 7680 4800
REM 4:3
call build 640 480
call build 800 600
call build 1024 768
call build 1152 864
call build 1280 960
call build 1400 1050
call build 1440 1080
call build 1600 1200
call build 1792 1344
call build 1856 1392
call build 1920 1440
call build 2560 1920
call build 2800 2100
call build 3200 2400
call build 4096 3072
call build 6400 4800
REM 5:4
call build 1280 1024
call build 1600 1280
call build 1800 1440
call build 2560 2048
call build 5120 4096

1
uc16-4k/do_minify.bat Normal file
View File

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

9
uc16-4k/generic.vs Normal file
View File

@@ -0,0 +1,9 @@
varying vec4 Y;
varying vec2 Z;
void main()
{
Y = gl_Color;
Z = (gl_Vertex.xy*vec2(1.6,1.0))*0.5+0.5;
gl_Position = gl_Vertex;
}

13146
uc16-4k/glext.h Normal file

File diff suppressed because it is too large Load Diff

364
uc16-4k/intro2k15.vcxproj Normal file
View File

@@ -0,0 +1,364 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.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="Compress (slow)|x64">
<Configuration>Compress (slow)</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Video|Win32">
<Configuration>Video</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Video|x64">
<Configuration>Video</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{DE5F7702-06F1-44F7-8823-87A60E4990BE}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>intro2k15</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Video|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Compress (slow)|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Video|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Compress (slow)|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Video|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</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 Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Video|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Compress (slow)|x64'" 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 Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)obj\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)obj\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)obj\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Video|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)obj\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)obj\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Compress (slow)|Win32'">
<LinkIncremental>false</LinkIncremental>
<ExecutablePath>$(SolutionDir);$(ExecutablePath)</ExecutablePath>
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)obj\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)obj\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Compress (slow)|x64'">
<LinkIncremental>false</LinkIncremental>
<ExecutablePath>$(SolutionDir);$(ExecutablePath)</ExecutablePath>
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)obj\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Gdi32.lib;user32.lib;opengl32.lib;winmm.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Gdi32.lib;user32.lib;opengl32.lib;winmm.lib;glu32.lib;vfw32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Gdi32.lib;user32.lib;opengl32.lib;winmm.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>/CRINKLER /COMPMODE:FAST /ORDERTRIES:400 /HASHTRIES:30 /UNSAFEIMPORT /TRUNCATEFLOATS:24 /HASHSIZE:200 /REPORT:report.html /RANGE:opengl32 /PROGRESSGUI /TRANSFORM:CALLS /UNALIGNCODE %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Video|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Gdi32.lib;user32.lib;opengl32.lib;winmm.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>/CRINKLER /COMPMODE:FAST /ORDERTRIES:400 /HASHTRIES:30 /UNSAFEIMPORT /TRUNCATEFLOATS:24 /HASHSIZE:200 /REPORT:report.html /RANGE:opengl32 /PROGRESSGUI /TRANSFORM:CALLS /UNALIGNCODE %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Gdi32.lib;user32.lib;opengl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Compress (slow)|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MinSpace</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DebugInformationFormat>None</DebugInformationFormat>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<WholeProgramOptimization>false</WholeProgramOptimization>
<ExceptionHandling>false</ExceptionHandling>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<AdditionalOptions>/CRINKLER /COMPMODE:FAST /ORDERTRIES:400 /HASHTRIES:30 /UNSAFEIMPORT /TRUNCATEFLOATS:24 /HASHSIZE:200 /REPORT:report.html /RANGE:opengl32 /PROGRESSGUI /TRANSFORM:CALLS /UNALIGNCODE %(AdditionalOptions)</AdditionalOptions>
<GenerateDebugInformation>No</GenerateDebugInformation>
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
<ProfileGuidedDatabase />
<EntryPointSymbol>main</EntryPointSymbol>
<AdditionalDependencies>winmm.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Gdi32.lib;user32.lib;opengl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>/CRINKLER /COMPMODE:FAST /ORDERTRIES:400 /HASHTRIES:30 /UNSAFEIMPORT /TRUNCATEFLOATS:24 /HASHSIZE:200 /REPORT:report.html /RANGE:opengl32 /PROGRESSGUI /TRANSFORM:CALLS /UNALIGNCODE %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Compress (slow)|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MinSpace</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DebugInformationFormat>None</DebugInformationFormat>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<WholeProgramOptimization>false</WholeProgramOptimization>
<ExceptionHandling>false</ExceptionHandling>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<AdditionalOptions>/CRINKLER /COMPMODE:FAST /ORDERTRIES:400 /HASHTRIES:30 /UNSAFEIMPORT /TRUNCATEFLOATS:24 /HASHSIZE:200 /REPORT:report.html /RANGE:opengl32 /PROGRESSGUI /TRANSFORM:CALLS /UNALIGNCODE %(AdditionalOptions)</AdditionalOptions>
<GenerateDebugInformation>No</GenerateDebugInformation>
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
<ProfileGuidedDatabase />
<EntryPointSymbol>main</EntryPointSymbol>
<AdditionalDependencies>winmm.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="4klang.h" />
<ClInclude Include="glext.h" />
<ClInclude Include="mark_small.h" />
<ClInclude Include="Shaders.h" />
<ClInclude Include="synth.h" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="4klang.asm">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">yasm-1.2.0-win32.exe -f win32 -o 4klang.obj 4klang.asm</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">yasm-1.2.0-win32.exe -f win32 -o 4klang.obj 4klang.asm</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">yasm-1.2.0-win32.exe -f win32 -o 4klang.obj 4klang.asm</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Compress (slow)|Win32'">yasm-1.2.0-win32.exe -f win32 -o 4klang.obj 4klang.asm</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">yasm-1.2.0-win32.exe -f win32 -o 4klang.obj 4klang.asm</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Video|x64'">yasm-1.2.0-win32.exe -f win32 -o 4klang.obj 4klang.asm</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">yasm-1.2.0-win32.exe -f win32 -o 4klang.obj 4klang.asm</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Compress (slow)|x64'">yasm-1.2.0-win32.exe -f win32 -o 4klang.obj 4klang.asm</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compiling 4klang...</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">Compiling 4klang...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4klang.obj</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">4klang.obj</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4klang.inc</AdditionalInputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">4klang.inc</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compiling 4klang...</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Compress (slow)|Win32'">Compiling 4klang...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4klang.obj</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Compress (slow)|Win32'">4klang.obj</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4klang.inc</AdditionalInputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Compress (slow)|Win32'">4klang.inc</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Compiling 4klang...</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Video|x64'">Compiling 4klang...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4klang.obj</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Video|x64'">4klang.obj</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4klang.inc</AdditionalInputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Video|x64'">4klang.inc</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Compiling 4klang...</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Compress (slow)|x64'">Compiling 4klang...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4klang.obj</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Compress (slow)|x64'">4klang.obj</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4klang.inc</AdditionalInputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Compress (slow)|x64'">4klang.inc</AdditionalInputs>
</CustomBuild>
<None Include="4klang.inc" />
<None Include="generic.vs" />
<None Include="mark.fs" />
</ItemGroup>
<ItemGroup>
<Object Include="4klang.obj" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="main_rel.cpp" />
<ClCompile Include="Shaders.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,57 @@
<?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;hh;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;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="4klang.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="glext.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="mark_small.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Shaders.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="synth.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="4klang.inc">
<Filter>Header Files</Filter>
</None>
<None Include="generic.vs" />
<None Include="mark.fs" />
</ItemGroup>
<ItemGroup>
<Object Include="4klang.obj" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Shaders.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="main_rel.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="4klang.asm">
<Filter>Source Files</Filter>
</CustomBuild>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>true</ShowAllFiles>
</PropertyGroup>
</Project>

BIN
uc16-4k/link.exe Normal file

Binary file not shown.

300
uc16-4k/main.compress.cpp Normal file
View File

@@ -0,0 +1,300 @@
// HACKS - Don't use unless you're really in desperate size problems
//------------------------------------------------------------------
//#define PFD_HACK
//#define WAVHDR_PREPARE_HACK
// FEATURES - Use whenever you can, at the expense of some size
//-------------------------------------------------------------
#define SHADER_WARMUP
#define START_BLACK
// INCLUDES
//---------
#define WIN32_LEAN_AND_MEAN
#define WIN32_EXTRA_LEAN
#include "synth.h"
#include <GL/gl.h>
#include "glext.h"
#include "mark_small.h"
// CONFIGURATION
//---------------
//#define WINDOWED
#ifndef SCREENWIDTH
#define SCREENWIDTH 1280
#endif
#ifndef SCREENHEIGHT
#define SCREENHEIGHT 720
#endif
#ifndef ASPECTOFFSET
#define ASPECTOFFSET ((float(SCREENWIDTH) / float(SCREENHEIGHT) - 1.0f) * 0.5f)
#endif
#define shaderCountOffset 14
#define ATOM_EDIT 0xC018
#define ATOM_STATIC 0xC019
#define SCENE_LENGTH (SAMPLES_PER_TICK * 128)
#pragma data_seg(".aspectOffset")
static const float gfAspectOffset = ASPECTOFFSET;
#pragma data_seg(".scebeLength")
static const int giSceneLength = SCENE_LENGTH;
#pragma data_seg(".Shader0")
#include "mark_small.h"
struct FAKEDEVMODE
{
BYTE _a[36];
DWORD dmSize;
DWORD dmFields;
struct
{
BYTE _b[4];
DWORD pfdFlags;
} pfd;
BYTE _c[56];
DWORD width;
DWORD height;
BYTE _d[8];
};
#pragma data_seg("fcw")
static WORD fcw = 0x0E7f;
#pragma data_seg(".devmode")
static FAKEDEVMODE devmode = {
"", sizeof(devmode), DM_PELSWIDTH | DM_PELSHEIGHT, "", PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL, "", SCREENWIDTH, SCREENHEIGHT, ""
};
#pragma data_seg(".fltused")
int _fltused = 1;
#pragma data_seg(".glCreateShaderProgramEXT")
static const char* sglCreateShaderProgramEXT = "glCreateShaderProgramEXT";
#pragma data_seg(".glUseProgram")
static const char* sglUseProgram = "glUseProgram";
#pragma data_seg(".glUniform4f")
static const char* sglUniform4f = "glUniform4f";
#pragma bss_seg(".mainbss")
static HDC hDC;
#pragma code_seg(".main")
void _cdecl main()
{
_asm
{
fldcw [fcw]
xor esi, esi
push esi
push esi
push esi
push esi
#ifndef WINDOWED
push esi
push esi
push esi
push esi
push WS_POPUP | WS_VISIBLE | WS_MAXIMIZE
push esi
push ATOM_STATIC
push esi
push CDS_FULLSCREEN
push offset devmode
push esi
push esi
push offset lpSoundBuffer
push _4klang_render
push esi
push esi
call CreateThread
call ChangeDisplaySettings
call CreateWindowExA
#else
push SCREENHEIGHT
push SCREENWIDTH
push esi
push esi
push WS_POPUP | WS_VISIBLE
push esi
push ATOM_STATIC
push esi
push esi
push esi
push offset lpSoundBuffer
push _4klang_render
push esi
push esi
call CreateThread
call CreateWindowExA
#endif
push eax
call GetDC
mov edi, eax
mov hDC, eax
push esi
#ifdef START_BLACK
push edi
#endif
push edi
#ifdef PFD_HACK
push esi
push 8
#else
push esi
push offset devmode.pfd
push edi
call ChoosePixelFormat
push eax
#endif
push edi
call SetPixelFormat
call wglCreateContext
push eax
push edi
call wglMakeCurrent
#ifdef START_BLACK
call SwapBuffers
#endif
call ShowCursor
xor ebx, ebx
shaderwarmup :
#ifdef SHADER_WARMUP
push 1
push 1
push -1
push -1
#endif
push offset mark_fs_0
push GL_FRAGMENT_SHADER
push sglCreateShaderProgramEXT
call wglGetProcAddress
call eax
#ifdef SHADER_WARMUP
push eax
push sglUseProgram
call wglGetProcAddress
call eax
#endif
inc byte ptr[mark_fs_0 + shaderCountOffset]
cmp ebx, 9
jnz skip
mov byte ptr[mark_fs_0 + shaderCountOffset], 'A'
skip:
#ifdef SHADER_WARMUP
push esi
push gfAspectOffset
push dword ptr[devmode.height]
fild dword ptr[esp]
fstp dword ptr[esp]
push ebx
fild dword ptr[esp]
fstp dword ptr[esp]
push esi
push sglUniform4f
call wglGetProcAddress
call eax
call glRecti
#endif
inc ebx
cmp ebx, 12
jnz shaderwarmup
#ifndef WAVHDR_PREPARE_HACK
push 0x20
push offset WaveHDR
#endif
push 0x20
push offset WaveHDR
push esi
push esi
push esi
push offset WaveFMT
push -1
push offset hWaveOut
call waveOutOpen
#ifndef WAVHDR_PREPARE_HACK
push[hWaveOut]
call waveOutPrepareHeader
#endif
push [hWaveOut]
call waveOutWrite
mainloop:
push 0xC
push offset MMTime
push [hWaveOut]
call waveOutGetPosition
push esi
push esi
push esi
push esi
push esi
push edi
push 1
push 1
push -1
push -1
push esi
mov eax, dword ptr[MMTime + 4]
shr eax, 3
and eax, 1FFFFFE0h
movss xmm0, dword ptr _4klang_envelope_buffer + 14h[eax * 4]
addss xmm0, dword ptr _4klang_envelope_buffer + 10h[eax * 4]
movss dword ptr[esp], xmm0
push gfAspectOffset
push dword ptr[devmode.height]
fild dword ptr[esp]
fstp dword ptr[esp]
push dword ptr[MMTime.u.sample]
fild dword ptr[esp]
fild giSceneLength
fdiv
fst dword ptr[esp]
push esi
push esi
fistp dword ptr[esp]
pop eax
inc eax
push eax
push sglUseProgram
call wglGetProcAddress
call eax
push sglUniform4f
call wglGetProcAddress
call eax
call glRecti
call SwapBuffers
call PeekMessage
cmp dword ptr [MMTime+4], MAX_SAMPLES
jae exit
push VK_ESCAPE
call GetAsyncKeyState
test ax,ax
je mainloop
exit:
push esi
call ExitProcess
}
}

227
uc16-4k/main.cpp Normal file
View File

@@ -0,0 +1,227 @@
//#define NOMUSICTIMING
#define MULTISHADER
#include <time.h>
#include <io.h>
#include <process.h>
#include "Shaders.h"
#include "synth.h"
#include "4klang.h"
#define HALF_FAC 2
static const int gi_ScreenWidth = 1280/HALF_FAC;
static const int gi_ScreenHeight = 720/HALF_FAC;
static const char* glUniform4f = "glUniform4f";
HANDLE gh_ShaderCompileEvent;
static char** gs_LastShader_;
static __time64_t gi_ShaderChangedDate;
static unsigned int gi_ShaderProgram;
static unsigned int gi_LastShaderProgram;
static const char* gs_ShaderFile = "mark.fs";
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
};
static DEVMODE dmScreenSettings={
0,0,0,sizeof(dmScreenSettings),0,DM_PELSWIDTH|DM_PELSHEIGHT,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,gi_ScreenWidth,gi_ScreenHeight
};
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;
}
bool g_bForceCompile= true;
LRESULT MessageCallback(HWND ar_Handle, UINT aw_Message, WPARAM aw_Param, LPARAM al_Param)
{
return DefWindowProc(ar_Handle, aw_Message, aw_Param, al_Param);
}
int gCurScene= 0;
int gCurSceneStart= 0;
/*int g_SceneLength[]=
{
16, 16, 16,
16, 16, 16,
16, 32, 16,
16, 16, 16,
0x80000000
};
int g_SceneShader[]=
{
0,0,0,
1,1,1,
2,2,2,
3,3,3,
};
float g_SceneFactor[]=
{
0, 0, 0,
0, 0, 1.0f,
0, 0, 1.0f,
0, 1.0f, 1.0f,
0,
};*/
void _cdecl main()
{
//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 );
LARGE_INTEGER li_OldTime = { 0 };
#ifdef NOMUSICTIMING
int iStartTick= timeGetTime();
#endif
float lf_Time= 0.0f;
do
{
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 = createFragmentProgram(gs_ShaderFile, g_ShaderID, g_ShaderDebug);
PrintErrors();
g_bForceCompile= false;
}
get_Sample();
int Sample= MMTime.u.sample - gCurSceneStart;
int SceneEnd = 8 * SAMPLES_PER_TICK * 8;//samples per tick
#ifdef NOMUSICTIMING
lf_Time = ( timeGetTime() - iStartTick ) * 0.001f / 16.0f;
#endif
glLoadIdentity();
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;
if (g_fSqrAnimFac < 0.0)
{
g_SceneID = (g_SceneID + 1) % 16;
}
}
if( lf_Time < 0.0f )
{
lf_Time = 0.0f;
}
if (g_fSqrAnimFac == 0)
{
lf_Time = 0.0f;
}
((PFNGLUSEPROGRAMPROC)wglGetProcAddress("glUseProgram"))(gi_ShaderProgram);
((PFNGLUNIFORM4FPROC)wglGetProcAddress(glUniform4f))(0, (float)g_SceneID + lf_Time, (GLfloat)gi_ScreenHeight, (GLfloat)0.375f, 0.0f);
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);
glRects(-1, -1, 1, 1);
SwapBuffers(hDC);
}
while ( !GetAsyncKeyState(VK_ESCAPE) );
ExitProcess(0);
}

218
uc16-4k/main.video.cpp Normal file
View File

@@ -0,0 +1,218 @@
// INCLUDES
//---------
#define WIN32_LEAN_AND_MEAN
#define WIN32_EXTRA_LEAN
#include "synth.h"
#include <GL/gl.h>
#include "glext.h"
#include "mark_small.h"
#include <vfw.h>
// CONFIG
//-------
#define FPS 60
#define MOTION_BLUR 2
#define SCREENWIDTH 1920
#define SCREENHEIGHT 1080
#define ASPECTOFFSET ((float(SCREENWIDTH) / float(SCREENHEIGHT) - 1.0f) * 0.5f)
typedef struct
{
PAVISTREAM m_ps;
PAVISTREAM m_psCompressed;
PAVISTREAM m_psAudio;
AVISTREAMINFO m_strhdr;
AVICOMPRESSOPTIONS m_opts;
PAVIFILE m_pfile;
BITMAPINFOHEADER m_alpbi;
} AVIWRITER;
static AVIWRITER avi;
static int frame = 0;
static GLushort tempBuffer[3 * SCREENWIDTH * SCREENHEIGHT];
static GLubyte data[3 * SCREENWIDTH * SCREENHEIGHT];
struct FAKEPFD
{
WORD nSize;
WORD nVersion;
DWORD dwFlags;
// Snip
};
struct FAKEDEVMODE
{
BYTE dmDeviceName[CCHDEVICENAME];
WORD dmSpecVersion;
WORD dmDriverVersion;
WORD dmSize;
WORD dmDriverExtra;
DWORD dmFields;
union {
/* printer only fields */
struct {
short dmOrientation;
short dmPaperSize;
short dmPaperLength;
short dmPaperWidth;
short dmScale;
short dmCopies;
short dmDefaultSource;
short dmPrintQuality;
};
FAKEPFD pfd;
};
short dmColor;
short dmDuplex;
short dmYResolution;
short dmTTOption;
short dmCollate;
BYTE dmFormName[CCHFORMNAME];
WORD dmLogPixels;
DWORD dmBitsPerPel;
DWORD dmPelsWidth;
DWORD dmPelsHeight;
union {
DWORD dmDisplayFlags;
DWORD dmNup;
};
DWORD dmDisplayFrequency;
};
static PFNGLCREATESHADERPROGRAMEXTPROC glCreateShaderProgramEXT;
static PFNGLUSEPROGRAMPROC glUseProgram;
static PFNGLUNIFORM4FPROC glUniform4f;
static FAKEDEVMODE devmode = {
"", 0, 0, sizeof(devmode), 0, DM_PELSWIDTH | DM_PELSHEIGHT, 0, 0, PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", 0, 0, SCREENWIDTH, SCREENHEIGHT, 0, 0
};
static const char* sglCreateShaderProgramEXT = "glCreateShaderProgramEXT";
static const char* sglUseProgram = "glUseProgram";
static const char* sglUniform4f = "glUniform4f";
#define shaderCountOffset 14
#define ATOM_EDIT 0xC018
#define ATOM_STATIC 0xC019
#define SCENE_LENGTH (SAMPLES_PER_TICK * 128)
void _cdecl main()
{
InitSound();
HWND hWnd = CreateWindowExA(0, (LPCSTR)ATOM_STATIC, 0, WS_VISIBLE | WS_SYSMENU, 0, 0, SCREENWIDTH, SCREENHEIGHT, 0, 0, 0, 0);
HDC hDC = GetDC(hWnd);
//SetPixelFormat(hDC, ChoosePixelFormat(hDC, (const PIXELFORMATDESCRIPTOR*)&devmode.pfd), 0);
// if size is a problem, try this:
SetPixelFormat(hDC, 8, 0);
wglMakeCurrent(hDC, wglCreateContext(hDC));
glCreateShaderProgramEXT = (PFNGLCREATESHADERPROGRAMEXTPROC)wglGetProcAddress(sglCreateShaderProgramEXT);
glUseProgram = (PFNGLUSEPROGRAMPROC)wglGetProcAddress(sglUseProgram);
glUniform4f = (PFNGLUNIFORM4FPROC)wglGetProcAddress(sglUniform4f);
for (int i = 0; i < 12; ++i)
{
glUseProgram(glCreateShaderProgramEXT(GL_FRAGMENT_SHADER, mark_fs_0));
mark_fs_0[shaderCountOffset]++;
if (i == 9)
{
mark_fs_0[shaderCountOffset] = 'A';
}
glUniform4f(0, i, SCREENHEIGHT, ASPECTOFFSET, 0.0f);
glRecti(-1, -1, 1, 1);
}
AVIFileInit();
AVIFileOpen(&avi.m_pfile, "intro.avi", OF_WRITE | OF_CREATE, NULL);
memset(&avi.m_strhdr, 0, sizeof(avi.m_strhdr));
avi.m_strhdr.fccType = streamtypeVIDEO;
avi.m_strhdr.fccHandler = 0;
avi.m_strhdr.dwScale = 1;
avi.m_strhdr.dwRate = FPS;
avi.m_strhdr.dwSuggestedBufferSize = 0;// 3 * SCREENWIDTH * SCREENHEIGHT;
SetRect(&avi.m_strhdr.rcFrame, 0, 0, SCREENWIDTH, SCREENHEIGHT);
AVIFileCreateStream(avi.m_pfile, &avi.m_ps, &avi.m_strhdr);
memset(&avi.m_strhdr, 0, sizeof(avi.m_strhdr));
avi.m_strhdr.fccType = streamtypeAUDIO;
avi.m_strhdr.dwScale = WaveFMT.nBlockAlign;
avi.m_strhdr.dwRate = WaveFMT.nSamplesPerSec * WaveFMT.nBlockAlign;
avi.m_strhdr.dwSampleSize = WaveFMT.nBlockAlign;
avi.m_strhdr.dwQuality = (DWORD)-1;
SetRect(&avi.m_strhdr.rcFrame, 0, 0, SCREENWIDTH, SCREENHEIGHT);
AVIFileCreateStream(avi.m_pfile, &avi.m_psAudio, &avi.m_strhdr);
AVIStreamSetFormat(avi.m_psAudio, 0, &WaveFMT, sizeof(WAVEFORMATEX));
auto ops = &avi.m_opts;
if (AVISaveOptions(hWnd, 0, 1, &avi.m_ps, &ops) == FALSE)
{
ExitProcess(0);
}
AVIMakeCompressedStream(&avi.m_psCompressed, avi.m_ps, &avi.m_opts, NULL);
memset(&avi.m_alpbi, 0, sizeof(avi.m_alpbi));
avi.m_alpbi.biSize = sizeof(avi.m_alpbi);
avi.m_alpbi.biWidth = SCREENWIDTH;
avi.m_alpbi.biHeight = SCREENHEIGHT;
avi.m_alpbi.biPlanes = 1;
avi.m_alpbi.biBitCount = 24;
avi.m_alpbi.biCompression = BI_RGB;
AVIStreamSetFormat(avi.m_psCompressed, 0, &avi.m_alpbi, sizeof(avi.m_alpbi));
int sample = 0;
do
{
sample = ((float)frame / (float)(FPS * MOTION_BLUR)) * SAMPLE_RATE;
float fTime = (float)sample / SCENE_LENGTH;
glUseProgram((int)fTime + 1);
int i = ((sample >> 8) << 5) + 2 * 2;
float* a = &_4klang_envelope_buffer;
float aha = a[i] + a[i + 1];
glUniform4f(0, fTime, SCREENHEIGHT, ASPECTOFFSET, aha);
glRecti(-1, -1, 1, 1);
SwapBuffers(hDC);
::PeekMessage(0, 0, 0, 0, 0);
glReadPixels(0, 0, SCREENWIDTH, SCREENHEIGHT, GL_BGR_EXT, GL_UNSIGNED_BYTE, data);
for (int i = 0; i < SCREENWIDTH * SCREENHEIGHT * 3; ++i)
{
tempBuffer[i] += data[i];
}
if ((frame++ % MOTION_BLUR) == 0)
{
for (int i = 0; i < SCREENWIDTH * SCREENHEIGHT * 3; ++i)
{
data[i] = (tempBuffer[i] / MOTION_BLUR);
tempBuffer[i] = 0;
}
AVIStreamWrite(avi.m_psCompressed, (frame - 1) / MOTION_BLUR, 1, data, 3 * SCREENWIDTH * SCREENHEIGHT, AVIIF_KEYFRAME, NULL, NULL);
}
} while (sample < MAX_SAMPLES && !GetAsyncKeyState(VK_ESCAPE));
auto const extraSamples = 0;// SOUND_TICKS_PER_SCENE * SAMPLES_PER_TICK / 4;
static SAMPLE_TYPE audioBuffer[2 * (MAX_SAMPLES + extraSamples)];
memcpy(audioBuffer + extraSamples * 2, WaveHDR.lpData, WaveHDR.dwBufferLength);
AVIStreamWrite(avi.m_psAudio, 0, MAX_SAMPLES + extraSamples, audioBuffer, WaveHDR.dwBufferLength + extraSamples * sizeof(SAMPLE_TYPE) * 2, 0, NULL, NULL);
AVIStreamClose(avi.m_ps);
AVIStreamClose(avi.m_psCompressed);
AVIStreamClose(avi.m_psAudio);
AVIFileClose(avi.m_pfile);
AVIFileExit();
}

228
uc16-4k/main_rel.cpp Normal file
View File

@@ -0,0 +1,228 @@
#define WIN32_LEAN_AND_MEAN
#define WIN32_EXTRA_LEAN
#include "synth.h"
#include <GL/gl.h>
#include "glext.h"
#ifdef _DEBUG
#include <io.h>
#include <process.h>
#include "Shaders.h"
HANDLE gh_ShaderCompileEvent;
static char** gs_LastShader_;
static __time64_t gi_ShaderChangedDate;
static unsigned int gi_ShaderProgram;
static unsigned int gi_LastShaderProgram;
static const char* gs_ShaderFile = "mark.fs";
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;
}
#else
#pragma data_seg(".Shader0")
#include "mark_small.h"
#endif
#ifndef SCREENWIDTH
#define SCREENWIDTH 1280
#endif
#ifndef SCREENHEIGHT
#define SCREENHEIGHT 720
#endif
#ifndef ASPECTOFFSET
#define ASPECTOFFSET ((float(SCREENWIDTH) / float(SCREENHEIGHT) - 1.0f) * 0.5f)
#endif
#define WINDOWED
struct FAKEPFD
{
WORD nSize;
WORD nVersion;
DWORD dwFlags;
// Snip
};
struct FAKEDEVMODE
{
BYTE dmDeviceName[CCHDEVICENAME];
WORD dmSpecVersion;
WORD dmDriverVersion;
WORD dmSize;
WORD dmDriverExtra;
DWORD dmFields;
union {
/* printer only fields */
struct {
short dmOrientation;
short dmPaperSize;
short dmPaperLength;
short dmPaperWidth;
short dmScale;
short dmCopies;
short dmDefaultSource;
short dmPrintQuality;
};
FAKEPFD pfd;
};
short dmColor;
short dmDuplex;
short dmYResolution;
short dmTTOption;
short dmCollate;
BYTE dmFormName[CCHFORMNAME];
WORD dmLogPixels;
DWORD dmBitsPerPel;
DWORD dmPelsWidth;
DWORD dmPelsHeight;
union {
DWORD dmDisplayFlags;
DWORD dmNup;
};
DWORD dmDisplayFrequency;
};
#pragma bss_seg(".mainbss")
static PFNGLCREATESHADERPROGRAMEXTPROC glCreateShaderProgramEXT;
static PFNGLUSEPROGRAMPROC glUseProgram;
static PFNGLUNIFORM4FPROC glUniform4f;
#pragma data_seg(".devmode")
static FAKEDEVMODE devmode = {
"", 0, 0, sizeof(devmode), 0, DM_PELSWIDTH | DM_PELSHEIGHT, 0, 0, PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", 0, 0, SCREENWIDTH, SCREENHEIGHT, 0, 0
};
#pragma data_seg(".fltused")
int _fltused = 1;
#pragma data_seg(".glCreateShaderProgramEXT")
static const char* sglCreateShaderProgramEXT = "glCreateShaderProgramEXT";
#pragma data_seg(".glUseProgram")
static const char* sglUseProgram = "glUseProgram";
#pragma data_seg(".glUniform4f")
static const char* sglUniform4f = "glUniform4f";
#define shaderCountOffset 14
#define ATOM_EDIT 0xC018
#define ATOM_STATIC 0xC019
#define SCENE_LENGTH (SAMPLES_PER_TICK * 128)
#pragma code_seg(".main")
void _cdecl main()
{
InitSound();
#ifdef _DEBUG
HDC hDC = GetDC(CreateWindowExA(0, (LPCSTR)ATOM_EDIT, 0, WS_OVERLAPPEDWINDOW | WS_SYSMENU | WS_VISIBLE, 0, 0, SCREENWIDTH, SCREENHEIGHT, 0, 0, 0, 0));
gh_ShaderCompileEvent = ::CreateEvent(NULL, FALSE, FALSE, TEXT("WriteEvent"));
SetThreadPriority((HANDLE)CreateThread(0, 0, &filemon, 0, 0, 0), THREAD_PRIORITY_BELOW_NORMAL);
#else
#ifndef WINDOWED
ChangeDisplaySettings((DEVMODEA*)&devmode, CDS_FULLSCREEN);
HDC hDC = GetDC(CreateWindowExA(0, (LPCSTR)ATOM_STATIC, 0, WS_POPUP | WS_VISIBLE | WS_MAXIMIZE, 0, 0, 0, 0, 0, 0, 0, 0));
#else
HDC hDC = GetDC(CreateWindowExA(0, (LPCSTR)ATOM_STATIC, 0, WS_VISIBLE | WS_SYSMENU, 0, 0, SCREENWIDTH, SCREENHEIGHT, 0, 0, 0, 0));
#endif
#endif
SetPixelFormat(hDC, ChoosePixelFormat(hDC, (const PIXELFORMATDESCRIPTOR*)&devmode.pfd), 0);
// if size is a problem, try this:
//SetPixelFormat(hDC, 8, 0);
wglMakeCurrent(hDC, wglCreateContext(hDC));
#ifdef _DEBUG
initShaders();
#endif
glCreateShaderProgramEXT = (PFNGLCREATESHADERPROGRAMEXTPROC)wglGetProcAddress(sglCreateShaderProgramEXT);
glUseProgram = (PFNGLUSEPROGRAMPROC)wglGetProcAddress(sglUseProgram);
glUniform4f = (PFNGLUNIFORM4FPROC)wglGetProcAddress(sglUniform4f);
#ifndef _DEBUG
for (int i = 0; i < 12; ++i)
{
glUseProgram(glCreateShaderProgramEXT(GL_FRAGMENT_SHADER, mark_fs_0));
mark_fs_0[shaderCountOffset]++;
if (i == 9)
{
mark_fs_0[shaderCountOffset] = 'A';
}
glUniform4f(0, i, SCREENHEIGHT, ASPECTOFFSET, 0.0f);
glRecti(-1, -1, 1, 1);
}
ShowCursor(FALSE);
#endif
PlaySound();
do
{
get_Sample();
float fTime = (float)MMTime.u.sample / SCENE_LENGTH;
#ifdef _DEBUG
if (::WaitForSingleObject(gh_ShaderCompileEvent, 0) == WAIT_OBJECT_0)
{
::Sleep(50);
glUseProgram(createFragmentProgram(gs_ShaderFile));
PrintErrors();
}
#else
glUseProgram((int)fTime + 1);
#endif
int i = ((MMTime.u.sample >> 8) << 5) + 2 * 2;
glUniform4f(0, fTime, SCREENHEIGHT, ASPECTOFFSET, 0);
glRecti(-1, -1, 1, 1);
SwapBuffers(hDC);
#ifdef _DEBUG
MSG msg;
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT)
return;
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
#else
::PeekMessage(0, 0, 0, 0, 0);
#endif
} while
#ifdef _DEBUG
(true);
#else
(MMTime.u.sample < MAX_SAMPLES && !GetAsyncKeyState(VK_ESCAPE));
#endif
ExitProcess(0);
}

139
uc16-4k/mark.fs Normal file
View File

@@ -0,0 +1,139 @@
#version 120
// Parameters from our host
// x: Scene+Zeit
// y: Hoehe
// z: Aspec
uniform vec4 Y;
vec3 L;
#define saturate(x) clamp(x, 0, 1)
// Maximum/minumum elements of a vector
float vmax(vec2 v) {
return max(v.x, v.y);
}
float vmax(vec3 v) {
return max(max(v.x, v.y), v.z);
}
float vmax(vec4 v) {
return max(max(v.x, v.y), max(v.z, v.w));
}
float vmin(vec2 v) {
return min(v.x, v.y);
}
float vmin(vec3 v) {
return min(min(v.x, v.y), v.z);
}
float vmin(vec4 v) {
return min(min(v.x, v.y), min(v.z, v.w));
}
void pR(inout vec2 p, float a) {
p = cos(a)*p + sin(a)*vec2(p.y, -p.x);
}
float fSphere(vec3 p, float r) {
return length(p) - r;
}
// Plane with normal n (n is normalized) at some distance from the origin
float fPlane(vec3 p, vec3 n, float distanceFromOrigin) {
return dot(p, n) + distanceFromOrigin;
}
// Cheap Box: distance to corners is overestimated
float fBoxCheap(vec3 p, vec3 b) { //cheap box
return vmax(abs(p) - b);
}
// Box: correct distance to corners
float fBox(vec3 p, vec3 b) {
vec3 d = abs(p) - b;
return length(max(d, vec3(0))) + vmax(min(d, vec3(0)));
}
// Same as above, but in two dimensions (an endless box)
float fBox2Cheap(vec2 p, vec2 b) {
return vmax(abs(p)-b);
}
float fBox2(vec2 p, vec2 b) {
vec2 d = abs(p) - b;
return length(max(d, vec2(0))) + vmax(min(d, vec2(0)));
}
vec4 mcol = vec4(0);
float DE(in vec3 z0){
float r = sqrt(2.0) * 0.5;
mcol = vec4(0.8, 0.8, 0.8, 0.7);
float d1 = fSphere(z0 + vec3( 0.5, -0.5, 0.5), r);
float d2 = fSphere(z0 + vec3( 0.5, 0.5, -0.5), r);
float d3 = fSphere(z0 + vec3(-0.5, 0.5, 0.5), r);
float d4 = fSphere(z0 + vec3(-0.5, -0.5, -0.5), r);
return min(min(min(d1, d2), d3), d4);
}
float linstep(float a, float b, float t){float v=(t-a)/(b-a);return clamp(v,0.,1.);}//from knighty
float rand(vec2 co){// implementation found at: lumina.sourceforge.net/Tutorials/Noise.html
return fract(sin(dot(co*0.123,vec2(12.9898,78.233))) * 43758.5453);
}
float FuzzyShadow(vec3 ro, vec3 rd, float coneGrad, vec2 fragCoord){
float t=0.0,d=1.0,s=1.0;
ro+=rd*0.01;
for(int i=0;i<16;i++){
//if(s<0.1)continue;//uncommenting this makes shadows and reflections disappear - WTF?
float r=t*coneGrad;//radius of cone
d=DE(ro+rd*t)+r*0.5;
s*=linstep(-r,r,d);
t+=abs(d)*(0.5+0.5*rand(fragCoord.xy*vec2(i)))+0.005;
}
return clamp(s*0.8+0.2,0.0,1.0);
}
vec3 Background(vec3 rd){return vec3(0.2)*(0.3+0.7*pow(max(0.0,dot(rd,L)),2.0));}
void main() {
vec3 ro=vec3(0.5,0.7,-0.5)*(0.19+Y.x*0.1) + vec3(-0.2, -0.2, 0.2);
vec3 rd = vec3((gl_FragCoord.xy / Y.y - 0.5), 1.0);
rd = normalize(vec3(rd.x - Y.z, rd.y, rd.z));
pR(rd.xy,Y.x);
pR(rd.yz,-0.717);
pR(rd.xz,-0.717);
L=normalize(vec3(0.5,0.5,-0.5));
vec3 col=Background(rd);
float refl = 1.0;
for (int r = 0; r < 12; ++r)
{
float t=0.0002,d=1.0;
for(int i=0;i<48;i++){
if(t>10.0 || d<0.0001) break;
t+=d=DE(ro+rd*t);
}
if(d>0.02)
break;
ro+=rd*t;
mcol=vec4(0.0);
const vec2 v=vec2(0.001,0.0);
vec3 N=normalize(vec3(-DE(ro-v.xyy)+DE(ro+v.xyy),-DE(ro-v.yxy)+DE(ro+v.yxy),-DE(ro-v.yyx)+DE(ro+v.yyx)));
rd=reflect(rd,N);
refl*=mcol.w;
vec3 scol=mcol.rgb*saturate(dot(N,L));
scol += 4*pow(saturate(dot(rd,normalize(N+L))), 128);
float shadowConeGrad = 0.15;
scol*=refl*FuzzyShadow(ro,L,shadowConeGrad,gl_FragCoord.xy);//the cone grad could be calculated for each lights position
col=mix(scol,col,refl);
}
col=pow(col,vec3(1.0/2.2));
gl_FragColor = vec4(saturate(col),1.0);
}

165
uc16-4k/mark.fs_0 Normal file
View File

@@ -0,0 +1,165 @@
#version 120
// Parameters from our host
// x: Scene+Zeit
// y: Hoehe
// z: Aspec
uniform vec4 Y;
vec3 L;
mat2 RMat2(float a){return mat2(cos(a),sin(a),-sin(a),cos(a));}
mat2 rmx,rmx1,rmx2;
float HTorus(in vec3 z){
return max(-z.y,max(abs(length(max(abs(z.xy)-0.5,0.0))-0.5),abs(z.z))-0.2);
}
const vec4 scale=vec4(1.385,-1.385,1.385,1.385);
float DE(in vec3 z0){
z0.xz=z0.xz*rmx;
vec4 z=vec4(z0,1.0);
z.zy*=rmx1;
float d=max(abs(z.y+1.0)-1.0,length(z.xz)-0.2);
for(int i=0;i<4;i++){
z.xz=abs(z.zx);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
}
z.xz=z.zx;
float s=sign(z.x);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.xz=z.xz*rmx2*s;
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.y-=0.6;
d=min(d,min(length(max(abs(z.xyz)-vec3(0.0,0.5,0.55),0.0))-0.25,
length(max(abs(z.xyz+vec3(0.9,0.6,0.0))-vec3(0.4,-0.1,0.5),0.0))-0.4)/z.w);
return min(d,z0.y+1.5);
}
vec4 mcol;
float CE(in vec3 z0){
vec4 z=vec4(z0,1.0);
z.xz=z.xz*rmx;
z.zy*=rmx1;
float d=max(abs(z.y+1.0)-1.0,length(z.xz)-0.2);
for(int i=0;i<4;i++){
z.xz=abs(z.zx);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
}
z.xz=z.zx;
float s=sign(z.x);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.xz=z.xz*rmx2*s;
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.y-=0.6;
float d2=min(length(max(abs(z.xyz)-vec3(0.0,0.5,0.55),0.0))-0.25,
length(max(abs(z.xyz+vec3(0.9,0.6,0.0))-vec3(0.4,-0.1,0.5),0.0))-0.4)/z.w;
float d3=z0.y+1.5;
d=min(d,min(d2,d3));
if(abs(d2-d)<0.001)mcol+=vec4(1.0,0.1,0.0,0.2);
else if(abs(d3-d)<0.001){
mcol+=vec4(0.25,0.25,0.2,0.333);
d+=sin(-Y.x*100.0+100.0*pow(length(z0.xz),0.17))*0.01;
}else mcol+=vec4(0.0,0.5,0.5,0.5);
return d;
}
float linstep(float a, float b, float t){float v=(t-a)/(b-a);return clamp(v,0.,1.);}//from knighty
float rand(vec2 co){// implementation found at: lumina.sourceforge.net/Tutorials/Noise.html
return fract(sin(dot(co*0.123,vec2(12.9898,78.233))) * 43758.5453);
}
float FuzzyShadow(vec3 ro, vec3 rd, float coneGrad, vec2 fragCoord){
float t=0.0,d=1.0,s=1.0;
ro+=rd*0.01;
for(int i=0;i<32;i++){
//if(s<0.1)continue;//uncommenting this makes shadows and reflections disappear - WTF?
float r=t*coneGrad;//radius of cone
d=DE(ro+rd*t)+r*0.5;
s*=linstep(-r,r,d);
t+=abs(d)*(0.5+0.5*rand(fragCoord.xy*vec2(i)))+0.005;
}
return clamp(s*0.8+0.2,0.0,1.0);
}
vec3 Background(vec3 rd){return vec3(0.8,0.9,1.0)*(0.3+0.7*pow(max(0.0,dot(rd,L)),2.0));}
vec3 FuzzyReflection(vec3 ro, vec3 rd, float coneGrad, vec2 fragCoord){
float t=0.0,d=1.0;
ro+=rd*0.01;
vec4 col=vec4(0.0);
for(int i=0;i<24;i++){
if(col.w>0.9)continue;
float r=t*coneGrad;//radius of cone
d=DE(ro+rd*t)+r*0.5;
if(d<r){
vec3 p=ro+rd*t;
mcol=vec4(0.0);
vec2 v=vec2(r,0.0);//use normal deltas based on CoC radius
vec3 N=normalize(vec3(-CE(p-v.xyy)+CE(p+v.xyy),-CE(p-v.yxy)+CE(p+v.yxy),-CE(p-v.yyx)+CE(p+v.yyx)));
vec3 scol=mcol.rgb*0.1666*max(0.1,0.25+dot(N,L)*0.75);//do some fast light calcs (you can forget about shadow casting, too expensive)
float alpha=(1.0-col.w)* linstep(-r,r,-d);//calculate the mix like cloud density
col+=vec4(scol*alpha,alpha);//blend in the new color
}
t+=abs(d)*(0.5+0.5*rand(fragCoord.xy*vec2(i)))+0.005;
}
return col.rgb+Background(rd)*(1.0-clamp(col.w,0.0,1.0));
}
mat3 lookat(vec3 fw,vec3 up){
fw=normalize(fw);vec3 rt=normalize(cross(fw,normalize(up)));return mat3(rt,cross(rt,fw),fw);
}
void main() {
gl_FragColor = vec4(1);
return;
vec3 ro=vec3(-2.25,1.5+sin(Y.x*0.9),-4);
vec3 rd = vec3((gl_FragCoord.xy / Y.y - 0.5), 0.8);
rd.x -= Y.z;
L=normalize(vec3(0.5,0.5,-0.5));
rmx=RMat2(Y.x);
rmx1=RMat2(0.09);
rmx2=RMat2(Y.x*10.0);
vec3 col=Background(rd);
float t=0.0,d=1.0;
for(int i=0;i<64;i++){
if(t>10.0 || d<0.005) continue;
t+=d=DE(ro+rd*t);
}
if(d>=0.1 && rd.y<0.0){//fix the ground
t=-(ro.y+1.5)/rd.y;
d=0.0;
}
if(d<0.1){//close enough for a hit
ro+=rd*t;
mcol=vec4(0.0);
const vec2 v=vec2(0.001,0.0);
vec3 N=normalize(vec3(-CE(ro-v.xyy)+CE(ro+v.xyy),-CE(ro-v.yxy)+CE(ro+v.yxy),-CE(ro-v.yyx)+CE(ro+v.yyx)));
mcol*=0.1666;
float refl=mcol.w;
vec3 scol=mcol.rgb*max(0.1,0.25+dot(N,L)*0.75);
float shadowConeGrad = 0.15;
scol*=FuzzyShadow(ro,L,shadowConeGrad,gl_FragCoord.xy);//the cone grad could be calculated for each lights position
float reflectionConeGrad = 0.09;
scol+=refl*FuzzyReflection(ro,reflect(rd,N),reflectionConeGrad,gl_FragCoord.xy);//each material could have a separate cone
col=mix(scol,col,clamp(t*0.05,0.0,1.0));
}
col*=1.25;
gl_FragColor = vec4(clamp(col,0.0,1.0),1.0);
}

165
uc16-4k/mark.fs_0_dbg Normal file
View File

@@ -0,0 +1,165 @@
#version 120
// Parameters from our host
// x: Scene+Zeit
// y: Hoehe
// z: Aspec
uniform vec4 Y;
vec3 L;
mat2 RMat2(float a){return mat2(cos(a),sin(a),-sin(a),cos(a));}
mat2 rmx,rmx1,rmx2;
float HTorus(in vec3 z){
return max(-z.y,max(abs(length(max(abs(z.xy)-0.5,0.0))-0.5),abs(z.z))-0.2);
}
const vec4 scale=vec4(1.385,-1.385,1.385,1.385);
float DE(in vec3 z0){
z0.xz=z0.xz*rmx;
vec4 z=vec4(z0,1.0);
z.zy*=rmx1;
float d=max(abs(z.y+1.0)-1.0,length(z.xz)-0.2);
for(int i=0;i<4;i++){
z.xz=abs(z.zx);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
}
z.xz=z.zx;
float s=sign(z.x);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.xz=z.xz*rmx2*s;
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.y-=0.6;
d=min(d,min(length(max(abs(z.xyz)-vec3(0.0,0.5,0.55),0.0))-0.25,
length(max(abs(z.xyz+vec3(0.9,0.6,0.0))-vec3(0.4,-0.1,0.5),0.0))-0.4)/z.w);
return min(d,z0.y+1.5);
}
vec4 mcol;
float CE(in vec3 z0){
vec4 z=vec4(z0,1.0);
z.xz=z.xz*rmx;
z.zy*=rmx1;
float d=max(abs(z.y+1.0)-1.0,length(z.xz)-0.2);
for(int i=0;i<4;i++){
z.xz=abs(z.zx);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
}
z.xz=z.zx;
float s=sign(z.x);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.xz=z.xz*rmx2*s;
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.y-=0.6;
float d2=min(length(max(abs(z.xyz)-vec3(0.0,0.5,0.55),0.0))-0.25,
length(max(abs(z.xyz+vec3(0.9,0.6,0.0))-vec3(0.4,-0.1,0.5),0.0))-0.4)/z.w;
float d3=z0.y+1.5;
d=min(d,min(d2,d3));
if(abs(d2-d)<0.001)mcol+=vec4(1.0,0.1,0.0,0.2);
else if(abs(d3-d)<0.001){
mcol+=vec4(0.25,0.25,0.2,0.333);
d+=sin(-Y.x*100.0+100.0*pow(length(z0.xz),0.17))*0.01;
}else mcol+=vec4(0.0,0.5,0.5,0.5);
return d;
}
float linstep(float a, float b, float t){float v=(t-a)/(b-a);return clamp(v,0.,1.);}//from knighty
float rand(vec2 co){// implementation found at: lumina.sourceforge.net/Tutorials/Noise.html
return fract(sin(dot(co*0.123,vec2(12.9898,78.233))) * 43758.5453);
}
float FuzzyShadow(vec3 ro, vec3 rd, float coneGrad, vec2 fragCoord){
float t=0.0,d=1.0,s=1.0;
ro+=rd*0.01;
for(int i=0;i<32;i++){
//if(s<0.1)continue;//uncommenting this makes shadows and reflections disappear - WTF?
float r=t*coneGrad;//radius of cone
d=DE(ro+rd*t)+r*0.5;
s*=linstep(-r,r,d);
t+=abs(d)*(0.5+0.5*rand(fragCoord.xy*vec2(i)))+0.005;
}
return clamp(s*0.8+0.2,0.0,1.0);
}
vec3 Background(vec3 rd){return vec3(0.8,0.9,1.0)*(0.3+0.7*pow(max(0.0,dot(rd,L)),2.0));}
vec3 FuzzyReflection(vec3 ro, vec3 rd, float coneGrad, vec2 fragCoord){
float t=0.0,d=1.0;
ro+=rd*0.01;
vec4 col=vec4(0.0);
for(int i=0;i<24;i++){
if(col.w>0.9)continue;
float r=t*coneGrad;//radius of cone
d=DE(ro+rd*t)+r*0.5;
if(d<r){
vec3 p=ro+rd*t;
mcol=vec4(0.0);
vec2 v=vec2(r,0.0);//use normal deltas based on CoC radius
vec3 N=normalize(vec3(-CE(p-v.xyy)+CE(p+v.xyy),-CE(p-v.yxy)+CE(p+v.yxy),-CE(p-v.yyx)+CE(p+v.yyx)));
vec3 scol=mcol.rgb*0.1666*max(0.1,0.25+dot(N,L)*0.75);//do some fast light calcs (you can forget about shadow casting, too expensive)
float alpha=(1.0-col.w)* linstep(-r,r,-d);//calculate the mix like cloud density
col+=vec4(scol*alpha,alpha);//blend in the new color
}
t+=abs(d)*(0.5+0.5*rand(fragCoord.xy*vec2(i)))+0.005;
}
return col.rgb+Background(rd)*(1.0-clamp(col.w,0.0,1.0));
}
mat3 lookat(vec3 fw,vec3 up){
fw=normalize(fw);vec3 rt=normalize(cross(fw,normalize(up)));return mat3(rt,cross(rt,fw),fw);
}
void main() {
gl_FragColor = vec4(1);
return;
vec3 ro=vec3(-2.25,1.5+sin(Y.x*0.9),-4);
vec3 rd = vec3((gl_FragCoord.xy / Y.y - 0.5), 0.8);
rd.x -= Y.z;
L=normalize(vec3(0.5,0.5,-0.5));
rmx=RMat2(Y.x);
rmx1=RMat2(0.09);
rmx2=RMat2(Y.x*10.0);
vec3 col=Background(rd);
float t=0.0,d=1.0;
for(int i=0;i<64;i++){
if(t>10.0 || d<0.005) continue;
t+=d=DE(ro+rd*t);
}
if(d>=0.1 && rd.y<0.0){//fix the ground
t=-(ro.y+1.5)/rd.y;
d=0.0;
}
if(d<0.1){//close enough for a hit
ro+=rd*t;
mcol=vec4(0.0);
const vec2 v=vec2(0.001,0.0);
vec3 N=normalize(vec3(-CE(ro-v.xyy)+CE(ro+v.xyy),-CE(ro-v.yxy)+CE(ro+v.yxy),-CE(ro-v.yyx)+CE(ro+v.yyx)));
mcol*=0.1666;
float refl=mcol.w;
vec3 scol=mcol.rgb*max(0.1,0.25+dot(N,L)*0.75);
float shadowConeGrad = 0.15;
scol*=FuzzyShadow(ro,L,shadowConeGrad,gl_FragCoord.xy);//the cone grad could be calculated for each lights position
float reflectionConeGrad = 0.09;
scol+=refl*FuzzyReflection(ro,reflect(rd,N),reflectionConeGrad,gl_FragCoord.xy);//each material could have a separate cone
col=mix(scol,col,clamp(t*0.05,0.0,1.0));
}
col*=1.25;
gl_FragColor = vec4(clamp(col,0.0,1.0),1.0);
}

169
uc16-4k/mark.fs_1 Normal file
View File

@@ -0,0 +1,169 @@
#version 130
// make the whole shader non const after optmizing, because we set this constant before compiling
const int CurScene = 0x9; // this 0x0 has to be readded, because the optimizer throws it away
// Parameters from our host
// x: Scene+Zeit
// y: Hoehe
// z: Aspec
uniform vec4 Y;
vec3 L;
mat2 RMat2(float a){return mat2(cos(a),sin(a),-sin(a),cos(a));}
mat2 rmx,rmx1,rmx2;
float HTorus(in vec3 z){
return max(-z.y,max(abs(length(max(abs(z.xy)-0.5,0.0))-0.5),abs(z.z))-0.2);
}
const vec4 scale=vec4(1.385,-1.385,1.385,1.385);
float DE(in vec3 z0){
z0.xz=z0.xz*rmx;
vec4 z=vec4(z0,1.0);
z.zy*=rmx1;
float d=max(abs(z.y+1.0)-1.0,length(z.xz)-0.2);
for(int i=0;i<4;i++){
z.xz=abs(z.zx);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
}
z.xz=z.zx;
float s=sign(z.x);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.xz=z.xz*rmx2*s;
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.y-=0.6;
d=min(d,min(length(max(abs(z.xyz)-vec3(0.0,0.5,0.55),0.0))-0.25,
length(max(abs(z.xyz+vec3(0.9,0.6,0.0))-vec3(0.4,-0.1,0.5),0.0))-0.4)/z.w);
return min(d,z0.y+1.5);
}
vec4 mcol;
float CE(in vec3 z0){
vec4 z=vec4(z0,1.0);
z.xz=z.xz*rmx;
z.zy*=rmx1;
float d=max(abs(z.y+1.0)-1.0,length(z.xz)-0.2);
for(int i=0;i<4;i++){
z.xz=abs(z.zx);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
}
z.xz=z.zx;
float s=sign(z.x);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.xz=z.xz*rmx2*s;
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.y-=0.6;
float d2=min(length(max(abs(z.xyz)-vec3(0.0,0.5,0.55),0.0))-0.25,
length(max(abs(z.xyz+vec3(0.9,0.6,0.0))-vec3(0.4,-0.1,0.5),0.0))-0.4)/z.w;
float d3=z0.y+1.5;
d=min(d,min(d2,d3));
if(abs(d2-d)<0.001)mcol+=vec4(1.0,0.1,0.0,0.2);
else if(abs(d3-d)<0.001){
mcol+=vec4(0.25,0.25,0.2,0.333);
d+=sin(-Y.x*100.0+100.0*pow(length(z0.xz),0.17))*0.01;
}else mcol+=vec4(0.0,0.5,0.5,0.5);
return d;
}
float linstep(float a, float b, float t){float v=(t-a)/(b-a);return clamp(v,0.,1.);}//from knighty
float rand(vec2 co){// implementation found at: lumina.sourceforge.net/Tutorials/Noise.html
return fract(sin(dot(co*0.123,vec2(12.9898,78.233))) * 43758.5453);
}
float FuzzyShadow(vec3 ro, vec3 rd, float coneGrad, vec2 fragCoord){
float t=0.0,d=1.0,s=1.0;
ro+=rd*0.01;
for(int i=0;i<32;i++){
//if(s<0.1)continue;//uncommenting this makes shadows and reflections disappear - WTF?
float r=t*coneGrad;//radius of cone
d=DE(ro+rd*t)+r*0.5;
s*=linstep(-r,r,d);
t+=abs(d)*(0.5+0.5*rand(fragCoord.xy*vec2(i)))+0.005;
}
return clamp(s*0.8+0.2,0.0,1.0);
}
vec3 Background(vec3 rd){return vec3(0.8,0.9,1.0)*(0.3+0.7*pow(max(0.0,dot(rd,L)),2.0));}
vec3 FuzzyReflection(vec3 ro, vec3 rd, float coneGrad, vec2 fragCoord){
float t=0.0,d=1.0;
ro+=rd*0.01;
vec4 col=vec4(0.0);
for(int i=0;i<24;i++){
if(col.w>0.9)continue;
float r=t*coneGrad;//radius of cone
d=DE(ro+rd*t)+r*0.5;
if(d<r){
vec3 p=ro+rd*t;
mcol=vec4(0.0);
vec2 v=vec2(r,0.0);//use normal deltas based on CoC radius
vec3 N=normalize(vec3(-CE(p-v.xyy)+CE(p+v.xyy),-CE(p-v.yxy)+CE(p+v.yxy),-CE(p-v.yyx)+CE(p+v.yyx)));
vec3 scol=mcol.rgb*0.1666*max(0.1,0.25+dot(N,L)*0.75);//do some fast light calcs (you can forget about shadow casting, too expensive)
float alpha=(1.0-col.w)* linstep(-r,r,-d);//calculate the mix like cloud density
col+=vec4(scol*alpha,alpha);//blend in the new color
}
t+=abs(d)*(0.5+0.5*rand(fragCoord.xy*vec2(i)))+0.005;
}
return col.rgb+Background(rd)*(1.0-clamp(col.w,0.0,1.0));
}
mat3 lookat(vec3 fw,vec3 up){
fw=normalize(fw);vec3 rt=normalize(cross(fw,normalize(up)));return mat3(rt,cross(rt,fw),fw);
}
void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
vec3 ro=vec3(-2.25,1.5+sin(Y.x*0.9),-4);
vec3 rd = vec3((gl_FragCoord.xy / Y.y - 0.5), 0.8);
rd.x -= Y.z;
L=normalize(vec3(0.5,0.5,-0.5));
rmx=RMat2(Y.x);
rmx1=RMat2(0.09);
rmx2=RMat2(Y.x*10.0);
vec3 col=Background(rd);
float t=0.0,d=1.0;
for(int i=0;i<64;i++){
if(t>10.0 || d<0.005) continue;
t+=d=DE(ro+rd*t);
}
if(d>=0.1 && rd.y<0.0){//fix the ground
t=-(ro.y+1.5)/rd.y;
d=0.0;
}
if(d<0.1){//close enough for a hit
ro+=rd*t;
mcol=vec4(0.0);
const vec2 v=vec2(0.001,0.0);
vec3 N=normalize(vec3(-CE(ro-v.xyy)+CE(ro+v.xyy),-CE(ro-v.yxy)+CE(ro+v.yxy),-CE(ro-v.yyx)+CE(ro+v.yyx)));
mcol*=0.1666;
float refl=mcol.w;
vec3 scol=mcol.rgb*max(0.1,0.25+dot(N,L)*0.75);
float shadowConeGrad = 0.15;
scol*=FuzzyShadow(ro,L,shadowConeGrad,fragCoord);//the cone grad could be calculated for each lights position
float reflectionConeGrad = 0.09;
scol+=refl*FuzzyReflection(ro,reflect(rd,N),reflectionConeGrad,fragCoord);//each material could have a separate cone
col=mix(scol,col,clamp(t*0.05,0.0,1.0));
}
col*=1.25;
fragColor = vec4(clamp(col,0.0,1.0),1.0);
}

169
uc16-4k/mark.fs_1_dbg Normal file
View File

@@ -0,0 +1,169 @@
#version 130
// make the whole shader non const after optmizing, because we set this constant before compiling
int CurScene = 0x0;
// Parameters from our host
// x: Scene+Zeit
// y: Hoehe
// z: Aspec
uniform vec4 Y;
vec3 L;
mat2 RMat2(float a){return mat2(cos(a),sin(a),-sin(a),cos(a));}
mat2 rmx,rmx1,rmx2;
float HTorus(in vec3 z){
return max(-z.y,max(abs(length(max(abs(z.xy)-0.5,0.0))-0.5),abs(z.z))-0.2);
}
const vec4 scale=vec4(1.385,-1.385,1.385,1.385);
float DE(in vec3 z0){
z0.xz=z0.xz*rmx;
vec4 z=vec4(z0,1.0);
z.zy*=rmx1;
float d=max(abs(z.y+1.0)-1.0,length(z.xz)-0.2);
for(int i=0;i<4;i++){
z.xz=abs(z.zx);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
}
z.xz=z.zx;
float s=sign(z.x);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.xz=z.xz*rmx2*s;
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.y-=0.6;
d=min(d,min(length(max(abs(z.xyz)-vec3(0.0,0.5,0.55),0.0))-0.25,
length(max(abs(z.xyz+vec3(0.9,0.6,0.0))-vec3(0.4,-0.1,0.5),0.0))-0.4)/z.w);
return min(d,z0.y+1.5);
}
vec4 mcol;
float CE(in vec3 z0){
vec4 z=vec4(z0,1.0);
z.xz=z.xz*rmx;
z.zy*=rmx1;
float d=max(abs(z.y+1.0)-1.0,length(z.xz)-0.2);
for(int i=0;i<4;i++){
z.xz=abs(z.zx);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
}
z.xz=z.zx;
float s=sign(z.x);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.xz=z.xz*rmx2*s;
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.y-=0.6;
float d2=min(length(max(abs(z.xyz)-vec3(0.0,0.5,0.55),0.0))-0.25,
length(max(abs(z.xyz+vec3(0.9,0.6,0.0))-vec3(0.4,-0.1,0.5),0.0))-0.4)/z.w;
float d3=z0.y+1.5;
d=min(d,min(d2,d3));
if(abs(d2-d)<0.001)mcol+=vec4(1.0,0.1,0.0,0.2);
else if(abs(d3-d)<0.001){
mcol+=vec4(0.25,0.25,0.2,0.333);
d+=sin(-Y.x*100.0+100.0*pow(length(z0.xz),0.17))*0.01;
}else mcol+=vec4(0.0,0.5,0.5,0.5);
return d;
}
float linstep(float a, float b, float t){float v=(t-a)/(b-a);return clamp(v,0.,1.);}//from knighty
float rand(vec2 co){// implementation found at: lumina.sourceforge.net/Tutorials/Noise.html
return fract(sin(dot(co*0.123,vec2(12.9898,78.233))) * 43758.5453);
}
float FuzzyShadow(vec3 ro, vec3 rd, float coneGrad, vec2 fragCoord){
float t=0.0,d=1.0,s=1.0;
ro+=rd*0.01;
for(int i=0;i<32;i++){
//if(s<0.1)continue;//uncommenting this makes shadows and reflections disappear - WTF?
float r=t*coneGrad;//radius of cone
d=DE(ro+rd*t)+r*0.5;
s*=linstep(-r,r,d);
t+=abs(d)*(0.5+0.5*rand(fragCoord.xy*vec2(i)))+0.005;
}
return clamp(s*0.8+0.2,0.0,1.0);
}
vec3 Background(vec3 rd){return vec3(0.8,0.9,1.0)*(0.3+0.7*pow(max(0.0,dot(rd,L)),2.0));}
vec3 FuzzyReflection(vec3 ro, vec3 rd, float coneGrad, vec2 fragCoord){
float t=0.0,d=1.0;
ro+=rd*0.01;
vec4 col=vec4(0.0);
for(int i=0;i<24;i++){
if(col.w>0.9)continue;
float r=t*coneGrad;//radius of cone
d=DE(ro+rd*t)+r*0.5;
if(d<r){
vec3 p=ro+rd*t;
mcol=vec4(0.0);
vec2 v=vec2(r,0.0);//use normal deltas based on CoC radius
vec3 N=normalize(vec3(-CE(p-v.xyy)+CE(p+v.xyy),-CE(p-v.yxy)+CE(p+v.yxy),-CE(p-v.yyx)+CE(p+v.yyx)));
vec3 scol=mcol.rgb*0.1666*max(0.1,0.25+dot(N,L)*0.75);//do some fast light calcs (you can forget about shadow casting, too expensive)
float alpha=(1.0-col.w)* linstep(-r,r,-d);//calculate the mix like cloud density
col+=vec4(scol*alpha,alpha);//blend in the new color
}
t+=abs(d)*(0.5+0.5*rand(fragCoord.xy*vec2(i)))+0.005;
}
return col.rgb+Background(rd)*(1.0-clamp(col.w,0.0,1.0));
}
mat3 lookat(vec3 fw,vec3 up){
fw=normalize(fw);vec3 rt=normalize(cross(fw,normalize(up)));return mat3(rt,cross(rt,fw),fw);
}
void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
vec3 ro=vec3(-2.25,1.5+sin(Y.x*0.9),-4);
vec3 rd = vec3((gl_FragCoord.xy / Y.y - 0.5), 0.8);
rd.x -= Y.z;
L=normalize(vec3(0.5,0.5,-0.5));
rmx=RMat2(Y.x);
rmx1=RMat2(0.09);
rmx2=RMat2(Y.x*10.0);
vec3 col=Background(rd);
float t=0.0,d=1.0;
for(int i=0;i<64;i++){
if(t>10.0 || d<0.005) continue;
t+=d=DE(ro+rd*t);
}
if(d>=0.1 && rd.y<0.0){//fix the ground
t=-(ro.y+1.5)/rd.y;
d=0.0;
}
if(d<0.1){//close enough for a hit
ro+=rd*t;
mcol=vec4(0.0);
const vec2 v=vec2(0.001,0.0);
vec3 N=normalize(vec3(-CE(ro-v.xyy)+CE(ro+v.xyy),-CE(ro-v.yxy)+CE(ro+v.yxy),-CE(ro-v.yyx)+CE(ro+v.yyx)));
mcol*=0.1666;
float refl=mcol.w;
vec3 scol=mcol.rgb*max(0.1,0.25+dot(N,L)*0.75);
float shadowConeGrad = 0.15;
scol*=FuzzyShadow(ro,L,shadowConeGrad,fragCoord);//the cone grad could be calculated for each lights position
float reflectionConeGrad = 0.09;
scol+=refl*FuzzyReflection(ro,reflect(rd,N),reflectionConeGrad,fragCoord);//each material could have a separate cone
col=mix(scol,col,clamp(t*0.05,0.0,1.0));
}
col*=1.25;
fragColor = vec4(clamp(col,0.0,1.0),1.0);
}

169
uc16-4k/mark.fs_2 Normal file
View File

@@ -0,0 +1,169 @@
#version 130
// make the whole shader non const after optmizing, because we set this constant before compiling
const int CurScene = 0x9; // this 0x0 has to be readded, because the optimizer throws it away
// Parameters from our host
// x: Scene+Zeit
// y: Hoehe
// z: Aspec
uniform vec4 Y;
vec3 L;
mat2 RMat2(float a){return mat2(cos(a),sin(a),-sin(a),cos(a));}
mat2 rmx,rmx1,rmx2;
float HTorus(in vec3 z){
return max(-z.y,max(abs(length(max(abs(z.xy)-0.5,0.0))-0.5),abs(z.z))-0.2);
}
const vec4 scale=vec4(1.385,-1.385,1.385,1.385);
float DE(in vec3 z0){
z0.xz=z0.xz*rmx;
vec4 z=vec4(z0,1.0);
z.zy*=rmx1;
float d=max(abs(z.y+1.0)-1.0,length(z.xz)-0.2);
for(int i=0;i<4;i++){
z.xz=abs(z.zx);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
}
z.xz=z.zx;
float s=sign(z.x);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.xz=z.xz*rmx2*s;
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.y-=0.6;
d=min(d,min(length(max(abs(z.xyz)-vec3(0.0,0.5,0.55),0.0))-0.25,
length(max(abs(z.xyz+vec3(0.9,0.6,0.0))-vec3(0.4,-0.1,0.5),0.0))-0.4)/z.w);
return min(d,z0.y+1.5);
}
vec4 mcol;
float CE(in vec3 z0){
vec4 z=vec4(z0,1.0);
z.xz=z.xz*rmx;
z.zy*=rmx1;
float d=max(abs(z.y+1.0)-1.0,length(z.xz)-0.2);
for(int i=0;i<4;i++){
z.xz=abs(z.zx);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
}
z.xz=z.zx;
float s=sign(z.x);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.xz=z.xz*rmx2*s;
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.y-=0.6;
float d2=min(length(max(abs(z.xyz)-vec3(0.0,0.5,0.55),0.0))-0.25,
length(max(abs(z.xyz+vec3(0.9,0.6,0.0))-vec3(0.4,-0.1,0.5),0.0))-0.4)/z.w;
float d3=z0.y+1.5;
d=min(d,min(d2,d3));
if(abs(d2-d)<0.001)mcol+=vec4(1.0,0.1,0.0,0.2);
else if(abs(d3-d)<0.001){
mcol+=vec4(0.25,0.25,0.2,0.333);
d+=sin(-Y.x*100.0+100.0*pow(length(z0.xz),0.17))*0.01;
}else mcol+=vec4(0.0,0.5,0.5,0.5);
return d;
}
float linstep(float a, float b, float t){float v=(t-a)/(b-a);return clamp(v,0.,1.);}//from knighty
float rand(vec2 co){// implementation found at: lumina.sourceforge.net/Tutorials/Noise.html
return fract(sin(dot(co*0.123,vec2(12.9898,78.233))) * 43758.5453);
}
float FuzzyShadow(vec3 ro, vec3 rd, float coneGrad, vec2 fragCoord){
float t=0.0,d=1.0,s=1.0;
ro+=rd*0.01;
for(int i=0;i<32;i++){
//if(s<0.1)continue;//uncommenting this makes shadows and reflections disappear - WTF?
float r=t*coneGrad;//radius of cone
d=DE(ro+rd*t)+r*0.5;
s*=linstep(-r,r,d);
t+=abs(d)*(0.5+0.5*rand(fragCoord.xy*vec2(i)))+0.005;
}
return clamp(s*0.8+0.2,0.0,1.0);
}
vec3 Background(vec3 rd){return vec3(0.8,0.9,1.0)*(0.3+0.7*pow(max(0.0,dot(rd,L)),2.0));}
vec3 FuzzyReflection(vec3 ro, vec3 rd, float coneGrad, vec2 fragCoord){
float t=0.0,d=1.0;
ro+=rd*0.01;
vec4 col=vec4(0.0);
for(int i=0;i<24;i++){
if(col.w>0.9)continue;
float r=t*coneGrad;//radius of cone
d=DE(ro+rd*t)+r*0.5;
if(d<r){
vec3 p=ro+rd*t;
mcol=vec4(0.0);
vec2 v=vec2(r,0.0);//use normal deltas based on CoC radius
vec3 N=normalize(vec3(-CE(p-v.xyy)+CE(p+v.xyy),-CE(p-v.yxy)+CE(p+v.yxy),-CE(p-v.yyx)+CE(p+v.yyx)));
vec3 scol=mcol.rgb*0.1666*max(0.1,0.25+dot(N,L)*0.75);//do some fast light calcs (you can forget about shadow casting, too expensive)
float alpha=(1.0-col.w)* linstep(-r,r,-d);//calculate the mix like cloud density
col+=vec4(scol*alpha,alpha);//blend in the new color
}
t+=abs(d)*(0.5+0.5*rand(fragCoord.xy*vec2(i)))+0.005;
}
return col.rgb+Background(rd)*(1.0-clamp(col.w,0.0,1.0));
}
mat3 lookat(vec3 fw,vec3 up){
fw=normalize(fw);vec3 rt=normalize(cross(fw,normalize(up)));return mat3(rt,cross(rt,fw),fw);
}
void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
vec3 ro=vec3(-2.25,1.5+sin(Y.x*0.9),-4);
vec3 rd = vec3((gl_FragCoord.xy / Y.y - 0.5), 0.8);
rd.x -= Y.z;
L=normalize(vec3(0.5,0.5,-0.5));
rmx=RMat2(Y.x);
rmx1=RMat2(0.09);
rmx2=RMat2(Y.x*10.0);
vec3 col=Background(rd);
float t=0.0,d=1.0;
for(int i=0;i<64;i++){
if(t>10.0 || d<0.005) continue;
t+=d=DE(ro+rd*t);
}
if(d>=0.1 && rd.y<0.0){//fix the ground
t=-(ro.y+1.5)/rd.y;
d=0.0;
}
if(d<0.1){//close enough for a hit
ro+=rd*t;
mcol=vec4(0.0);
const vec2 v=vec2(0.001,0.0);
vec3 N=normalize(vec3(-CE(ro-v.xyy)+CE(ro+v.xyy),-CE(ro-v.yxy)+CE(ro+v.yxy),-CE(ro-v.yyx)+CE(ro+v.yyx)));
mcol*=0.1666;
float refl=mcol.w;
vec3 scol=mcol.rgb*max(0.1,0.25+dot(N,L)*0.75);
float shadowConeGrad = 0.15;
scol*=FuzzyShadow(ro,L,shadowConeGrad,fragCoord);//the cone grad could be calculated for each lights position
float reflectionConeGrad = 0.09;
scol+=refl*FuzzyReflection(ro,reflect(rd,N),reflectionConeGrad,fragCoord);//each material could have a separate cone
col=mix(scol,col,clamp(t*0.05,0.0,1.0));
}
col*=1.25;
fragColor = vec4(clamp(col,0.0,1.0),1.0);
}

169
uc16-4k/mark.fs_2_dbg Normal file
View File

@@ -0,0 +1,169 @@
#version 130
// make the whole shader non const after optmizing, because we set this constant before compiling
int CurScene = 0x0;
// Parameters from our host
// x: Scene+Zeit
// y: Hoehe
// z: Aspec
uniform vec4 Y;
vec3 L;
mat2 RMat2(float a){return mat2(cos(a),sin(a),-sin(a),cos(a));}
mat2 rmx,rmx1,rmx2;
float HTorus(in vec3 z){
return max(-z.y,max(abs(length(max(abs(z.xy)-0.5,0.0))-0.5),abs(z.z))-0.2);
}
const vec4 scale=vec4(1.385,-1.385,1.385,1.385);
float DE(in vec3 z0){
z0.xz=z0.xz*rmx;
vec4 z=vec4(z0,1.0);
z.zy*=rmx1;
float d=max(abs(z.y+1.0)-1.0,length(z.xz)-0.2);
for(int i=0;i<4;i++){
z.xz=abs(z.zx);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
}
z.xz=z.zx;
float s=sign(z.x);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.xz=z.xz*rmx2*s;
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.y-=0.6;
d=min(d,min(length(max(abs(z.xyz)-vec3(0.0,0.5,0.55),0.0))-0.25,
length(max(abs(z.xyz+vec3(0.9,0.6,0.0))-vec3(0.4,-0.1,0.5),0.0))-0.4)/z.w);
return min(d,z0.y+1.5);
}
vec4 mcol;
float CE(in vec3 z0){
vec4 z=vec4(z0,1.0);
z.xz=z.xz*rmx;
z.zy*=rmx1;
float d=max(abs(z.y+1.0)-1.0,length(z.xz)-0.2);
for(int i=0;i<4;i++){
z.xz=abs(z.zx);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
}
z.xz=z.zx;
float s=sign(z.x);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.xz=z.xz*rmx2*s;
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.y-=0.6;
float d2=min(length(max(abs(z.xyz)-vec3(0.0,0.5,0.55),0.0))-0.25,
length(max(abs(z.xyz+vec3(0.9,0.6,0.0))-vec3(0.4,-0.1,0.5),0.0))-0.4)/z.w;
float d3=z0.y+1.5;
d=min(d,min(d2,d3));
if(abs(d2-d)<0.001)mcol+=vec4(1.0,0.1,0.0,0.2);
else if(abs(d3-d)<0.001){
mcol+=vec4(0.25,0.25,0.2,0.333);
d+=sin(-Y.x*100.0+100.0*pow(length(z0.xz),0.17))*0.01;
}else mcol+=vec4(0.0,0.5,0.5,0.5);
return d;
}
float linstep(float a, float b, float t){float v=(t-a)/(b-a);return clamp(v,0.,1.);}//from knighty
float rand(vec2 co){// implementation found at: lumina.sourceforge.net/Tutorials/Noise.html
return fract(sin(dot(co*0.123,vec2(12.9898,78.233))) * 43758.5453);
}
float FuzzyShadow(vec3 ro, vec3 rd, float coneGrad, vec2 fragCoord){
float t=0.0,d=1.0,s=1.0;
ro+=rd*0.01;
for(int i=0;i<32;i++){
//if(s<0.1)continue;//uncommenting this makes shadows and reflections disappear - WTF?
float r=t*coneGrad;//radius of cone
d=DE(ro+rd*t)+r*0.5;
s*=linstep(-r,r,d);
t+=abs(d)*(0.5+0.5*rand(fragCoord.xy*vec2(i)))+0.005;
}
return clamp(s*0.8+0.2,0.0,1.0);
}
vec3 Background(vec3 rd){return vec3(0.8,0.9,1.0)*(0.3+0.7*pow(max(0.0,dot(rd,L)),2.0));}
vec3 FuzzyReflection(vec3 ro, vec3 rd, float coneGrad, vec2 fragCoord){
float t=0.0,d=1.0;
ro+=rd*0.01;
vec4 col=vec4(0.0);
for(int i=0;i<24;i++){
if(col.w>0.9)continue;
float r=t*coneGrad;//radius of cone
d=DE(ro+rd*t)+r*0.5;
if(d<r){
vec3 p=ro+rd*t;
mcol=vec4(0.0);
vec2 v=vec2(r,0.0);//use normal deltas based on CoC radius
vec3 N=normalize(vec3(-CE(p-v.xyy)+CE(p+v.xyy),-CE(p-v.yxy)+CE(p+v.yxy),-CE(p-v.yyx)+CE(p+v.yyx)));
vec3 scol=mcol.rgb*0.1666*max(0.1,0.25+dot(N,L)*0.75);//do some fast light calcs (you can forget about shadow casting, too expensive)
float alpha=(1.0-col.w)* linstep(-r,r,-d);//calculate the mix like cloud density
col+=vec4(scol*alpha,alpha);//blend in the new color
}
t+=abs(d)*(0.5+0.5*rand(fragCoord.xy*vec2(i)))+0.005;
}
return col.rgb+Background(rd)*(1.0-clamp(col.w,0.0,1.0));
}
mat3 lookat(vec3 fw,vec3 up){
fw=normalize(fw);vec3 rt=normalize(cross(fw,normalize(up)));return mat3(rt,cross(rt,fw),fw);
}
void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
vec3 ro=vec3(-2.25,1.5+sin(Y.x*0.9),-4);
vec3 rd = vec3((gl_FragCoord.xy / Y.y - 0.5), 0.8);
rd.x -= Y.z;
L=normalize(vec3(0.5,0.5,-0.5));
rmx=RMat2(Y.x);
rmx1=RMat2(0.09);
rmx2=RMat2(Y.x*10.0);
vec3 col=Background(rd);
float t=0.0,d=1.0;
for(int i=0;i<64;i++){
if(t>10.0 || d<0.005) continue;
t+=d=DE(ro+rd*t);
}
if(d>=0.1 && rd.y<0.0){//fix the ground
t=-(ro.y+1.5)/rd.y;
d=0.0;
}
if(d<0.1){//close enough for a hit
ro+=rd*t;
mcol=vec4(0.0);
const vec2 v=vec2(0.001,0.0);
vec3 N=normalize(vec3(-CE(ro-v.xyy)+CE(ro+v.xyy),-CE(ro-v.yxy)+CE(ro+v.yxy),-CE(ro-v.yyx)+CE(ro+v.yyx)));
mcol*=0.1666;
float refl=mcol.w;
vec3 scol=mcol.rgb*max(0.1,0.25+dot(N,L)*0.75);
float shadowConeGrad = 0.15;
scol*=FuzzyShadow(ro,L,shadowConeGrad,fragCoord);//the cone grad could be calculated for each lights position
float reflectionConeGrad = 0.09;
scol+=refl*FuzzyReflection(ro,reflect(rd,N),reflectionConeGrad,fragCoord);//each material could have a separate cone
col=mix(scol,col,clamp(t*0.05,0.0,1.0));
}
col*=1.25;
fragColor = vec4(clamp(col,0.0,1.0),1.0);
}

169
uc16-4k/mark.fs_3 Normal file
View File

@@ -0,0 +1,169 @@
#version 130
// make the whole shader non const after optmizing, because we set this constant before compiling
const int CurScene = 0x9; // this 0x0 has to be readded, because the optimizer throws it away
// Parameters from our host
// x: Scene+Zeit
// y: Hoehe
// z: Aspec
uniform vec4 Y;
vec3 L;
mat2 RMat2(float a){return mat2(cos(a),sin(a),-sin(a),cos(a));}
mat2 rmx,rmx1,rmx2;
float HTorus(in vec3 z){
return max(-z.y,max(abs(length(max(abs(z.xy)-0.5,0.0))-0.5),abs(z.z))-0.2);
}
const vec4 scale=vec4(1.385,-1.385,1.385,1.385);
float DE(in vec3 z0){
z0.xz=z0.xz*rmx;
vec4 z=vec4(z0,1.0);
z.zy*=rmx1;
float d=max(abs(z.y+1.0)-1.0,length(z.xz)-0.2);
for(int i=0;i<4;i++){
z.xz=abs(z.zx);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
}
z.xz=z.zx;
float s=sign(z.x);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.xz=z.xz*rmx2*s;
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.y-=0.6;
d=min(d,min(length(max(abs(z.xyz)-vec3(0.0,0.5,0.55),0.0))-0.25,
length(max(abs(z.xyz+vec3(0.9,0.6,0.0))-vec3(0.4,-0.1,0.5),0.0))-0.4)/z.w);
return min(d,z0.y+1.5);
}
vec4 mcol;
float CE(in vec3 z0){
vec4 z=vec4(z0,1.0);
z.xz=z.xz*rmx;
z.zy*=rmx1;
float d=max(abs(z.y+1.0)-1.0,length(z.xz)-0.2);
for(int i=0;i<4;i++){
z.xz=abs(z.zx);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
}
z.xz=z.zx;
float s=sign(z.x);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.xz=z.xz*rmx2*s;
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.y-=0.6;
float d2=min(length(max(abs(z.xyz)-vec3(0.0,0.5,0.55),0.0))-0.25,
length(max(abs(z.xyz+vec3(0.9,0.6,0.0))-vec3(0.4,-0.1,0.5),0.0))-0.4)/z.w;
float d3=z0.y+1.5;
d=min(d,min(d2,d3));
if(abs(d2-d)<0.001)mcol+=vec4(1.0,0.1,0.0,0.2);
else if(abs(d3-d)<0.001){
mcol+=vec4(0.25,0.25,0.2,0.333);
d+=sin(-Y.x*100.0+100.0*pow(length(z0.xz),0.17))*0.01;
}else mcol+=vec4(0.0,0.5,0.5,0.5);
return d;
}
float linstep(float a, float b, float t){float v=(t-a)/(b-a);return clamp(v,0.,1.);}//from knighty
float rand(vec2 co){// implementation found at: lumina.sourceforge.net/Tutorials/Noise.html
return fract(sin(dot(co*0.123,vec2(12.9898,78.233))) * 43758.5453);
}
float FuzzyShadow(vec3 ro, vec3 rd, float coneGrad, vec2 fragCoord){
float t=0.0,d=1.0,s=1.0;
ro+=rd*0.01;
for(int i=0;i<32;i++){
//if(s<0.1)continue;//uncommenting this makes shadows and reflections disappear - WTF?
float r=t*coneGrad;//radius of cone
d=DE(ro+rd*t)+r*0.5;
s*=linstep(-r,r,d);
t+=abs(d)*(0.5+0.5*rand(fragCoord.xy*vec2(i)))+0.005;
}
return clamp(s*0.8+0.2,0.0,1.0);
}
vec3 Background(vec3 rd){return vec3(0.8,0.9,1.0)*(0.3+0.7*pow(max(0.0,dot(rd,L)),2.0));}
vec3 FuzzyReflection(vec3 ro, vec3 rd, float coneGrad, vec2 fragCoord){
float t=0.0,d=1.0;
ro+=rd*0.01;
vec4 col=vec4(0.0);
for(int i=0;i<24;i++){
if(col.w>0.9)continue;
float r=t*coneGrad;//radius of cone
d=DE(ro+rd*t)+r*0.5;
if(d<r){
vec3 p=ro+rd*t;
mcol=vec4(0.0);
vec2 v=vec2(r,0.0);//use normal deltas based on CoC radius
vec3 N=normalize(vec3(-CE(p-v.xyy)+CE(p+v.xyy),-CE(p-v.yxy)+CE(p+v.yxy),-CE(p-v.yyx)+CE(p+v.yyx)));
vec3 scol=mcol.rgb*0.1666*max(0.1,0.25+dot(N,L)*0.75);//do some fast light calcs (you can forget about shadow casting, too expensive)
float alpha=(1.0-col.w)* linstep(-r,r,-d);//calculate the mix like cloud density
col+=vec4(scol*alpha,alpha);//blend in the new color
}
t+=abs(d)*(0.5+0.5*rand(fragCoord.xy*vec2(i)))+0.005;
}
return col.rgb+Background(rd)*(1.0-clamp(col.w,0.0,1.0));
}
mat3 lookat(vec3 fw,vec3 up){
fw=normalize(fw);vec3 rt=normalize(cross(fw,normalize(up)));return mat3(rt,cross(rt,fw),fw);
}
void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
vec3 ro=vec3(-2.25,1.5+sin(Y.x*0.9),-4);
vec3 rd = vec3((gl_FragCoord.xy / Y.y - 0.5), 0.8);
rd.x -= Y.z;
L=normalize(vec3(0.5,0.5,-0.5));
rmx=RMat2(Y.x);
rmx1=RMat2(0.09);
rmx2=RMat2(Y.x*10.0);
vec3 col=Background(rd);
float t=0.0,d=1.0;
for(int i=0;i<64;i++){
if(t>10.0 || d<0.005) continue;
t+=d=DE(ro+rd*t);
}
if(d>=0.1 && rd.y<0.0){//fix the ground
t=-(ro.y+1.5)/rd.y;
d=0.0;
}
if(d<0.1){//close enough for a hit
ro+=rd*t;
mcol=vec4(0.0);
const vec2 v=vec2(0.001,0.0);
vec3 N=normalize(vec3(-CE(ro-v.xyy)+CE(ro+v.xyy),-CE(ro-v.yxy)+CE(ro+v.yxy),-CE(ro-v.yyx)+CE(ro+v.yyx)));
mcol*=0.1666;
float refl=mcol.w;
vec3 scol=mcol.rgb*max(0.1,0.25+dot(N,L)*0.75);
float shadowConeGrad = 0.15;
scol*=FuzzyShadow(ro,L,shadowConeGrad,fragCoord);//the cone grad could be calculated for each lights position
float reflectionConeGrad = 0.09;
scol+=refl*FuzzyReflection(ro,reflect(rd,N),reflectionConeGrad,fragCoord);//each material could have a separate cone
col=mix(scol,col,clamp(t*0.05,0.0,1.0));
}
col*=1.25;
fragColor = vec4(clamp(col,0.0,1.0),1.0);
}

169
uc16-4k/mark.fs_3_dbg Normal file
View File

@@ -0,0 +1,169 @@
#version 130
// make the whole shader non const after optmizing, because we set this constant before compiling
int CurScene = 0x0;
// Parameters from our host
// x: Scene+Zeit
// y: Hoehe
// z: Aspec
uniform vec4 Y;
vec3 L;
mat2 RMat2(float a){return mat2(cos(a),sin(a),-sin(a),cos(a));}
mat2 rmx,rmx1,rmx2;
float HTorus(in vec3 z){
return max(-z.y,max(abs(length(max(abs(z.xy)-0.5,0.0))-0.5),abs(z.z))-0.2);
}
const vec4 scale=vec4(1.385,-1.385,1.385,1.385);
float DE(in vec3 z0){
z0.xz=z0.xz*rmx;
vec4 z=vec4(z0,1.0);
z.zy*=rmx1;
float d=max(abs(z.y+1.0)-1.0,length(z.xz)-0.2);
for(int i=0;i<4;i++){
z.xz=abs(z.zx);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
}
z.xz=z.zx;
float s=sign(z.x);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.xz=z.xz*rmx2*s;
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.y-=0.6;
d=min(d,min(length(max(abs(z.xyz)-vec3(0.0,0.5,0.55),0.0))-0.25,
length(max(abs(z.xyz+vec3(0.9,0.6,0.0))-vec3(0.4,-0.1,0.5),0.0))-0.4)/z.w);
return min(d,z0.y+1.5);
}
vec4 mcol;
float CE(in vec3 z0){
vec4 z=vec4(z0,1.0);
z.xz=z.xz*rmx;
z.zy*=rmx1;
float d=max(abs(z.y+1.0)-1.0,length(z.xz)-0.2);
for(int i=0;i<4;i++){
z.xz=abs(z.zx);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
}
z.xz=z.zx;
float s=sign(z.x);
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.xz=z.xz*rmx2*s;
z.x-=1.0;
d=min(d,HTorus(z.xyz)/z.w);
z.x-=1.0;
z*=scale;
z.y-=0.6;
float d2=min(length(max(abs(z.xyz)-vec3(0.0,0.5,0.55),0.0))-0.25,
length(max(abs(z.xyz+vec3(0.9,0.6,0.0))-vec3(0.4,-0.1,0.5),0.0))-0.4)/z.w;
float d3=z0.y+1.5;
d=min(d,min(d2,d3));
if(abs(d2-d)<0.001)mcol+=vec4(1.0,0.1,0.0,0.2);
else if(abs(d3-d)<0.001){
mcol+=vec4(0.25,0.25,0.2,0.333);
d+=sin(-Y.x*100.0+100.0*pow(length(z0.xz),0.17))*0.01;
}else mcol+=vec4(0.0,0.5,0.5,0.5);
return d;
}
float linstep(float a, float b, float t){float v=(t-a)/(b-a);return clamp(v,0.,1.);}//from knighty
float rand(vec2 co){// implementation found at: lumina.sourceforge.net/Tutorials/Noise.html
return fract(sin(dot(co*0.123,vec2(12.9898,78.233))) * 43758.5453);
}
float FuzzyShadow(vec3 ro, vec3 rd, float coneGrad, vec2 fragCoord){
float t=0.0,d=1.0,s=1.0;
ro+=rd*0.01;
for(int i=0;i<32;i++){
//if(s<0.1)continue;//uncommenting this makes shadows and reflections disappear - WTF?
float r=t*coneGrad;//radius of cone
d=DE(ro+rd*t)+r*0.5;
s*=linstep(-r,r,d);
t+=abs(d)*(0.5+0.5*rand(fragCoord.xy*vec2(i)))+0.005;
}
return clamp(s*0.8+0.2,0.0,1.0);
}
vec3 Background(vec3 rd){return vec3(0.8,0.9,1.0)*(0.3+0.7*pow(max(0.0,dot(rd,L)),2.0));}
vec3 FuzzyReflection(vec3 ro, vec3 rd, float coneGrad, vec2 fragCoord){
float t=0.0,d=1.0;
ro+=rd*0.01;
vec4 col=vec4(0.0);
for(int i=0;i<24;i++){
if(col.w>0.9)continue;
float r=t*coneGrad;//radius of cone
d=DE(ro+rd*t)+r*0.5;
if(d<r){
vec3 p=ro+rd*t;
mcol=vec4(0.0);
vec2 v=vec2(r,0.0);//use normal deltas based on CoC radius
vec3 N=normalize(vec3(-CE(p-v.xyy)+CE(p+v.xyy),-CE(p-v.yxy)+CE(p+v.yxy),-CE(p-v.yyx)+CE(p+v.yyx)));
vec3 scol=mcol.rgb*0.1666*max(0.1,0.25+dot(N,L)*0.75);//do some fast light calcs (you can forget about shadow casting, too expensive)
float alpha=(1.0-col.w)* linstep(-r,r,-d);//calculate the mix like cloud density
col+=vec4(scol*alpha,alpha);//blend in the new color
}
t+=abs(d)*(0.5+0.5*rand(fragCoord.xy*vec2(i)))+0.005;
}
return col.rgb+Background(rd)*(1.0-clamp(col.w,0.0,1.0));
}
mat3 lookat(vec3 fw,vec3 up){
fw=normalize(fw);vec3 rt=normalize(cross(fw,normalize(up)));return mat3(rt,cross(rt,fw),fw);
}
void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
vec3 ro=vec3(-2.25,1.5+sin(Y.x*0.9),-4);
vec3 rd = vec3((gl_FragCoord.xy / Y.y - 0.5), 0.8);
rd.x -= Y.z;
L=normalize(vec3(0.5,0.5,-0.5));
rmx=RMat2(Y.x);
rmx1=RMat2(0.09);
rmx2=RMat2(Y.x*10.0);
vec3 col=Background(rd);
float t=0.0,d=1.0;
for(int i=0;i<64;i++){
if(t>10.0 || d<0.005) continue;
t+=d=DE(ro+rd*t);
}
if(d>=0.1 && rd.y<0.0){//fix the ground
t=-(ro.y+1.5)/rd.y;
d=0.0;
}
if(d<0.1){//close enough for a hit
ro+=rd*t;
mcol=vec4(0.0);
const vec2 v=vec2(0.001,0.0);
vec3 N=normalize(vec3(-CE(ro-v.xyy)+CE(ro+v.xyy),-CE(ro-v.yxy)+CE(ro+v.yxy),-CE(ro-v.yyx)+CE(ro+v.yyx)));
mcol*=0.1666;
float refl=mcol.w;
vec3 scol=mcol.rgb*max(0.1,0.25+dot(N,L)*0.75);
float shadowConeGrad = 0.15;
scol*=FuzzyShadow(ro,L,shadowConeGrad,fragCoord);//the cone grad could be calculated for each lights position
float reflectionConeGrad = 0.09;
scol+=refl*FuzzyReflection(ro,reflect(rd,N),reflectionConeGrad,fragCoord);//each material could have a separate cone
col=mix(scol,col,clamp(t*0.05,0.0,1.0));
}
col*=1.25;
fragColor = vec4(clamp(col,0.0,1.0),1.0);
}

272
uc16-4k/mark_small.h Normal file
View File

@@ -0,0 +1,272 @@
/* File generated with Shader Minifier 1.1.1
* http://www.ctrl-alt-test.fr
*/
#ifndef MARK_SMALL_H_
# define MARK_SMALL_H_
# define U_Y "v"
char mark_fs_0[] = ""
"const int z=0x0;"
"uniform vec4 v;"
"float i,y,f,m,l=6.28319;"
"int e;"
"vec2 r;"
"vec3 x,a,s=vec3(0.),w=vec3(0.),d=vec3(3.,2.5,2.),t=vec3(.7,.6,.4);"
"vec4 b;"
"vec2 n(vec2 a,float y)"
"{"
"return cos(y)*a+sin(y)*vec2(-a.y,a.x);"
"}"
"float n(inout vec2 a,float v,float y)"
"{"
"float z=atan(a.y,a.x),m=mod(z,y)-y*.5;"
"a=length(a)*vec2(cos(m),sin(m));"
"a.x-=v;"
"return z-m;"
"}"
"void h(inout float z,float y)"
"{"
"z=mod(z-y*.5,y)-y*.5;"
"}"
"void h(inout float z,float y,float x)"
"{"
"z=max(abs(z)-x,mod(z-y*.5,y)-y*.5);"
"}"
"float p(float z,float y)"
"{"
"return floor((z-y*.5)/y);"
"}"
"float p(in vec3 z,in vec3 y,float a)"
"{"
"return length(max(abs(z)-y+vec3(a),0.))-a;"
"}"
"float c(in vec2 z,in vec2 y,float a)"
"{"
"return length(max(abs(z)-y+vec2(a),0.))-a;"
"}"
"float c(float z,float y,float x,float i)"
"{"
"return sin(z+y+i*sin(z+x));"
"}"
"float o(float y,float z,float x)"
"{"
"float a=clamp(.5+.5*(z-y)/x,0.,1.);"
"return mix(z,y,a)-x*a*(1.-a);"
"}"
"float c(vec2 z)"
"{"
"float y=dot(z,vec2(23.2,15.7));"
"return fract(sin(y)*232.45);"
"}"
"float h(vec2 y)"
"{"
"vec2 a=vec2(1.,0.),z=floor(y),v=fract(y);"
"v*=v*(3.-2.*v);"
"return-.5+mix(mix(c(z+a.yy),c(z+a.xy),v.x),mix(c(z+a.yx),c(z+a.xx),v.x),v.y);"
"}"
"float n(vec3 a)"
"{"
"a.y+=4.*c(1.1,y*3.+a.z*.02,.4,a.z*.02);"
"a.x+=4.*c(.9,y*4.+a.z*.02,-1.4,a.z*.02);"
"float z=p(a.z,24.);"
"h(a.z,24.);"
"a.xy=n(a.xy,z+c(1.1,y*4.,1.3,z*.2));"
"z=max(12.-length(a.xz),length(length(a.xy)-32.)-1.);"
"n(a.xy,32.,l/5.);"
"return min(z,max(length(a.z)-1.,length(length(a.xy)-18.)-1.));"
"}"
"float o(vec3 y)"
"{"
"if(z>7)"
"return length(y)-32.-v.w;"
"else"
" return length(y)-48.-v.w;"
"}"
"float p(vec3 a)"
"{"
"if(z>7)"
"{"
"float i=999.;"
"for(float f=0.;f<3.;++f)"
"{"
"vec3 m=a;"
"m.xy=n(m.xy,f+2.3*y);"
"m.zx=n(m.zx,2.*f+4.3*y);"
"m.z+=48.+8.*c(1.1,y*2.,.4,y*.02);"
"m.yz=n(m.yz,f+5.9*y);"
"m.xy=n(m.xy,f+2.3*y);"
"i=min(i,p(m,vec3(16.,16.,16.)+v.w,3.));"
"}"
"return max(40.-length(a),o(i,length(a)-34.,24.));"
"}"
"else"
" if(z>3)"
"{"
"float i=360.-y*222.-a.z;"
"i=8.-(i<0.?0.:.001*i*i);"
"a.y-=4.*c(1.1,y*2.+a.z*.02,.4,a.z*.02);"
"a.x-=4.*c(.9,y*2.+a.z*.02,-1.4,a.z*.02);"
"return length(a.xy)-i-v.w;"
"}"
"else"
" return a.z+=192.-96.*y,a.xy=n(a.xy,2.3*y),a.yz=n(a.yz,1.9*y),p(a,vec3(32.,32.,32.)+v.w,0.);"
"}"
"float u(vec3 a)"
"{"
"if(z>7)"
"{"
"float i=p(a,vec3(555.,555.,555.),0.),f=1.;"
"vec3 v=a;"
"for(int m=0;m<4;m++)"
"{"
"v.x+=33.;"
"v.xz=n(v.xz,1.6+.13*y);"
"v.yz=n(v.yz,.912*y);"
"float x=444./f;"
"vec3 s=abs(.33-abs(mod(v-x*.5,x)-x*.5));"
"i=max(i,111./f-min(max(s.x,s.y),min(max(s.y,s.z),max(s.z,s.x))));"
"f*=3.;"
"}"
"return i;"
"}"
"else"
" if(z>3)"
"return n(a);"
"else"
"{"
"float i=n(a.xy,64.,l/48.),f=p(a.z,6.);"
"h(a.z,12.);"
"i=c(i,y*8.,1.3,f*.2)+.8;"
"return length(a)-i;"
"}"
"}"
"float g(vec3 a)"
"{"
"return min(min(o(a),p(a)),u(a));"
"}"
"float F(vec3 a)"
"{"
"return g(a);"
"}"
"void C(vec3 a)"
"{"
"b=vec4(-1.8,3.,.6,2.);"
"float z=.1;"
"if(z>o(a))"
"z=o(a),s=vec3(250,105,0)/255,m=.6;"
"if(z>p(a))"
"z=p(a),s=vec3(105,210,231)/255,m=.6;"
"if(z>u(a))"
"s=vec3(224,228,204)/255,m=.3;"
"}"
"vec3 C(vec3 y,vec3 z,vec2 a)"
"{"
"return smoothstep(a.x,a.y,dot(vec3(.86,.5,0.),y))*z;"
"}"
"vec3 k(vec3 y)"
"{"
"vec2 a=vec2(gl_FragCoord.xy/v.y);"
"a.x-=v.z;"
"vec2 z=2*a-1;"
"float i=min(8.*abs(sin(v.x*3.1415)),1.);"
"y*=.9+.1*sin(10.*v.x+z.x*v.y);"
"y*=.9+.1*sin(10.*v.x+z.y*v.y);"
"float m=1.5-length(z*2)*.15;"
"if(a.y>=i-.02)"
"y*=.7;"
"if(a.y>=i-.04)"
"y*=.7;"
"if(a.y<=1.02-i)"
"y*=.7;"
"if(a.y<=1.04-i)"
"y*=.7;"
"return smoothstep(0.,1.,y*m*i)*2.;"
"}"
"void main()"
"{"
"y=fract(v.x);"
"f=y*y;"
"a=vec3(gl_FragCoord.xy/v.y-.5,.8);"
"a.x-=v.z;"
"vec3 l=vec3(0.,11.,-y*33.);"
"if(z<1)"
"l=vec3(-44.,-33.,99.),a.yz=n(a.yz,-y),a.xz=n(a.xz,-y);"
"else"
" if(z<2)"
"l=vec3(22.,3.,111.*(1.-y*.3)),a.xz=n(a.xz,3.);"
"else"
" if(z<3)"
"l=vec3(-44.,-33.,-99.),a.yz=n(a.yz,-y),a.xz=n(a.xz,4.5-y);"
"else"
" if(z<4)"
"l=vec3(55.,33.,-155.*(1.-y*.6)),a.yz=n(a.yz,.4),a.xz=n(a.xz,-4.5-y);"
"else"
" if(z<5)"
"l=vec3(11.,0.,-111.),a.xz=n(a.xz,3.);"
"else"
" if(z<6)"
"l=vec3(-18.,-11.,-111.*(1.-y*.3)),a.yz=n(a.yz,-y*.3),a.xz=n(a.xz,-y);"
"else"
" if(z<7)"
"l=vec3(-18.,-11.,144.*(1.-y*.3)),a.yz=n(a.yz,-y*.3),a.xz=n(a.xz,-y);"
"else"
" if(z<8)"
"l=vec3(18.,-11.,111.*(1.-y*.5)),a.yz=n(a.yz,-y*.3),a.xz=n(a.xz,-.3+y*2.);"
"else"
" if(z<9)"
"l=vec3(-55.,99.,177.),a.yz=n(a.yz,-.4),a.xz=n(a.xz,3.5*(1.-y*.3));"
"else"
" if(z<10)"
"l=vec3(-290.,153.,-70.),a.yz=n(a.yz,.4),a.xz=n(a.xz,-y);"
"else"
" if(z<11)"
"l=vec3(-66.,44.,0.),a.yz=n(a.yz,.6),a.xz=n(a.xz,4.4);"
"else"
" l=vec3(-33.,33.*(1.-y),-11.),a.yz=n(a.yz,-.5),a.xz=n(a.xz,-1.);"
"a=normalize(a);"
"x=vec3(0.,0.,0.);"
"i=1.;"
"float h=0.,u,p;"
"e=0;"
"b=vec4(-3.,8.,.9,1.);"
"vec3 c=C(a,d,b.zw);"
"while(e++<5)"
"{"
"float o=222.;"
"for(m=1.;o>=0.&&h<999.&&m>h*1e-06;h+=m,w=a*h,--o)"
"m=g(l+w);"
"if(o<=1)"
"{"
"o=0.;"
"h=999.3;"
"w=a*h;"
"break;"
"}"
"o=smoothstep(44.,1.,o);"
"vec3 Z=l+w;"
"l=Z;"
"r=vec2(.04,0.);"
"vec3 Y=vec3(F(l+r.xyy)-F(l-r.xyy),F(l+r.yxy)-F(l-r.yxy),F(l+r.yyx)-F(l-r.yyx));"
"C(l);"
"Y=normalize(Y);"
"if(h>999.)"
"{"
"if(e<2)"
"b=vec4(-3.,8.,.9,1.);"
"break;"
"}"
"a=reflect(a,Y);"
"u=8.;"
"for(p=1.;u>0.;u--)"
"p-=.5*(u-g(l+Y*u))/exp2(u);"
"s*=p;"
"s*=C(a,t,b.xy);"
"x+=i*mix(s,c,o);"
"i*=m;"
"h=.5;"
"w=a*h;"
"}"
"gl_FragColor.xyz=step(-12.,-v.x)*k(x+i*(C(a,d,b.zw)+C(a,t,b.xy)));"
"}";
#endif // MARK_SMALL_H_

1648
uc16-4k/patterns.dbg Normal file

File diff suppressed because it is too large Load Diff

163
uc16-4k/shader_code.h Normal file
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_

BIN
uc16-4k/shader_minifier.exe Normal file

Binary file not shown.

BIN
uc16-4k/song.4kp Normal file

Binary file not shown.

BIN
uc16-4k/song.it Normal file

Binary file not shown.

BIN
uc16-4k/song2.4kp Normal file

Binary file not shown.

BIN
uc16-4k/song2.it Normal file

Binary file not shown.

85
uc16-4k/synth.h Normal file
View File

@@ -0,0 +1,85 @@
#pragma once
#define WIN32_LEAN_AND_MEAN
#define WIN32_EXTRA_LEAN
#include "windows.h"
#include "mmsystem.h"
#include "mmreg.h"
#include "4klang.h"
#define USE_SOUND_THREAD
#pragma bss_seg(".synthnothing")
static float lpSoundBuffer[MAX_SAMPLES * 2];
static HWAVEOUT hWaveOut;
#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, // MAX_SAMPLES*sizeof(float)*2(stereo)
0,
0,
#ifdef WAVHDR_PREPARE_HACK
WHDR_PREPARED,
#else
0,
#endif
0,
0,
0
};
#pragma data_seg(".mmtime")
MMTIME MMTime =
{
TIME_SAMPLES,
0
};
#ifndef _DEBUG
#pragma code_seg(".initsnd")
#endif
__forceinline void InitSound()
{
#ifdef USE_SOUND_THREAD
::CreateThread(0, 0, (LPTHREAD_START_ROUTINE)_4klang_render, lpSoundBuffer, 0, 0);
#else
_4klang_render(lpSoundBuffer);
#endif
}
#ifndef _DEBUG
#pragma code_seg(".playsnd")
#endif
__forceinline void PlaySound()
{
waveOutOpen(&hWaveOut, WAVE_MAPPER, &WaveFMT, NULL, 0, CALLBACK_NULL);
#ifndef WAVHDR_PREPARE_HACK
waveOutPrepareHeader( hWaveOut, &WaveHDR, sizeof(WaveHDR) );
#endif
waveOutWrite(hWaveOut, &WaveHDR, sizeof(WaveHDR));
}
#ifndef _DEBUG
#pragma code_seg(".sample")
#endif
__forceinline void get_Sample()
{
waveOutGetPosition(hWaveOut, &MMTime, sizeof(MMTIME));
}

BIN
uc16-4k/uc16_4k.VC.db Normal file

Binary file not shown.

40
uc16-4k/uc16_4k.sln Normal file
View File

@@ -0,0 +1,40 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "intro2k15", "intro2k15.vcxproj", "{DE5F7702-06F1-44F7-8823-87A60E4990BE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Compress (Slow)|Win32 = Compress (Slow)|Win32
Compress (Slow)|x64 = Compress (Slow)|x64
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
Video|Win32 = Video|Win32
Video|x64 = Video|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DE5F7702-06F1-44F7-8823-87A60E4990BE}.Compress (Slow)|Win32.ActiveCfg = Compress (slow)|Win32
{DE5F7702-06F1-44F7-8823-87A60E4990BE}.Compress (Slow)|Win32.Build.0 = Compress (slow)|Win32
{DE5F7702-06F1-44F7-8823-87A60E4990BE}.Compress (Slow)|x64.ActiveCfg = Release|x64
{DE5F7702-06F1-44F7-8823-87A60E4990BE}.Compress (Slow)|x64.Build.0 = Release|x64
{DE5F7702-06F1-44F7-8823-87A60E4990BE}.Debug|Win32.ActiveCfg = Debug|Win32
{DE5F7702-06F1-44F7-8823-87A60E4990BE}.Debug|Win32.Build.0 = Debug|Win32
{DE5F7702-06F1-44F7-8823-87A60E4990BE}.Debug|x64.ActiveCfg = Debug|x64
{DE5F7702-06F1-44F7-8823-87A60E4990BE}.Debug|x64.Build.0 = Debug|x64
{DE5F7702-06F1-44F7-8823-87A60E4990BE}.Release|Win32.ActiveCfg = Release|Win32
{DE5F7702-06F1-44F7-8823-87A60E4990BE}.Release|Win32.Build.0 = Release|Win32
{DE5F7702-06F1-44F7-8823-87A60E4990BE}.Release|x64.ActiveCfg = Release|x64
{DE5F7702-06F1-44F7-8823-87A60E4990BE}.Release|x64.Build.0 = Release|x64
{DE5F7702-06F1-44F7-8823-87A60E4990BE}.Video|Win32.ActiveCfg = Video|Win32
{DE5F7702-06F1-44F7-8823-87A60E4990BE}.Video|Win32.Build.0 = Video|Win32
{DE5F7702-06F1-44F7-8823-87A60E4990BE}.Video|x64.ActiveCfg = Video|x64
{DE5F7702-06F1-44F7-8823-87A60E4990BE}.Video|x64.Build.0 = Video|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Binary file not shown.