port from perforce

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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,24 @@
// some useful song defines for 4klang
#define SAMPLE_RATE 44100
#define BPM 135.110291
#define MAX_INSTRUMENTS 10
#define MAX_PATTERNS 76
#define PATTERN_SIZE_SHIFT 5
#define PATTERN_SIZE (1 << PATTERN_SIZE_SHIFT)
#define MAX_TICKS (MAX_PATTERNS*PATTERN_SIZE)
#define SAMPLES_PER_TICK 4896
#define MAX_SAMPLES (SAMPLES_PER_TICK*MAX_TICKS)
#define POLYPHONY 2
#define INTEGER_16BIT
#define SAMPLE_TYPE short
#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;
extern "C" int _4klang_current_tick;

View File

@@ -0,0 +1,990 @@
%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 135.110291
%define MAX_PATTERNS 76
%define PATTERN_SIZE_SHIFT 5
%define PATTERN_SIZE (1 << PATTERN_SIZE_SHIFT)
%define MAX_TICKS (MAX_PATTERNS*PATTERN_SIZE)
%define SAMPLES_PER_TICK 2448
%define DEF_LFO_NORMALIZE 0.0000510621
%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_USE_DST
%define GO4K_USE_DLL
%define GO4K_USE_PAN
%define GO4K_USE_GLOBAL_DLL
%define GO4K_USE_FSTG
%define GO4K_USE_ENV_CHECK
%define GO4K_USE_ENV_MOD_GM
%define GO4K_USE_VCO_PHASE_OFFSET
%define GO4K_USE_VCO_SHAPE
%define GO4K_USE_VCO_MOD_PM
%define GO4K_USE_VCO_MOD_TM
%define GO4K_USE_VCO_MOD_DM
%define GO4K_USE_VCO_MOD_CM
;%define GO4K_USE_VCO_CHECK
;%define GO4K_USE_VCF_CHECK
;%define GO4K_USE_DST_CHECK
%define GO4K_USE_VCF_MOD_FM
%define GO4K_USE_VCF_MOD_RM
%define GO4K_USE_VCF_HIGH
%define GO4K_USE_VCF_BAND
%define GO4K_USE_VCF_PEAK
%define GO4K_USE_DST_SH
%define GO4K_USE_DST_MOD_DM
%define GO4K_USE_DLL_NOTE_SYNC
%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_OUT_MOD_GM
%define GO4K_USE_WAVESHAPER_CLIP
%define MAX_DELAY 65536
%define MAX_WORKSPACE_SLOTS 8
%define GO4K_BEGIN_CMDDEF(def_name)
%define GO4K_END_CMDDEF db 0
%define GO4K_BEGIN_PARAMDEF(def_name)
%define GO4K_END_PARAMDEF
GO4K_ENV_ID equ 1
%macro GO4K_ENV 5
db %1
db %2
db %3
db %4
db %5
%endmacro
%define ATTAC(val) val
%define DECAY(val) val
%define SUSTAIN(val) val
%define RELEASE(val) val
%define GAIN(val) val
struc go4kENV_val
.attac resd 1
.decay resd 1
.sustain resd 1
.release resd 1
.gain resd 1
.size
endstruc
struc go4kENV_wrk
.state resd 1
.level resd 1
.gm resd 1
.am resd 1
.dm resd 1
.sm resd 1
.rm resd 1
.size
endstruc
%define ENV_STATE_ATTAC 0
%define ENV_STATE_DECAY 1
%define ENV_STATE_SUSTAIN 2
%define ENV_STATE_RELEASE 3
%define ENV_STATE_OFF 4
GO4K_VCO_ID equ 2
%macro GO4K_VCO 8
db %1
db %2
%ifdef GO4K_USE_VCO_PHASE_OFFSET
db %3
%endif
%ifdef GO4K_USE_VCO_GATE
db %4
%endif
db %5
%ifdef GO4K_USE_VCO_SHAPE
db %6
%endif
db %7
db %8
%endmacro
%define TRANSPOSE(val) val
%define DETUNE(val) val
%define PHASE(val) val
%define GATES(val) val
%define COLOR(val) val
%define SHAPE(val) val
%define FLAGS(val) val
%define SINE 0x01
%define TRISAW 0x02
%define PULSE 0x04
%define NOISE 0x08
%define LFO 0x10
%define GATE 0x20
struc go4kVCO_val
.transpose resd 1
.detune resd 1
%ifdef GO4K_USE_VCO_PHASE_OFFSET
.phaseofs resd 1
%endif
%ifdef GO4K_USE_VCO_GATE
.gate resd 1
%endif
.color resd 1
%ifdef GO4K_USE_VCO_SHAPE
.shape resd 1
%endif
.gain resd 1
.flags resd 1
.size
endstruc
struc go4kVCO_wrk
.phase resd 1
.tm resd 1
.dm resd 1
.fm resd 1
.pm resd 1
.cm resd 1
.sm resd 1
.gm resd 1
.size
endstruc
GO4K_VCF_ID equ 3
%macro GO4K_VCF 3
db %1
db %2
db %3
%endmacro
%define LOWPASS 0x1
%define HIGHPASS 0x2
%define BANDPASS 0x4
%define BANDSTOP 0x3
%define ALLPASS 0x7
%define PEAK 0x8
%define FREQUENCY(val) val
%define RESONANCE(val) val
%define VCFTYPE(val) val
struc go4kVCF_val
.freq resd 1
.res resd 1
.type resd 1
.size
endstruc
struc go4kVCF_wrk
.low resd 1
.high resd 1
.band resd 1
.freq resd 1
.fm resd 1
.rm resd 1
.size
endstruc
GO4K_DST_ID equ 4
%macro GO4K_DST 2
db %1
%ifdef GO4K_USE_DST_SH
db %2
%endif
%endmacro
%define DRIVE(val) val
%define SNHFREQ(val) val
struc go4kDST_val
.drive resd 1
%ifdef GO4K_USE_DST_SH
.snhfreq resd 1
%endif
.size
endstruc
struc go4kDST_wrk
%ifdef GO4K_USE_DST_SH
.out resd 1
.snhphase resd 1
%endif
.dm resd 1
.sm resd 1
.size
endstruc
GO4K_DLL_ID equ 5
%macro GO4K_DLL 8
db %1
db %2
db %3
%ifdef GO4K_USE_DLL_DAMP
db %4
%endif
%ifdef GO4K_USE_DLL_CHORUS
db %5
db %6
%endif
db %7
db %8
%endmacro
%define PREGAIN(val) val
%define DRY(val) val
%define FEEDBACK(val) val
%define DEPTH(val) val
%define DAMP(val) val
%define DELAY(val) val
%define COUNT(val) val
struc go4kDLL_val
.pregain resd 1
.dry resd 1
.feedback resd 1
%ifdef GO4K_USE_DLL_DAMP
.damp resd 1
%endif
%ifdef GO4K_USE_DLL_CHORUS
.freq resd 1
.depth
%endif
.delay resd 1
.count resd 1
.size
endstruc
struc go4kDLL_wrk
.index resd 1
.store resd 1
.dcin resd 1
.dcout resd 1
%ifdef GO4K_USE_DLL_CHORUS
.phase resd 1
%endif
.buffer resd MAX_DELAY
.size
endstruc
struc go4kDLL_wrk2
.pm resd 1
.fm resd 1
.im resd 1
.dm resd 1
.sm resd 1
.am resd 1
.size
endstruc
GO4K_FOP_ID equ 6
%macro GO4K_FOP 1
db %1
%endmacro
%define OP(val) val
%define FOP_POP 0x1
%define FOP_ADDP 0x2
%define FOP_MULP 0x3
%define FOP_PUSH 0x4
%define FOP_XCH 0x5
%define FOP_ADDP2 0x6
struc go4kFOP_val
.flags resd 1
.size
endstruc
struc go4kFOP_wrk
.size
endstruc
GO4K_FST_ID equ 7
%macro GO4K_FST 2
db %1
db %2
%endmacro
%define AMOUNT(val) val
%define DEST(val) val
struc go4kFST_val
.amount resd 1
.op1 resd 1
.size
endstruc
struc go4kFST_wrk
.size
endstruc
GO4K_PAN_ID equ 8
%macro GO4K_PAN 1
%ifdef GO4K_USE_PAN
db %1
%endif
%endmacro
%define PANNING(val) val
struc go4kPAN_val
%ifdef GO4K_USE_PAN
.panning resd 1
%endif
.size
endstruc
struc go4kPAN_wrk
.pm resd 1
.size
endstruc
GO4K_OUT_ID equ 9
%macro GO4K_OUT 2
db %1
%ifdef GO4K_USE_GLOBAL_DLL
db %2
%endif
%endmacro
%define AUXSEND(val) val
struc go4kOUT_val
.gain resd 1
%ifdef GO4K_USE_GLOBAL_DLL
.auxsend resd 1
%endif
.size
endstruc
struc go4kOUT_wrk
.am resd 1
.gm resd 1
.size
endstruc
GO4K_ACC_ID equ 10
%macro GO4K_ACC 1
db %1
%endmacro
%define OUTPUT 0
%define AUX 8
%define ACCTYPE(val) val
struc go4kACC_val
.acctype resd 1
.size
endstruc
struc go4kACC_wrk
.size
endstruc
%ifdef GO4K_USE_FLD
GO4K_FLD_ID equ 11
%macro GO4K_FLD 1
db
%endmacro
%define VALUE(val) val
struc go4kFLD_val
.value resd 1
.size
endstruc
struc go4kFLD_wrk
.vm resd 1
.size
endstruc
%endif
%ifdef GO4K_USE_FSTG
GO4K_FSTG_ID equ 12
%macro GO4K_FSTG 2
db %1
dd %2
%endmacro
struc go4kFSTG_val
.amount resd 1
.op1 resd 1
.size
endstruc
struc go4kFSTG_wrk
.size
endstruc
%endif
struc go4k_instrument
.release resd 1
.note resd 1
.workspace resd 256
.dlloutl resd 1
.dlloutr resd 1
.outl resd 1
.outr resd 1
.size
endstruc
struc go4k_synth
.instruments resb go4k_instrument.size * MAX_INSTRUMENTS * MAX_VOICES
.global resb go4k_instrument.size * MAX_VOICES
.size
endstruc
%ifdef USE_SECTIONS
section .g4kmuc1 data align=1
%else
section .data align=1
%endif
go4k_patterns
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
db 44, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 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, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 49, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 53, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 46, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 48, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 56, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 82, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 80, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 84, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 72, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 68, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 65, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 77, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 63, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 63, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, HLD, HLD, HLD, 56, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0,
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 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, 0, 0, 56, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 56, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 87, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 84, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 87, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 84, HLD, HLD, HLD, 89, HLD, HLD, HLD,
db 89, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 84, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 89, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 84, HLD, HLD, HLD, 91, HLD, HLD, HLD,
db 86, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 82, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 86, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 82, HLD, HLD, HLD, 87, HLD, HLD, HLD,
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 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, 70, HLD, 71, HLD, 72, HLD, HLD, HLD, 75, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0,
db 77, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 76, HLD,
db 75, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 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, 0, 82, 84, HLD, HLD, HLD, 87, HLD, HLD, HLD, 0, 0, 0, 0, 0, 82, 84, HLD,
db HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 77, HLD, HLD, HLD,
db 80, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 79, HLD, 77, HLD,
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 76, 77, HLD, HLD, HLD, 79, HLD, HLD, HLD, 0, 0, 0, 0, 0, 79, 80, HLD,
db HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, HLD, HLD, HLD,
db 80, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, HLD, 79, HLD,
db 77, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 72, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 74, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 80, HLD, 82, HLD, HLD, HLD, 0, 0, 0, 0, 80, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 79, HLD, HLD, HLD, 77, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0,
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, HLD, HLD, HLD, 79, HLD, HLD, HLD, 80, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0,
db 0, 0, 0, 0, 0, 0, 0, 0, 84, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 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, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 87, HLD, HLD, HLD,
db 89, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, HLD, 87, HLD,
db 84, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0, 89, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 91, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 92, HLD, 94, HLD, HLD, HLD, 0, 0, 0, 0, 92, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 91, HLD, HLD, HLD, 89, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0,
db 0, 0, 0, 0, 0, 0, 0, 0, 84, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 82, HLD, HLD, HLD,
db 84, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 89, HLD, 87, HLD, 84, HLD,
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, 79, HLD,
db 77, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 76, HLD, HLD, HLD,
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 70, HLD, 71, HLD, 72, HLD, HLD, HLD, 75, 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, 0, 0, 0, 0, 0, 0, 0, 0, 79, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 77, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 82, 84, HLD, HLD, HLD, 87, HLD, HLD, HLD, 0, 0, 0, 0, 0, 82, 84, HLD,
db 75, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 70, HLD, 68, HLD,
db 86, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 87, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
db 60, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 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 0, 0, 0, 0, 1, 2, 2, 2, 3, 2, 2, 2, 1, 2, 2, 2, 3, 2, 2, 2, 1, 2, 2, 2, 3, 2, 2, 2, 1, 2, 2, 2, 3, 2, 2, 2, 4, 2, 2, 2, 5, 2, 2, 2, 4, 2, 2, 2, 5, 2, 2, 2, 3, 2, 2, 2, 6, 2, 2, 2, 3, 2, 2, 2, 7, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0,
Instrument1List db 0, 0, 0, 0, 8, 2, 9, 2, 2, 2, 2, 2, 8, 2, 10, 2, 2, 2, 2, 2, 8, 2, 9, 2, 2, 2, 2, 2, 8, 2, 10, 2, 2, 2, 2, 2, 10, 2, 9, 2, 2, 2, 2, 2, 10, 2, 9, 2, 2, 2, 2, 2, 8, 2, 2, 2, 11, 2, 2, 2, 8, 2, 2, 2, 8, 2, 2, 2, 7, 2, 0, 0, 0, 0, 0, 0,
Instrument2List db 11, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0,
Instrument3List db 0, 0, 0, 0, 12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 13, 2, 2, 2, 14, 2, 2, 2, 13, 2, 2, 2, 14, 2, 2, 2, 12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0,
Instrument4List db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 16, 17, 16, 17, 16, 17, 16, 17, 16, 17, 16, 17, 16, 17, 16, 17, 16, 17, 16, 17, 16, 17, 16, 17, 16, 17, 16, 17, 16, 17, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Instrument5List db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, 19, 18, 19, 18, 19, 18, 19, 18, 19, 18, 19, 18, 19, 18, 20, 18, 19, 18, 19, 18, 19, 18, 19, 18, 19, 18, 19, 18, 19, 18, 19, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0,
Instrument6List db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 22, 22, 22, 22, 23, 23, 23, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Instrument7List db 0, 0, 0, 0, 0, 0, 0, 0, 24, 25, 26, 27, 2, 2, 0, 0, 28, 29, 30, 27, 2, 2, 0, 0, 24, 25, 26, 27, 2, 2, 0, 0, 28, 29, 30, 27, 31, 32, 33, 34, 35, 36, 37, 38, 31, 39, 40, 41, 42, 43, 37, 44, 45, 46, 47, 27, 0, 48, 26, 49, 50, 29, 30, 27, 0, 48, 26, 51, 0, 0, 0, 0, 0, 0, 0, 0,
Instrument8List db 0, 0, 0, 0, 10, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, 2, 2, 2, 52, 2, 2, 2, 9, 2, 2, 2, 52, 2, 2, 2, 10, 2, 2, 2, 53, 2, 2, 2, 10, 2, 2, 2, 10, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0,
Instrument9List db 54, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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_DST_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_FST_ID
db GO4K_FST_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_VCF_ID
db GO4K_VCO_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_DLL_ID
db GO4K_VCF_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_FST_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_FST_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_FST_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_DST_ID
db GO4K_FOP_ID
db GO4K_DLL_ID
db GO4K_VCF_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_FST_ID
db GO4K_FST_ID
db GO4K_FST_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_VCF_ID
db GO4K_VCF_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_PAN_ID
db GO4K_OUT_ID
GO4K_END_CMDDEF
GO4K_BEGIN_CMDDEF(Instrument3)
db GO4K_ENV_ID
db GO4K_FST_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_FST_ID
db GO4K_FST_ID
db GO4K_FST_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_VCF_ID
db GO4K_DST_ID
db GO4K_VCF_ID
db GO4K_VCF_ID
db GO4K_PAN_ID
db GO4K_DLL_ID
db GO4K_FOP_ID
db GO4K_DLL_ID
db GO4K_VCF_ID
db GO4K_OUT_ID
GO4K_END_CMDDEF
GO4K_BEGIN_CMDDEF(Instrument4)
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_ENV_ID
db GO4K_FOP_ID
db GO4K_ENV_ID
db GO4K_FSTG_ID
db GO4K_FOP_ID
db GO4K_PAN_ID
db GO4K_OUT_ID
GO4K_END_CMDDEF
GO4K_BEGIN_CMDDEF(Instrument5)
db GO4K_ENV_ID
db GO4K_FST_ID
db GO4K_ENV_ID
db GO4K_FST_ID
db GO4K_FST_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_VCF_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_PAN_ID
db GO4K_OUT_ID
GO4K_END_CMDDEF
GO4K_BEGIN_CMDDEF(Instrument6)
db GO4K_ENV_ID
db GO4K_FST_ID
db GO4K_DST_ID
db GO4K_VCO_ID
db GO4K_DST_ID
db GO4K_FST_ID
db GO4K_FOP_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_DLL_ID
db GO4K_PAN_ID
db GO4K_DLL_ID
db GO4K_FOP_ID
db GO4K_DLL_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_FST_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_VCO_ID
db GO4K_FST_ID
db GO4K_FST_ID
db GO4K_FST_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_FOP_ID
db GO4K_VCF_ID
db GO4K_VCF_ID
db GO4K_DST_ID
db GO4K_VCF_ID
db GO4K_VCF_ID
db GO4K_PAN_ID
db GO4K_DLL_ID
db GO4K_FOP_ID
db GO4K_DLL_ID
db GO4K_OUT_ID
GO4K_END_CMDDEF
GO4K_BEGIN_CMDDEF(Instrument9)
db GO4K_ENV_ID
db GO4K_FSTG_ID
db GO4K_FSTG_ID
db GO4K_FSTG_ID
db GO4K_FSTG_ID
db GO4K_FSTG_ID
db GO4K_FSTG_ID
db GO4K_FSTG_ID
db GO4K_FSTG_ID
db GO4K_FSTG_ID
db GO4K_FOP_ID
GO4K_END_CMDDEF
GO4K_BEGIN_CMDDEF(Global)
db GO4K_ACC_ID
db GO4K_DLL_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_DLL_ID
db GO4K_VCF_ID
db GO4K_FOP_ID
db GO4K_ACC_ID
db GO4K_FOP_ID
db GO4K_OUT_ID
GO4K_END_CMDDEF
go4k_synth_instructions_end
%ifdef USE_SECTIONS
section .g4kmuc4 data align=1
%else
section .data
%endif
go4k_synth_parameter_values
GO4K_BEGIN_PARAMDEF(Instrument0)
GO4K_ENV ATTAC(80),DECAY(80),SUSTAIN(64),RELEASE(80),GAIN(128)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(64),GAIN(64),FLAGS(NOISE)
GO4K_DST DRIVE(64), SNHFREQ(0)
GO4K_VCO TRANSPOSE(16),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(64),GAIN(128),FLAGS(TRISAW|LFO)
GO4K_FOP OP(FOP_ADDP)
GO4K_FST AMOUNT(72),DEST(10*MAX_WORKSPACE_SLOTS+5)
GO4K_FST AMOUNT(58),DEST(13*MAX_WORKSPACE_SLOTS+5)
GO4K_FOP OP(FOP_POP)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(64),GAIN(128),FLAGS(SINE)
GO4K_VCO TRANSPOSE(64),DETUNE(65),PHASE(0),GATES(0),COLOR(16),SHAPE(112),GAIN(128),FLAGS(TRISAW)
GO4K_VCO TRANSPOSE(64),DETUNE(63),PHASE(0),GATES(85),COLOR(96),SHAPE(64),GAIN(128),FLAGS(PULSE)
GO4K_VCF FREQUENCY(48),RESONANCE(48),VCFTYPE(LOWPASS)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(64),GATES(85),COLOR(64),SHAPE(64),GAIN(8),FLAGS(NOISE)
GO4K_VCF FREQUENCY(64),RESONANCE(24),VCFTYPE(BANDPASS)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_PUSH)
GO4K_VCF FREQUENCY(32),RESONANCE(128),VCFTYPE(LOWPASS)
GO4K_FOP OP(FOP_XCH)
GO4K_VCF FREQUENCY(96),RESONANCE(128),VCFTYPE(BANDPASS)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_PUSH)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(64),GAIN(16),FLAGS(NOISE)
GO4K_FOP OP(FOP_MULP)
GO4K_VCF FREQUENCY(64),RESONANCE(64),VCFTYPE(LOWPASS)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_MULP)
GO4K_DLL PREGAIN(64),DRY(128),FEEDBACK(64),DAMP(64),FREQUENCY(0),DEPTH(0),DELAY(17),COUNT(1)
GO4K_VCF FREQUENCY(0),RESONANCE(64),VCFTYPE(LOWPASS)
GO4K_PAN PANNING(64)
GO4K_OUT GAIN(0), AUXSEND(64)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument1)
GO4K_ENV ATTAC(80),DECAY(64),SUSTAIN(96),RELEASE(80),GAIN(128)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(64),GATES(85),COLOR(64),SHAPE(64),GAIN(128),FLAGS(NOISE)
GO4K_FST AMOUNT(128),DEST(7*MAX_WORKSPACE_SLOTS+4)
GO4K_FOP OP(FOP_POP)
GO4K_VCO TRANSPOSE(32),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(64),GAIN(128),FLAGS(TRISAW|LFO)
GO4K_FST AMOUNT(88),DEST(17*MAX_WORKSPACE_SLOTS+2)
GO4K_FOP OP(FOP_POP)
GO4K_VCO TRANSPOSE(12),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(64),GAIN(128),FLAGS(TRISAW|LFO)
GO4K_FST AMOUNT(128),DEST(11*MAX_WORKSPACE_SLOTS+2)
GO4K_FOP OP(FOP_POP)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(64),GATES(85),COLOR(64),SHAPE(64),GAIN(128),FLAGS(SINE)
GO4K_VCO TRANSPOSE(64),DETUNE(68),PHASE(64),GATES(85),COLOR(64),SHAPE(32),GAIN(128),FLAGS(SINE)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(64),GATES(85),COLOR(64),SHAPE(64),GAIN(8),FLAGS(NOISE)
GO4K_VCF FREQUENCY(64),RESONANCE(64),VCFTYPE(LOWPASS)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_ADDP)
GO4K_VCF FREQUENCY(48),RESONANCE(8),VCFTYPE(LOWPASS)
GO4K_DST DRIVE(64), SNHFREQ(128)
GO4K_FOP OP(FOP_MULP)
GO4K_DLL PREGAIN(64),DRY(128),FEEDBACK(64),DAMP(64),FREQUENCY(0),DEPTH(0),DELAY(17),COUNT(1)
GO4K_VCF FREQUENCY(0),RESONANCE(64),VCFTYPE(LOWPASS)
GO4K_PAN PANNING(80)
GO4K_OUT GAIN(0), AUXSEND(64)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument2)
GO4K_ENV ATTAC(96),DECAY(96),SUSTAIN(96),RELEASE(96),GAIN(96)
GO4K_VCO TRANSPOSE(16),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(64),GAIN(64),FLAGS(SINE|LFO)
GO4K_FST AMOUNT(68),DEST(7*MAX_WORKSPACE_SLOTS+4)
GO4K_FST AMOUNT(66),DEST(8*MAX_WORKSPACE_SLOTS+4)
GO4K_FST AMOUNT(65),DEST(9*MAX_WORKSPACE_SLOTS+4)
GO4K_FOP OP(FOP_POP)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(64),GAIN(128),FLAGS(NOISE)
GO4K_VCF FREQUENCY(64),RESONANCE(16),VCFTYPE(LOWPASS)
GO4K_VCF FREQUENCY(96),RESONANCE(16),VCFTYPE(BANDSTOP)
GO4K_VCF FREQUENCY(32),RESONANCE(16),VCFTYPE(HIGHPASS)
GO4K_FOP OP(FOP_MULP)
GO4K_PAN PANNING(64)
GO4K_OUT GAIN(0), AUXSEND(48)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument3)
GO4K_ENV ATTAC(72),DECAY(80),SUSTAIN(80),RELEASE(80),GAIN(128)
GO4K_FST AMOUNT(64),DEST(0*MAX_WORKSPACE_SLOTS+2)
GO4K_VCO TRANSPOSE(64),DETUNE(62),PHASE(32),GATES(85),COLOR(80),SHAPE(96),GAIN(128),FLAGS(TRISAW)
GO4K_VCO TRANSPOSE(52),DETUNE(66),PHASE(32),GATES(85),COLOR(48),SHAPE(64),GAIN(64),FLAGS(PULSE)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(96),SHAPE(16),GAIN(128),FLAGS(TRISAW)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(96),GAIN(128),FLAGS(SINE|LFO)
GO4K_FST AMOUNT(66),DEST(2*MAX_WORKSPACE_SLOTS+2)
GO4K_FST AMOUNT(60),DEST(3*MAX_WORKSPACE_SLOTS+2)
GO4K_FST AMOUNT(65),DEST(4*MAX_WORKSPACE_SLOTS+2)
GO4K_FOP OP(FOP_POP)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_MULP)
GO4K_VCF FREQUENCY(32),RESONANCE(128),VCFTYPE(PEAK)
GO4K_VCF FREQUENCY(96),RESONANCE(64),VCFTYPE(LOWPASS)
GO4K_DST DRIVE(112), SNHFREQ(128)
GO4K_VCF FREQUENCY(128),RESONANCE(16),VCFTYPE(BANDSTOP)
GO4K_VCF FREQUENCY(0),RESONANCE(64),VCFTYPE(LOWPASS)
GO4K_PAN PANNING(80)
GO4K_DLL PREGAIN(96),DRY(128),FEEDBACK(96),DAMP(64),FREQUENCY(0),DEPTH(0),DELAY(18),COUNT(1)
GO4K_FOP OP(FOP_XCH)
GO4K_DLL PREGAIN(96),DRY(128),FEEDBACK(64),DAMP(64),FREQUENCY(0),DEPTH(0),DELAY(17),COUNT(1)
GO4K_VCF FREQUENCY(24),RESONANCE(64),VCFTYPE(BANDSTOP)
GO4K_OUT GAIN(0), AUXSEND(24)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument4)
GO4K_ENV ATTAC(0),DECAY(24),SUSTAIN(96),RELEASE(0),GAIN(128)
GO4K_FST AMOUNT(128),DEST(0*MAX_WORKSPACE_SLOTS+2)
GO4K_ENV ATTAC(0),DECAY(72),SUSTAIN(0),RELEASE(64),GAIN(128)
GO4K_DST DRIVE(32), SNHFREQ(128)
GO4K_FST AMOUNT(80),DEST(6*MAX_WORKSPACE_SLOTS+1)
GO4K_FOP OP(FOP_POP)
GO4K_VCO TRANSPOSE(44),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(66),GAIN(128),FLAGS(SINE)
GO4K_FOP OP(FOP_MULP)
GO4K_ENV ATTAC(16),DECAY(80),SUSTAIN(0),RELEASE(0),GAIN(128)
GO4K_FOP OP(FOP_MULP)
GO4K_ENV ATTAC(16),DECAY(64),SUSTAIN(0),RELEASE(64),GAIN(128)
GO4K_FSTG AMOUNT(0),DEST(0*go4k_instrument.size*MAX_VOICES+0*MAX_WORKSPACE_SLOTS*4+2*4+go4k_instrument.workspace)
GO4K_FOP OP(FOP_POP)
GO4K_PAN PANNING(48)
GO4K_OUT GAIN(64), AUXSEND(16)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument5)
GO4K_ENV ATTAC(32),DECAY(76),SUSTAIN(0),RELEASE(88),GAIN(128)
GO4K_FST AMOUNT(124),DEST(0*MAX_WORKSPACE_SLOTS+2)
GO4K_ENV ATTAC(48),DECAY(48),SUSTAIN(0),RELEASE(0),GAIN(128)
GO4K_FST AMOUNT(68),DEST(8*MAX_WORKSPACE_SLOTS+1)
GO4K_FST AMOUNT(66),DEST(9*MAX_WORKSPACE_SLOTS+1)
GO4K_FOP OP(FOP_POP)
GO4K_VCO TRANSPOSE(63),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(32),GAIN(64),FLAGS(NOISE)
GO4K_VCF FREQUENCY(112),RESONANCE(128),VCFTYPE(LOWPASS)
GO4K_VCO TRANSPOSE(76),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(96),GAIN(16),FLAGS(TRISAW)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(96),GAIN(64),FLAGS(TRISAW)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_MULP)
GO4K_VCF FREQUENCY(20),RESONANCE(32),VCFTYPE(HIGHPASS)
GO4K_PAN PANNING(60)
GO4K_OUT GAIN(32), AUXSEND(16)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument6)
GO4K_ENV ATTAC(0),DECAY(72),SUSTAIN(0),RELEASE(16),GAIN(128)
GO4K_FST AMOUNT(88),DEST(10*MAX_WORKSPACE_SLOTS+4)
GO4K_DST DRIVE(16), SNHFREQ(128)
GO4K_VCO TRANSPOSE(8),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(64),GAIN(128),FLAGS(NOISE)
GO4K_DST DRIVE(64), SNHFREQ(0)
GO4K_FST AMOUNT(76),DEST(11*MAX_WORKSPACE_SLOTS+4)
GO4K_FOP OP(FOP_POP)
GO4K_VCO TRANSPOSE(64),DETUNE(62),PHASE(0),GATES(85),COLOR(64),SHAPE(64),GAIN(128),FLAGS(PULSE)
GO4K_VCO TRANSPOSE(64),DETUNE(74),PHASE(0),GATES(85),COLOR(16),SHAPE(64),GAIN(128),FLAGS(PULSE)
GO4K_FOP OP(FOP_ADDP)
GO4K_VCF FREQUENCY(48),RESONANCE(128),VCFTYPE(LOWPASS)
GO4K_VCF FREQUENCY(48),RESONANCE(64),VCFTYPE(LOWPASS)
GO4K_FOP OP(FOP_MULP)
GO4K_DLL PREGAIN(72),DRY(128),FEEDBACK(64),DAMP(32),FREQUENCY(0),DEPTH(0),DELAY(19),COUNT(1)
GO4K_PAN PANNING(56)
GO4K_DLL PREGAIN(32),DRY(128),FEEDBACK(112),DAMP(96),FREQUENCY(0),DEPTH(0),DELAY(9),COUNT(8)
GO4K_FOP OP(FOP_XCH)
GO4K_DLL PREGAIN(32),DRY(128),FEEDBACK(112),DAMP(96),FREQUENCY(0),DEPTH(0),DELAY(1),COUNT(8)
GO4K_OUT GAIN(48), AUXSEND(32)
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(76),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(64),GAIN(128),FLAGS(SINE|LFO)
GO4K_FOP OP(FOP_MULP)
GO4K_FST AMOUNT(68),DEST(7*MAX_WORKSPACE_SLOTS+1)
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)
GO4K_ENV ATTAC(80),DECAY(128),SUSTAIN(128),RELEASE(0),GAIN(128)
GO4K_VCO TRANSPOSE(80),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(64),GAIN(64),FLAGS(SINE|LFO)
GO4K_FOP OP(FOP_MULP)
GO4K_FST AMOUNT(76),DEST(29*MAX_WORKSPACE_SLOTS+1)
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(96),DRY(128),FEEDBACK(64),DAMP(64),FREQUENCY(0),DEPTH(0),DELAY(17),COUNT(1)
GO4K_PAN PANNING(64)
GO4K_OUT GAIN(24), AUXSEND(48)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument8)
GO4K_ENV ATTAC(72),DECAY(80),SUSTAIN(80),RELEASE(80),GAIN(128)
GO4K_FST AMOUNT(64),DEST(0*MAX_WORKSPACE_SLOTS+2)
GO4K_VCO TRANSPOSE(64),DETUNE(62),PHASE(32),GATES(85),COLOR(80),SHAPE(96),GAIN(128),FLAGS(TRISAW)
GO4K_VCO TRANSPOSE(52),DETUNE(66),PHASE(32),GATES(85),COLOR(48),SHAPE(64),GAIN(64),FLAGS(PULSE)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(96),SHAPE(16),GAIN(128),FLAGS(TRISAW)
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(96),GAIN(128),FLAGS(SINE|LFO)
GO4K_FST AMOUNT(66),DEST(2*MAX_WORKSPACE_SLOTS+2)
GO4K_FST AMOUNT(60),DEST(3*MAX_WORKSPACE_SLOTS+2)
GO4K_FST AMOUNT(65),DEST(4*MAX_WORKSPACE_SLOTS+2)
GO4K_FOP OP(FOP_POP)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_ADDP)
GO4K_FOP OP(FOP_MULP)
GO4K_VCF FREQUENCY(32),RESONANCE(128),VCFTYPE(PEAK)
GO4K_VCF FREQUENCY(96),RESONANCE(64),VCFTYPE(LOWPASS)
GO4K_DST DRIVE(112), SNHFREQ(128)
GO4K_VCF FREQUENCY(128),RESONANCE(16),VCFTYPE(BANDSTOP)
GO4K_VCF FREQUENCY(0),RESONANCE(64),VCFTYPE(LOWPASS)
GO4K_PAN PANNING(48)
GO4K_DLL PREGAIN(96),DRY(128),FEEDBACK(96),DAMP(64),FREQUENCY(0),DEPTH(0),DELAY(18),COUNT(1)
GO4K_FOP OP(FOP_XCH)
GO4K_DLL PREGAIN(96),DRY(128),FEEDBACK(64),DAMP(64),FREQUENCY(0),DEPTH(0),DELAY(17),COUNT(1)
GO4K_OUT GAIN(0), AUXSEND(16)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Instrument9)
GO4K_ENV ATTAC(112),DECAY(0),SUSTAIN(128),RELEASE(104),GAIN(128)
GO4K_FSTG AMOUNT(128),DEST(0*go4k_instrument.size*MAX_VOICES+29*MAX_WORKSPACE_SLOTS*4+4*4+go4k_instrument.workspace)
GO4K_FSTG AMOUNT(128),DEST(0*go4k_instrument.size*MAX_VOICES+31*MAX_WORKSPACE_SLOTS*4+1*4+go4k_instrument.workspace)
GO4K_FSTG AMOUNT(128),DEST(1*go4k_instrument.size*MAX_VOICES+20*MAX_WORKSPACE_SLOTS*4+4*4+go4k_instrument.workspace)
GO4K_FSTG AMOUNT(76),DEST(1*go4k_instrument.size*MAX_VOICES+22*MAX_WORKSPACE_SLOTS*4+1*4+go4k_instrument.workspace)
GO4K_FSTG AMOUNT(128),DEST(3*go4k_instrument.size*MAX_VOICES+17*MAX_WORKSPACE_SLOTS*4+4*4+go4k_instrument.workspace)
GO4K_FSTG AMOUNT(66),DEST(3*go4k_instrument.size*MAX_VOICES+23*MAX_WORKSPACE_SLOTS*4+1*4+go4k_instrument.workspace)
GO4K_FSTG AMOUNT(128),DEST(8*go4k_instrument.size*MAX_VOICES+17*MAX_WORKSPACE_SLOTS*4+4*4+go4k_instrument.workspace)
GO4K_FSTG AMOUNT(66),DEST(8*go4k_instrument.size*MAX_VOICES+22*MAX_WORKSPACE_SLOTS*4+1*4+go4k_instrument.workspace)
GO4K_FSTG AMOUNT(88),DEST(7*go4k_instrument.size*MAX_VOICES+29*MAX_WORKSPACE_SLOTS*4+1*4+go4k_instrument.workspace)
GO4K_FOP OP(FOP_POP)
GO4K_END_PARAMDEF
GO4K_BEGIN_PARAMDEF(Global)
GO4K_ACC ACCTYPE(AUX)
GO4K_DLL PREGAIN(64),DRY(96),FEEDBACK(120),DAMP(96),FREQUENCY(0),DEPTH(0),DELAY(1),COUNT(8)
GO4K_VCF FREQUENCY(16),RESONANCE(128),VCFTYPE(HIGHPASS)
GO4K_FOP OP(FOP_XCH)
GO4K_DLL PREGAIN(64),DRY(96),FEEDBACK(120),DAMP(96),FREQUENCY(0),DEPTH(0),DELAY(9),COUNT(8)
GO4K_VCF FREQUENCY(16),RESONANCE(128),VCFTYPE(HIGHPASS)
GO4K_FOP OP(FOP_XCH)
GO4K_ACC ACCTYPE(OUTPUT)
GO4K_FOP OP(FOP_ADDP2)
GO4K_OUT GAIN(16), 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 19584
dw 9792
dw 13056
%endif

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,14 @@
Build started 09.08.2014 09:32:14.
1>Project "E:\blu-flame.org\hgplus\bliss\Engine\Engine.vcxproj" on node 2 (Build target(s)).
1>CustomBuild:
Minifying shader...
"Not happening, CompressFast."
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\CL.exe /c /nologo /W3 /WX- /O1 /Oi /Os /Oy /D WIN32 /D NDEBUG /D COMPRESS /D _WINDOWS /Gm- /MD /GS- /arch:IA32 /fp:fast /Zc:wchar_t /Zc:forScope /Fo"CompressFast\\" /Fd"CompressFast\vc120.pdb" /Gd /TP /analyze- /errorReport:prompt main.small.cpp
main.small.cpp
1>main.small.cpp(642): error C2065: 'dmScreenSettings' : undeclared identifier
1>Done Building Project "E:\blu-flame.org\hgplus\bliss\Engine\Engine.vcxproj" (Build target(s)) -- FAILED.
Build FAILED.
Time Elapsed 00:00:00.44

View File

@@ -0,0 +1,2 @@
#TargetFrameworkVersion=v4.0:PlatformToolSet=v120:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit
CompressFast|Win32|E:\blu-flame.org\hgplus\bliss\|

View File

@@ -0,0 +1,37 @@
main.cpp
e:\blu-flame.org\hgplus\bliss\engine\analysis.h(102): warning C4244: 'initializing' : conversion from 'float' to 'int', possible loss of data
e:\blu-flame.org\hgplus\bliss\engine\analysis.h(103): warning C4244: 'initializing' : conversion from 'float' to 'int', possible loss of data
e:\blu-flame.org\hgplus\bliss\engine\analysis.h(129): warning C4244: '=' : conversion from 'unsigned int' to 'float', possible loss of data
e:\blu-flame.org\hgplus\bliss\engine\analysis.h(131): warning C4244: '=' : conversion from 'unsigned int' to 'float', possible loss of data
e:\blu-flame.org\hgplus\bliss\engine\analysis.h(133): warning C4244: '=' : conversion from 'unsigned int' to 'float', possible loss of data
e:\blu-flame.org\hgplus\bliss\engine\analysis.h(138): warning C4244: '=' : conversion from 'unsigned int' to 'float', possible loss of data
e:\blu-flame.org\hgplus\bliss\engine\analysis.h(140): warning C4244: '=' : conversion from 'unsigned int' to 'float', possible loss of data
e:\blu-flame.org\hgplus\bliss\engine\analysis.h(142): warning C4244: '=' : conversion from 'unsigned int' to 'float', possible loss of data
e:\blu-flame.org\hgplus\bliss\engine\analysis.h(144): warning C4244: '=' : conversion from 'unsigned int' to 'float', possible loss of data
e:\blu-flame.org\hgplus\bliss\engine\analysis.h(150): warning C4244: '=' : conversion from 'unsigned int' to 'float', possible loss of data
e:\blu-flame.org\hgplus\bliss\engine\analysis.h(168): warning C4244: 'argument' : conversion from 'unsigned int' to 'float', possible loss of data
e:\blu-flame.org\hgplus\bliss\engine\analysis.h(169): warning C4244: 'argument' : conversion from 'unsigned int' to 'float', possible loss of data
e:\blu-flame.org\hgplus\bliss\engine\analysis.h(170): warning C4244: 'argument' : conversion from 'unsigned int' to 'float', possible loss of data
e:\blu-flame.org\hgplus\bliss\engine\analysis.h(225): warning C4244: 'argument' : conversion from 'unsigned int' to 'float', possible loss of data
e:\blu-flame.org\hgplus\bliss\engine\analysis.h(226): warning C4244: 'argument' : conversion from 'unsigned int' to 'float', possible loss of data
e:\blu-flame.org\hgplus\bliss\engine\analysis.h(227): warning C4244: 'argument' : conversion from 'unsigned int' to 'float', possible loss of data
e:\blu-flame.org\hgplus\bliss\engine\analysis.h(228): warning C4244: 'argument' : conversion from 'unsigned int' to 'float', possible loss of data
e:\blu-flame.org\hgplus\bliss\engine\analysis.h(245): warning C4244: 'argument' : conversion from 'unsigned int' to 'float', possible loss of data
e:\blu-flame.org\hgplus\bliss\engine\analysis.h(256): warning C4244: 'initializing' : conversion from 'float' to 'int', possible loss of data
e:\blu-flame.org\hgplus\bliss\engine\analysis.h(257): warning C4244: 'initializing' : conversion from 'float' to 'int', possible loss of data
e:\blu-flame.org\hgplus\bliss\engine\analysis.h(258): warning C4244: 'initializing' : conversion from 'float' to 'int', possible loss of data
e:\blu-flame.org\hgplus\bliss\engine\timeline.h(86): warning C4244: 'initializing' : conversion from 'float' to 'int', possible loss of data
e:\blu-flame.org\hgplus\bliss\engine\timeline.h(105): warning C4244: '=' : conversion from 'float' to 'int', possible loss of data
e:\blu-flame.org\hgplus\bliss\engine\main.cpp(691): warning C4800: 'SHORT' : forcing value to bool 'true' or 'false' (performance warning)
e:\blu-flame.org\hgplus\bliss\engine\main.cpp(692): warning C4800: 'SHORT' : forcing value to bool 'true' or 'false' (performance warning)
e:\blu-flame.org\hgplus\bliss\engine\main.cpp(693): warning C4800: 'SHORT' : forcing value to bool 'true' or 'false' (performance warning)
e:\blu-flame.org\hgplus\bliss\engine\main.cpp(694): warning C4800: 'SHORT' : forcing value to bool 'true' or 'false' (performance warning)
e:\blu-flame.org\hgplus\bliss\engine\main.cpp(695): warning C4800: 'SHORT' : forcing value to bool 'true' or 'false' (performance warning)
e:\blu-flame.org\hgplus\bliss\engine\main.cpp(696): warning C4800: 'SHORT' : forcing value to bool 'true' or 'false' (performance warning)
e:\blu-flame.org\hgplus\bliss\engine\main.cpp(697): warning C4800: 'SHORT' : forcing value to bool 'true' or 'false' (performance warning)
Crinkler 1.4 (Jan 19 2013) (c) 2005-2013 Aske Simon Christensen & Rune Stubbe
Launching default linker at 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\VC\BIN\LINK.EXE'
E:\blu-flame.org\hgplus\bliss\Debug\Engine.exe : warning LNK4072: section count 114 exceeds max (96); image may not run
Engine.vcxproj -> E:\blu-flame.org\hgplus\bliss\Debug\Engine.exe

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,2 @@
#TargetFrameworkVersion=v4.0:PlatformToolSet=v120:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit
Debug|Win32|E:\blu-flame.org\hgplus\bliss\|

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,343 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="CompressFast|Win32">
<Configuration>CompressFast</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Compress|Win32">
<Configuration>Compress</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="DebugShader|Win32">
<Configuration>DebugShader</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Video|Win32">
<Configuration>Video</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='CompressFast|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="main.small.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugShader|Win32'">true</ExcludedFromBuild>
</ClCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="Shader.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">Vertex</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='DebugShader|Win32'">Vertex</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">Vertex</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='CompressFast|Win32'">Vertex</ShaderType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)shaders.cmd $(Configuration) %(FullPath) $(SolutionDir)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">$(ProjectDir)shaders.cmd $(Configuration) %(FullPath) $(SolutionDir)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='DebugShader|Win32'">$(ProjectDir)shaders.cmd $(Configuration) %(FullPath) $(SolutionDir)</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compiling shaders...</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">Compiling shaders...</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='DebugShader|Win32'">Compiling shaders...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)Shader.h</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">$(ProjectDir)Shader.h</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='DebugShader|Win32'">$(ProjectDir)Shader.h</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</AdditionalInputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">
</AdditionalInputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='DebugShader|Win32'">
</AdditionalInputs>
<LinkObjects Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkObjects>
<LinkObjects Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">false</LinkObjects>
<LinkObjects Condition="'$(Configuration)|$(Platform)'=='DebugShader|Win32'">false</LinkObjects>
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)shaders.cmd $(Configuration) %(FullPath) $(SolutionDir)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">$(ProjectDir)shaders.cmd $(Configuration) %(FullPath) $(SolutionDir)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='CompressFast|Win32'">$(ProjectDir)shaders.cmd $(Configuration) %(FullPath) $(SolutionDir)</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Minifying shader...</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">Minifying shader...</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='CompressFast|Win32'">Minifying shader...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)Shader.h</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">$(ProjectDir)Shader.h</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='CompressFast|Win32'">$(ProjectDir)Shader.h</Outputs>
<LinkObjects Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkObjects>
<LinkObjects Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">false</LinkObjects>
<LinkObjects Condition="'$(Configuration)|$(Platform)'=='CompressFast|Win32'">false</LinkObjects>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">5.0</ShaderModel>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">5.0</ShaderModel>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='DebugShader|Win32'">5.0</ShaderModel>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<ClInclude Include="4klang.h" />
<ClInclude Include="analysis.h" />
<ClInclude Include="data.h" />
<ClInclude Include="profiler.h" />
<ClInclude Include="Shader.h" />
<ClInclude Include="shaders.h" />
<ClInclude Include="timeline.h" />
<ClInclude Include="tweakValues.h" />
<ClInclude Include="video.h" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="4klang.asm">
<FileType>Document</FileType>
<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|Win32'">yasm-1.2.0-win32.exe -f win32 -o 4klang.obj 4klang.asm</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='CompressFast|Win32'">yasm-1.2.0-win32.exe -f win32 -o 4klang.obj 4klang.asm</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compiling 4klang...</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">Compiling 4klang...</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='CompressFast|Win32'">Compiling 4klang...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4klang.obj</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">4klang.obj</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='CompressFast|Win32'">4klang.obj</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4klang.inc</AdditionalInputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">4klang.inc</AdditionalInputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='CompressFast|Win32'">4klang.inc</AdditionalInputs>
<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)'=='DebugShader|Win32'">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>
<Message Condition="'$(Configuration)|$(Platform)'=='DebugShader|Win32'">Compiling 4klang...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4klang.obj</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">4klang.obj</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='DebugShader|Win32'">4klang.obj</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4klang.inc</AdditionalInputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">4klang.inc</AdditionalInputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='DebugShader|Win32'">4klang.inc</AdditionalInputs>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugShader|Win32'">true</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<None Include="4klang.inc" />
<None Include="shaders.cmd" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{CCF13486-5C89-4905-832E-C6C83230DA29}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>Engine</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Video|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugShader|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='CompressFast|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</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 Condition="'$(Configuration)|$(Platform)'=='DebugShader|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|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='CompressFast|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<ExecutablePath>$(SolutionDir);$(ExecutablePath)</ExecutablePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">
<LinkIncremental>true</LinkIncremental>
<ExecutablePath>$(SolutionDir);$(ExecutablePath)</ExecutablePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugShader|Win32'">
<LinkIncremental>true</LinkIncremental>
<ExecutablePath>$(SolutionDir);$(ExecutablePath)</ExecutablePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<ExecutablePath>$(SolutionDir);$(ExecutablePath)</ExecutablePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">
<LinkIncremental>false</LinkIncremental>
<ExecutablePath>$(SolutionDir);$(ExecutablePath)</ExecutablePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='CompressFast|Win32'">
<LinkIncremental>false</LinkIncremental>
<ExecutablePath>$(SolutionDir);$(ExecutablePath)</ExecutablePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>dxgi.lib;d3d11.lib;D3dcompiler.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;VIDEO;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>dxgi.lib;d3d11.lib;D3dcompiler.lib;winmm.lib;vfw32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugShader|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;SHADERDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>dxgi.lib;d3d11.lib;D3dcompiler.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>Disabled</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<WholeProgramOptimization>false</WholeProgramOptimization>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ExceptionHandling>false</ExceptionHandling>
<BufferSecurityCheck>false</BufferSecurityCheck>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EntryPointSymbol>main</EntryPointSymbol>
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
<AdditionalDependencies>dxgi.lib;d3d11.lib;D3dcompiler.lib;4klang.obj;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MinSpace</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;COMPRESS;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<WholeProgramOptimization>false</WholeProgramOptimization>
<DebugInformationFormat>None</DebugInformationFormat>
<ExceptionHandling>false</ExceptionHandling>
<BufferSecurityCheck>false</BufferSecurityCheck>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EntryPointSymbol>main</EntryPointSymbol>
<AdditionalOptions>/crinkler /report:crinkler.html /progressgui /ordertries:2000 /compmode:fast /hashsize:200 /transform:calls /hashtries:100 %(AdditionalOptions)</AdditionalOptions>
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
<AdditionalDependencies>dxgi.lib;d3d11.lib;D3dcompiler.lib;4klang.obj;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='CompressFast|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MinSpace</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;COMPRESS;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<WholeProgramOptimization>false</WholeProgramOptimization>
<DebugInformationFormat>None</DebugInformationFormat>
<ExceptionHandling>false</ExceptionHandling>
<BufferSecurityCheck>false</BufferSecurityCheck>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EntryPointSymbol>main</EntryPointSymbol>
<AdditionalOptions>/crinkler /report:crinkler.html /progressgui /ordertries:200 /compmode:fast /hashsize:100 /transform:calls /hashtries:50 %(AdditionalOptions)</AdditionalOptions>
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
<AdditionalDependencies>dxgi.lib;d3d11.lib;D3dcompiler.lib;4klang.obj;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Shader 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>
<CustomBuild Include="4klang.asm">
<Filter>Source Files</Filter>
</CustomBuild>
<CustomBuild Include="Shader.hlsl" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Shader.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="4klang.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="data.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="shaders.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="profiler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="analysis.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="timeline.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="video.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="tweakValues.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="4klang.inc">
<Filter>Header Files</Filter>
</None>
<None Include="shaders.cmd" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="main.small.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

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

View File

@@ -0,0 +1,13 @@
Build started 09.08.2014 09:32:21.
1>Project "E:\blu-flame.org\hgplus\bliss\Engine\Engine.vcxproj" on node 3 (Build target(s)).
1>CustomBuild:
Minifying shader...
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\CL.exe /c /Zi /nologo /W3 /WX- /Od /Oi /Oy /D WIN32 /D NDEBUG /D _WINDOWS /Gm- /MD /GS- /arch:IA32 /fp:fast /Zc:wchar_t /Zc:forScope /Fo"Release\\" /Fd"Release\vc120.pdb" /Gd /TP /analyze- /errorReport:prompt main.small.cpp
main.small.cpp
1>main.small.cpp(642): error C2065: 'dmScreenSettings' : undeclared identifier
1>Done Building Project "E:\blu-flame.org\hgplus\bliss\Engine\Engine.vcxproj" (Build target(s)) -- FAILED.
Build FAILED.
Time Elapsed 00:00:02.20

View File

@@ -0,0 +1,2 @@
#TargetFrameworkVersion=v4.0:PlatformToolSet=v120:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit
Release|Win32|E:\blu-flame.org\hgplus\bliss\|

View File

@@ -0,0 +1 @@

Binary file not shown.

View File

@@ -0,0 +1,538 @@
/* File generated with Shader Minifier 1.1.3
* http://www.ctrl-alt-test.fr
*/
#ifndef SHADER_H_
# define SHADER_H_
# define VAR_PI "x"
# define VAR_BACKBUFFER "i"
# define VAR_CLAMPSAMPLETYPE "s"
# define VAR_CMPSAMPLER "l"
# define VAR_SAMPLETYPE "t"
# define VAR_SHADERTEXTURE "f"
# define VAR_SHADOWTEXTURE "o"
# define VAR_TERRAINDIFFUSETEXTURE "c"
const char *Shader_hlsl =
"cbuffer _0:register(b0){float _t:TIME;uint _sh:SHADER;uint _sy:HEIGHT;float _a:ASPET;};struct _2{float3 o:POSITION;float2 tc:TEXCOORD0;};struct _3{float4 o:SV_POSITION;float4 c:COLOR;sample float2 tc:TEXCOORD0;float3 n:TEXCOORD1;};struct _4{float e[4]:SV_TessFactor;float i[2]:SV_InsideTessFactor;};struct _5{float3 o:POSITION;float2 tc:TEXCOORD0;float4 c:COLOR;float4 _t:TRANSLATION;float4 _r:ROTATION;float4 _s:SCALE;};struct _6{float4 _t:TRANSLATION;float4 _r:ROTATION;float4 _s:SCALE;float4 tc:TEXCOORD0;};struct __1{float4 _d:_dS;float4 _c:_cS;float4x4 _v:_vS;float4x4 _p:_pS;float4x4 _lvp:_lvpS;float4 _f:_fS;float4 _r1:_lS;float4 _r2:_gS;float4 _r3:_nS;float4 _l:lS;};cbuffer _1:register(b1){__1 _c;};Texture2D f:register(t0),c:register(t1),o:register(t2);"
"Texture2DMS<float4,4> i:register(t3);"
"SamplerState t:register(s0),s:register(s2);"
"SamplerComparisonState l:register(s1);"
"static const float x=3.14159;"
"float4 p(float4 f)"
"{"
"return f/sqrt(dot(f,f));"
"}"
"float4 p(float4 f,float4 c)"
"{"
"return float4(cross(f.xyz,c.xyz)+f.w*c.xyz+c.w*f.xyz,f.w*c.w-dot(f.xyz,c.xyz));"
"}"
"float4 n(float4 c)"
"{"
"return float4(-c.xyz,c.w);"
"}"
"float4 n(float3 f,float x)"
"{"
"return float4(f*sin(x/2),cos(x/2));"
"}"
"float d(float2 f)"
"{"
"return frac(sin(dot(f,float2(12.9898,78.233)))*43758.5);"
"}"
"float3 m(float2 f)"
"{"
"float2 c=floor(f),o=f-c,s=30*o*o*(o*(o-2)+1);"
"o=o*o*o*(o*(o*6-15)+10);"
"float l=d(c+float2(0,0)),m=d(c+float2(1,0)),n=d(c+float2(0,1)),r=d(c+float2(1,1)),t=m-l,y=n-l,i=l-m-n+r;"
"return float3(l+t*o.x+y*o.y+i*o.x*o.y,s*float2(t+i*o.y,y+i*o.x));"
"}"
"float3 d(float2 f,int c,float x,float l)"
"{"
"float o=0.,i=.5;"
"float2 y=float2(0,0);"
"for(int r=0;r<c;r++)"
"{"
"float3 s=m(f);"
"y+=s.yz;"
"o+=i*s.x/(1.+dot(y,y));"
"i*=l;"
"f*=x;"
"}"
"return float3(o,y);"
"}"
"float4x4 d(float3 f,float3 x,float3 c)"
"{"
"float3 o=normalize(cross(c,x)),s=cross(x,o);"
"float4x4 l={o,-dot(o,f),s,-dot(s,f),x,-dot(x,f),0,0,0,1};"
"return transpose(l);"
"}"
"float e(float2 f)"
"{"
"return 20.*max(0.,1.5-8.*pow(length(f-.5),1.));"
"}"
"float4 w(float2 x)"
"{"
"return f.SampleLevel(t,x,0)*float4(e(x),1.,1.,1.);"
"}"
"void e(float f,float o,out float3 c)"
"{"
"c=(float3(d(float2(f,o++)),d(float2(f,o++)),d(float2(f,o++)))*2-1)*float3(64,3,64),c.y+=4+e(c.xz/512.+.5),c.y=smoothstep(3.,13.,c.y)*10.+3.;"
"}"
"void e(int f,out float3 c,out float3 x,out float3 o)"
"{"
"float t=f;"
"float3 l,y,s,z,r;"
"e(t,f++,l);"
"e(t,f++,y);"
"e(t,f++,s);"
"e(t,f++,z);"
"c=lerp(l,y,frac(_t));"
"x=normalize(lerp(s,z,frac(_t))-c);"
"r=cross(float3(0,1,0),x);"
"o=cross(x,r);"
"}"
"__1 VSCB()"
"{"
"__1 f;"
"float c=-cos(x*2*_t/19)*.5+.5;"
"f._l=float4(lerp(float3(-1.,.2,0.),float3(.1,-.7,0.),c),0.);"
"f._f=float4(lerp(float3(.3,.2,0.),float3(.1,.5,.7),c),c);"
"f._r1=float4(lerp(float3(0.,0.,.1),float3(0.,.1,.1),c),1.);"
"f._r2=float4(lerp(float3(.2,0.,.3),float3(.6,.5,.6),c),1.);"
"f._r3=float4(lerp(float3(.8,.6,0.),float3(.7,.6,.5),c),1.);"
"int l[19]={55,58,2,7,111,11,90,0,17,39,83,29,91,69,55,59,51,61,55};"
"float3 o,y,z;"
"e(l[floor(_t)],o,y,z);"
"f._v=d(o,y,z);"
"float3 t=o+y*25;"
"t.y=o.y;"
"float3 m=normalize(f._l);"
"t-=m*25;"
"f._d=float4(y,0);"
"f._c=float4(o,0);"
"f._p=float4x4(.04,0,0,0,0,.04,0,0,0,0,.0005,0,0,0,-.0005,1);"
"f._lvp=mul(d(t,m,y),f._p);"
"f._p=float4x4(1,0,0,0,0,1,0,0,0,0,1,1,0,0,-1,0);"
"return f;"
"}"
"void VSC(uint f:SV_VertexID,out _2 c)"
"{"
"float o=f%512,x=f/512;"
"c.o=float3(-256+o,0,-256+x);"
"c.tc=(float2(o,x)+.5)/512;"
"}"
"void VSV(uint f:SV_VertexID,out _2 c)"
"{"
"uint o=f%2048;"
"float x=f/2048;"
"uint l=o%4;"
"float t=o/4;"
"c.o=float3(-256+t,0,-256+x);"
"if(l==0)"
"c.o+=float3(-.5f,0,-.5f),c.tc=float2(t,x)/512;"
"else"
" if(l==1)"
"c.o+=float3(-.5f,0,.5f),c.tc=float2(t,x+1)/512;"
"else"
" if(l==2)"
"c.o+=float3(.5f,0,.5f),c.tc=float2(t+1,x+1)/512;"
"else"
" c.o+=float3(.5f,0,-.5f),c.tc=float2(t+1,x)/512;"
"}"
"void VS(_2 f,out _5 c)"
"{"
"c.o=f.o,c.tc=f.tc,c.c=c._r=c._s=0,c._t=float4(0,w(f.tc).x,0,0);"
"}"
"float d(float3 f,float3 x)"
"{"
"float4 c=mul(float4((f+x)/2,1),_c._v),o=c;"
"o.x++;"
"float4 t=mul(c,_c._p),s=mul(o,_c._p);"
"float l=distance(t/t.w,s/s.w)/8;"
"return clamp(l,0,64);"
"}"
"bool P(const float3 f)"
"{"
"float3 c=f-_c._c.xyz,x=_c._d.xyz*dot(c,_c._d.xyz)-c;"
"float4 o=mul(mul(float4(f+normalize(x)*min(1.4,length(x)),1.),_c._v),_c._p);"
"o/=o.w;"
"return abs(o.x)<=1.&&abs(o.y)<=1.&&o.w>=0||length(c)<=1.4;"
"}"
"_4 CPCFT(InputPatch<_5, 4> f)"
"{"
"_4 c;"
"float3 x=f[0].o+f[0]._t,o=f[1].o+f[1]._t,y=f[2].o+f[2]._t,t=f[3].o+f[3]._t;"
"if(distance(x,_c._c.xyz)>200||!P(x)&&!P(o)&&!P(y)&&!P(t))"
"c.i[0]=c.i[1]=c.e[0]=c.e[1]=c.e[2]=c.e[3]=-1;"
"else"
" c.e[0]=d(x,o),c.e[1]=d(o,y),c.e[2]=d(y,t),c.e[3]=d(t,x),c.i[1]=(c.e[0]+c.e[2])/2,c.i[0]=(c.e[1]+c.e[3])/2;"
"return c;"
"}"
"_4 CPCFP(InputPatch<_5, 4> f)"
"{"
"_4 c;"
"float3 x=f[0].o+f[0]._t,o=f[1].o+f[1]._t,l=f[2].o+f[2]._t,y=f[3].o+f[3]._t;"
"if(distance(x,_c._c.xyz)>200||!P(x)&&!P(o)&&!P(l)&&!P(y))"
"c.i[0]=c.i[1]=c.e[0]=c.e[1]=c.e[2]=c.e[3]=-1;"
"else"
" c.e[0]=c.e[2]=1,c.e[1]=c.e[3]=8,c.i[0]=8,c.i[1]=1;"
"return c;"
"}"
"[domain(\"quad\")]"
"[partitioning(\"fractional_even\")]"
"[outputtopology(\"triangle_cw\")]"
"[outputcontrolpoints(4)]"
"[patchconstantfunc(\"CPCFT\")]"
"_5 HS(InputPatch<_5, 4> f,uint c:SV_OutputControlPointID)"
"{"
"return f[c];"
"}"
"[domain(\"quad\")]"
"[partitioning(\"fractional_even\")]"
"[outputtopology(\"triangle_cw\")]"
"[outputcontrolpoints(4)]"
"[patchconstantfunc(\"CPCFP\")]"
"_5 HSP(InputPatch<_5, 4> f,uint c:SV_OutputControlPointID)"
"{"
"return f[c];"
"}"
"[domain(\"quad\")]"
"void DS(_4 f,float2 c:SV_DomainLocation,const OutputPatch<_5, 4> o,out _2 x)"
"{"
"x.tc=lerp(lerp(o[0].tc,o[1].tc,c.x),lerp(o[3].tc,o[2].tc,c.x),c.y);"
"x.o=lerp(lerp(o[0].o,o[1].o,c.x),lerp(o[3].o,o[2].o,c.x),c.y);"
"x.o.y+=w(x.tc).x;"
"if(_sh==2)"
"x.o.y=5-x.o.y;"
"}"
"void VST(uint f:SV_VertexID,out _3 c)"
"{"
"if(f==0)"
"c.o=float4(-1.,-1.,0.,1.);"
"else"
" if(f==1)"
"c.o=float4(-1.,1.,0.,1.);"
"else"
" if(f==2)"
"c.o=float4(1.,-1.,0.,1.);"
"else"
" c.o=float4(1.,1.,0.,1.);"
"c.tc=c.o.xy*.5+.5;"
"c.c=0;"
"c.n=_c._c;"
"}"
"void VSTP(_2 f,out _3 c)"
"{"
"c.o=mul(mul(float4(f.o,1),_c._v),_c._p),c.c=mul(float4(f.o,1),_c._lvp),c.tc=f.tc,c.n=f.o;"
"}"
"float r(float4 c)"
"{"
"return max(0,min(1,smoothstep(.4,.7,c.w)*smoothstep(3.,3.5,c.x)));"
"}"
"float V(float4 c)"
"{"
"return max(smoothstep(-.4,-.2,-c.w),smoothstep(-3.5,-3.,-c.x));"
"}"
"float3 a(float2 f)"
"{"
"float2 c=2*f-1;"
"float3 x=normalize(cross(float3(0,1,0),_c._d));"
"return normalize(_c._d+x*c.x*_a+normalize(cross(_c._d,x))*c.y);"
"}"
"float3 S(float3 c)"
"{"
"return pow(saturate(1-c.y),4)*.2+_c._f;"
"}"
"float4 PS(_3 f):SV_TARGET"
"{"
"float x=1.,y=1.f;"
"float2 s=f.tc;"
"float4 i=w(s);"
"float3 m=S(a(f.tc));"
"if(i.x<2.5)"
"{"
"if(_sh==2)"
"discard;"
"else"
" x=(.5-normalize(f.n-_c._c).y)*saturate(i.x/2.5);"
"m*=.8;"
"}"
"float p=distance(f.n,_c._c);"
"float3 z=normalize(float3(i.y,-1,i.z)),n=d(s*2000,4,1.5,.95);"
"z=normalize(float3(n.y,-1,n.z))*(1-r(i))+z;"
"float P=saturate(p/50.);"
"if(P<1)"
"{"
"float3 V=f.c/f.c.w;"
"float2 e=V.xy*.5+.5;"
"e=float2(e.x,1-e.y);"
"float O=0.;"
"for(float h=-1.5;h<=1.5;h++)"
"for(float D=-1.5;D<=1.5;D++)"
"O+=o.SampleCmpLevelZero(l,e+float2(D,h)/4096,V.z);"
"y=lerp(O/16.,1,P);"
"}"
"float D=.2+.8*(.2+.8*_c._f.w)*(i.x/10.),u=max(0,dot(z,normalize(_c._l)));"
"float3 e=c.Sample(t,float2(s.x,1.-s.y)).xyz;"
"e*=lerp(1.,2*d(s*float2(10000,20000),4,1.5,.95).x,r(i));"
"float3 V=m*D,O=_c._f.w*float3(2.,2.,1.)*u*(.2+.8*y);"
"return float4(lerp((O+V)*e,m,max(0,min(1,p/200.))),x);"
"}"
"float4 PSTD(_3 c):SV_TARGET"
"{"
"float2 f=c.tc;"
"float4 o=w(f);"
"float3 x=d(f*2000,4,2.,.5),s=m(f*1000),y=d(f*1000,8,1.5,.95),t=lerp(lerp(float3(.57,.51,0.),float3(.16,.37,.1),s.x),float3(.03,.21,.24),x.x),l=float3(.56,.62,.67),z=lerp(lerp(float3(.41,.37,.12),float3(.57,.51,.32),s.x),l,x.x),i=lerp(l,float3(.27,.22,.11),s.x);"
"i*=.5*y.x;"
"float3 P=lerp(i,.5*z,V(o)),e=lerp(P*(.5+.5*m(f*900).x),.5*t,r(o));"
"e*=.25+(o.x/10-.25)*step(o.x,2.5)+.75*sqrt(smoothstep(2.5,3.,o.x));"
"return float4(e,1);"
"}"
"float4 PSH(_3 c):SV_TARGET"
"{"
"float2 f=d(c.tc*20,3,2.,.5).yz;"
"return float4(d(c.tc*20,10,2.,.5).x,f,normalize(float3(f.x,.5,f.y)).y);"
"}"
"bool P(float3 f,float3 c,float3 x,float3 o,out float y)"
"{"
"float t=dot(f,o);"
"if(t>0)"
"return y=dot(c-x,f)/t,y>=0;"
"return false;"
"}"
"float4 PSC(_3 c):SV_TARGET"
"{"
"float f=0;"
"float3 o=_c._c,x=a(c.tc);"
"float y=0,t=2.;"
"if(P(float3(0,-1,0),float3(0,0,0),o,x,f))"
"o+=x*f,x.y*=-1,y=-.4,t=1.2;"
"if(P(float3(0,1,0),float3(0,200,0),o,x,f))"
"o+=x*f,y+=pow(abs(d(_t*.1-o.xz/80,6,2.,.5)),.1)*smoothstep(.1,.9,pow(abs(d(-_t*.1-o.zx/400,6,1.7,.49)),.6))*(1-pow(min(1,max(0,abs(f)/100000.)),.1));"
"float3 l=S(x);"
"return float4(lerp(l,lerp((1-x.y*.5)*l,t,y),pow(x.y,.4))+smoothstep(.995,.998,dot(x,-normalize(_c._l)))*float3(2.,2.,1.),1);"
"}"
"float4 PSDD(_3 c,uint f:SV_SAMPLEINDEX):SV_TARGET"
"{"
"uint o,y,z;"
"i.GetDimensions(o,y,z);"
"float2 t=float2(c.tc.x,1-c.tc.y);"
"float3 l=i.Load(t*float2(o-1,y-1),f).xyz;"
"l+=pow(1e-05+_c._f.w,.1)*smoothstep(0.,1.,pow(saturate(dot(a(c.tc),-normalize(_c._l))),1./(.1+1-_c._f.w)))*float3(2.,2.,1.)*.2;"
"l=pow(abs(l*(_c._r3-_c._r1)+_c._r1),2*(1-_c._r2));"
"l*=1.4-pow(1.2*distance(t,float2(.5,.5)),2);"
"l*=1+.07*m((t+sin(_t*333))*333).x;"
"l*=1+.05*pow(m(float2(1,_t*222)).x,8);"
"l*=min(1,_c._f.w*33)*min(1,abs(sin(_t*x)*9));"
"return float4(l,1);"
"}"
"float4 P(_3 f,float3 c,float3 o,float2 x)"
"{"
"float y=distance(f.n,_c._c);"
"float3 t=lerp(c,o,x.x);"
"t=lerp(t.xyz,t.yxz,f.c.x*.5)*pow(abs(x.y),f.c.y);"
"float2 s=f.n.xz/256*.5+.5;"
"float4 l=w(float2(s.x,s.y));"
"float3 i=normalize(float3(l.y,-1,l.z));"
"float P=max(0,dot(i,normalize(_c._l))),m=S(a(f.tc)),z=.2+.8*(.2+.8*_c._f.w)*(l.x/10.);"
"float3 p=m*z,n=_c._f.w*float3(1.5,1.5,.6)*P;"
"return float4(lerp(t*(n+p),_c._f.xyz,max(0,min(1,y/200.))),1.-min(1,y/100.));"
"}"
"float4 PSTN(_3 f):SV_TARGET"
"{"
"return P(f,float3(.67,.71,.14),float3(.06,.37,.17),c.Sample(t,f.tc).xy);"
"}"
"float4 PSTS(_3 c):SV_TARGET"
"{"
"return float4(c.c.z/c.c.w,0,0,0);"
"}"
"float4 FSTN(_3 f):SV_TARGET"
"{"
"return P(f,float3(1,0,1),1,c.Sample(t,f.tc).zw);"
"}"
"float4 PSP(_3 c):SV_TARGET"
"{"
"float o=c.tc.y,y=c.tc.x;"
"float2 l=c.tc*float2(.5,.25)+float2(.4,0);"
"float3 s=f.Sample(t,l).xyz;"
"float z=(1+max(0,sin(pow(2-2*o,2)))*max(0,sin(y*5*x))*max(step(.75,y),step(y,.25)))*(1-.2*min(1,1.25*cos((-y+.5)*5*x)*min(step(.4,y),step(y,.6))))*max(sin((1-o)*x),step(.5,1-o))*pow(abs(s.x),.25),i=o+.3*sin(y*8+4)-.2;"
"return float4(o,z,smoothstep(i-.1,i+.1,.7+.1*s.x),(s.x*.4+.6)*(1-min(1,pow(abs(o),4))));"
"}"
"void VSP(_6 f,uint c:SV_VertexID,out _5 x)"
"{"
"uint o=c%4;"
"if(o==0)"
"x.o=float3(0,-1.,1.);"
"else"
" if(o==1)"
"x.o=float3(0,1.,1.);"
"else"
" if(o==2)"
"x.o=float3(0,1.,-1.);"
"else"
" x.o=float3(0,-1.,-1.);"
"x.tc=x.o.yz*.5+.5;"
"x.c=float4(f.tc.zw,0,0);"
"x._t=f._t;"
"x._r=f._r;"
"x._s=f._s;"
"}"
"void S(inout _3 f,int c,const OutputPatch<_5, 4> o,float2 y)"
"{"
"float2 l=lerp(lerp(o[0].tc,o[1].tc,y.x),lerp(o[3].tc,o[2].tc,y.x),y.y);"
"float t=l.x,s=l.y,i=_t*8,z=(2*sin(pow(1-t+.825,3)*.15*x)-.5)*.1;"
"float3 r=float3(t,-pow(t,4)+.07*((max(sin(s*2*x),sin(s*2*x+x))+sin(s*x))/1.765),(2*s-1)*z);"
"r=p(p(o[0]._r,float4(r,0)),n(o[0]._r));"
"r*=(.5+o[0]._s.x)*.7*(.7+.3*o[0].c.x);"
"r+=m(o[0]._t.xz+r.xz*.2+i)*pow(abs(t),8)*(.2+.1*sin(i));"
"r.xyz+=o[0]._t.xyz;"
"f.n=r;"
"f.tc=l.yx;"
"float4 P=mul(float4(r,1.f),_c._lvp);"
"if(c==0)"
"f.o=mul(mul(float4(r,1.f),_c._v),_c._p),f.c=o[0].c;"
"else"
" f.o=P,f.c=f.o;"
"}"
"[domain(\"quad\")]"
"void DSPN(_4 f,float2 c:SV_DomainLocation,const OutputPatch<_5, 4> o,out _3 x)"
"{"
"S(x,0,o,c);"
"}"
"[domain(\"quad\")]"
"void DSPS(_4 f,float2 c:SV_DomainLocation,const OutputPatch<_5, 4> o,out _3 x)"
"{"
"S(x,1,o,c);"
"}"
"void V(inout _3 f,int c,const OutputPatch<_5, 4> o,float2 x)"
"{"
"float2 l=lerp(lerp(o[0].tc,o[1].tc,x.x),lerp(o[3].tc,o[2].tc,x.x),x.y);"
"float y=l.x,s=l.y,z=.2*lerp(lerp(8*y,0,pow(y,2)),0,y);"
"float3 t=float3(y,-log(pow(y,.85)+1),(2*s-1)*z);"
"t=p(p(o[0]._r,float4(t,0)),n(o[0]._r));"
"t*=(.5+o[0]._s.x)*.3*(.7+.3*o[0].c.x);"
"t.xyz+=o[0]._t.xyz;"
"t+=m(t.xz+_t)*pow(abs(y),2)*(.05+.02*sin(_t));"
"f.n=t;"
"f.tc=l.yx;"
"float4 P=mul(float4(t,1.f),_c._lvp);"
"if(c==0)"
"f.o=mul(mul(float4(t,1.f),_c._v),_c._p),f.c=o[0].c;"
"else"
" f.o=P,f.c=f.o;"
"}"
"[domain(\"quad\")]"
"void DSFN(_4 f,float2 c:SV_DomainLocation,const OutputPatch<_5, 4> o,out _3 x)"
"{"
"V(x,0,o,c);"
"}"
"[domain(\"quad\")]"
"void DSFS(_4 f,float2 c:SV_DomainLocation,const OutputPatch<_5, 4> o,out _3 x)"
"{"
"V(x,1,o,c);"
"}"
"_2 O(_2 c)"
"{"
"return c.o.y=5-c.o.y,c;"
"}"
"[maxvertexcount(6)]"
"void GST(triangle _2 f[3],inout PointStream<_2> c,inout PointStream<_2> x)"
"{"
"x.Append(f[0]);"
"x.Append(f[1]);"
"x.Append(f[2]);"
"x.RestartStrip();"
"if(f[0].o.y>=2.5||f[1].o.y>=2.5||f[2].o.y>=2.5)"
"c.Append(O(f[0])),c.Append(O(f[1])),c.Append(O(f[2])),c.RestartStrip();"
"}"
"[maxvertexcount(1)]"
"void GSP(point _2 f[1],inout PointStream<_6> c)"
"{"
"float2 x=f[0].tc,o=float2(m((x-0)*999).x,m((x.yx-0)*999).x);"
"x+=o/512;"
"float4 y=w(x);"
"if(r(y)<.5)"
"return;"
"float3 t=f[0].o;"
"t.xzy+=float3(o,y.x);"
"_6 l;"
"l._t=float4(t,1);"
"l._r=l._s=0;"
"l.tc=float4(x,0,0);"
"c.Append(l);"
"c.RestartStrip();"
"}"
"_6 VSM(_6 c)"
"{"
"return c;"
"}"
"[maxvertexcount(28)]"
"void GSR(point _6 f[1],inout PointStream<_6> c,inout PointStream<_6> o)"
"{"
"_6 y=f[0];"
"float3 t=f[0]._t,l=t+float3(.5,0,.5),s=t+float3(-.5,0,.5),i=t+float3(.5,0,-.5),z=t+float3(-.5,0,-.5);"
"if(distance(t,_c._c)>100||!P(l)&&!P(s)&&!P(i)&&!P(z))"
"return;"
"float3 r=m(y._t.xz);"
"float2 V=r.yz*.5,e=f[0].tc.xy;"
"float4 d=w(e);"
"float3 O=normalize(float3(d.y,3.,d.z)),a=float3(0,0,1),D=float3(0,1,0);"
"float h,u=7.,v=5.,S=4.;"
"float4 N;"
"float3 G;"
"y._s=float4(r,1);"
"for(h=0;h<1;h+=1/u)"
"G=m(y._t.xz*h*u),N=n(a,1+.5*G.x),N=p(p(n(D,V.x+h*(1+.2*G.x)*2*x),N)),N=p(p(float4(cross(O,D),dot(O,D)),N)),y._r=N,y.tc.z=G.y,y.tc.w=1,c.Append(y),c.RestartStrip();"
"for(h=0;h<1;h+=1/v)"
"G=m(y._t.xz*h*v+1),N=n(a,.5+.5*G.x),N=p(p(n(D,V.y+h*(1+.2*G.x)*2*x),N)),N=p(p(float4(float3(-1,1,1)*cross(O,D),dot(O,D)),N)),y._r=N,y.tc.z=G.z,y.tc.w=2,c.Append(y),c.RestartStrip();"
"if(r.x<.25)"
"{"
"float C=1+floor(r.x*4*7);"
"for(h=0;h<1;h+=1/C)"
"{"
"float2 I=float2(m((e+h)*283).x,m((e.yx+h)*185).x)*.5;"
"e+=I/512;"
"float4 H=w(e);"
"y._t.y=H.x+.1;"
"y._t.xz+=I;"
"y._s=float4(m(y._t.xz),1);"
"for(int T=0;T<4;++T)"
"N=n(a,1+.5*G.x),N=p(p(n(D,(I.y+T/4.)*2*x),N)),N=p(p(float4(cross(O,D),dot(O,D)),N)),y._r=N,y.tc.z=I.x,y.tc.w=1,o.Append(y),o.RestartStrip();"
"}"
"}"
"}"
"[maxvertexcount(4)]"
"void GSM(point _6 f[1],inout PointStream<_6> c)"
"{"
"c.Append(f[0]),c.RestartStrip(),c.Append(f[0]),c.RestartStrip(),c.Append(f[0]),c.RestartStrip(),c.Append(f[0]),c.RestartStrip();"
"}"
"[maxvertexcount(6)]"
"void GSQ(point _6 f[1],inout TriangleStream<_3> c)"
"{"
"_3 x;"
"float o=1/1024.;"
"float4 l=float4(f[0]._t.xz/256+2*o,1,1);"
"x.c=0;"
"x.n=0;"
"x.o=l+float4(-o,o,0,0);"
"x.tc=float2(-1,1);"
"c.Append(x);"
"x.o=l+float4(o,-o,0,0);"
"x.tc=float2(1,-1);"
"c.Append(x);"
"x.o=l+float4(-o,-o,0,0);"
"x.tc=float2(-1,-1);"
"c.Append(x);"
"c.RestartStrip();"
"x.o=l+float4(-o,o,0,0);"
"x.tc=float2(-1,1);"
"c.Append(x);"
"x.o=l+float4(o,o,0,0);"
"x.tc=float2(1,1);"
"c.Append(x);"
"x.o=l+float4(o,-o,0,0);"
"x.tc=float2(1,-1);"
"c.Append(x);"
"c.RestartStrip();"
"}";
#endif // SHADER_H_

View File

@@ -0,0 +1,929 @@
cbuffer _0 : register(b0)
{
float _t : TIME;
uint _sh : SHADER;
uint _sy : HEIGHT;
float _a : ASPET;
};
struct _2
{
float3 o : POSITION;
float2 tc : TEXCOORD0;
};
struct _3
{
float4 o : SV_POSITION;
float4 c : COLOR;
sample float2 tc : TEXCOORD0;
float3 n : TEXCOORD1;
};
struct _4
{
float e[4] : SV_TessFactor;
float i[2] : SV_InsideTessFactor;
};
struct _5
{
float3 o : POSITION;
float2 tc : TEXCOORD0;
float4 c : COLOR;
float4 _t : TRANSLATION;
float4 _r : ROTATION;
float4 _s : SCALE;
};
struct _6
{
float4 _t : TRANSLATION;
float4 _r : ROTATION;
float4 _s : SCALE;
float4 tc : TEXCOORD0;
};
struct __1
{
float4 _d : _dS;
float4 _c : _cS;
float4x4 _v : _vS;
float4x4 _p : _pS;
float4x4 _lvp : _lvpS;
float4 _f : _fS;
float4 _r1 : _lS;
float4 _r2 : _gS;
float4 _r3 : _nS;
float4 _l : lS;
};
cbuffer _1 : register(b1)
{
__1 _c;
};
Texture2D shaderTexture: register(t0);
Texture2D terrainDiffuseTexture: register(t1);
Texture2D shadowTexture: register(t2);
Texture2DMS<float4, 4> backBuffer: register(t3);
SamplerState sampleType : register(s0);
SamplerState clampSampleType : register(s2);
SamplerComparisonState cmpSampler : register(s1);
static const float PI = 3.141592;
float4 qnorm(float4 q)
{
return q / sqrt(dot(q, q));
}
float4 qmul(float4 a, float4 b)
{
return float4(cross(a.xyz, b.xyz) + a.w*b.xyz + b.w*a.xyz, a.w*b.w - dot(a.xyz, b.xyz));
}
float4 qconj(float4 q)
{
return float4(-q.xyz, q.w);
}
float4 quaternion(float3 v, float a)
{
return float4(v * sin(a / 2), cos(a / 2));
}
float random(float2 a)
{
return frac(sin(dot(a, float2(12.9898, 78.233))) * 43758.5453);
}
float3 dnoise2f(float2 p)
{
float2 ij = floor(p);
float2 uv = p - ij;
float2 duv = 30 * uv *uv * (uv * (uv - 2) + 1);
uv = uv*uv*uv*(uv*(uv * 6 - 15) + 10);
float a = random(ij + float2(0, 0));
float b = random(ij + float2(1, 0));
float c = random(ij + float2(0, 1));
float d = random(ij + float2(1, 1));
float k1 = b - a;
float k2 = c - a;
float k3 = a - b - c + d;
return float3(a + k1*uv.x + k2*uv.y + k3*uv.x*uv.y, duv * float2(k1 + k3*uv.y, k2 + k3*uv.x));
}
float3 fbm(float2 p, int octaves, float persistence, float gain)
{
float f = 0.0;
float w = 0.5;
float2 d = float2(0, 0);
for (int i = 0; i < octaves; i++)
{
float3 n = dnoise2f(p);
d += n.yz;
f += w * n.x / (1.0 + dot(d, d));
w *= gain;
p *= persistence;
}
return float3(f, d);
}
float4x4 lookTo(float3 Eye, float3 zaxis, float3 Up)
{
float3 xaxis = normalize(cross(Up, zaxis));
float3 yaxis = cross(zaxis, xaxis);
float4x4 result = {
xaxis, -dot(xaxis, Eye),
yaxis, -dot(yaxis, Eye),
zaxis, -dot(zaxis, Eye),
0, 0, 0, 1
};
return transpose(result);
}
float island(float2 uvWorld)
{
return 20.0 * max(0.0, 1.5 - 8.0 * pow(length(uvWorld - 0.5), 1.0));
}
float4 terrainHeight(float2 uvWorld)
{
return shaderTexture.SampleLevel(sampleType, uvWorld, 0) * float4(island(uvWorld), 1.0, 1.0, 1.0);
}
void cameraPosition(float t, float seed, out float3 position)
{
position = (float3(random(float2(t, seed++)), random(float2(t, seed++)), random(float2(t, seed++))) * 2 - 1) * float3(64, 3, 64);
position.y += 4 + island(position.xz / 512.0 + 0.5);
position.y = smoothstep(3.0, 13.0, position.y) * 10.0 + 3.0;
}
void getCamera(int seed, out float3 position, out float3 direction, out float3 up)
{
float a = seed;
float3 v1, v2, v3, v4, right;
cameraPosition(a, seed++, v1);
cameraPosition(a, seed++, v2);
cameraPosition(a, seed++, v3);
cameraPosition(a, seed++, v4);
position = lerp(v1, v2, frac(_t));
direction = normalize(lerp(v3, v4, frac(_t)) - position);
right = cross(float3(0, 1, 0), direction);
up = cross(direction, right);
}
// Constant buffer vertex shader
__1 VSCB()
{
__1 o;
float dayTime = -cos(PI * 2 * _t / 19)*.5 + .5;
o._l = float4(lerp(float3(-1.0, 0.2, 0.0), float3(0.1, -0.7, 0.0), dayTime), 0.0);
o._f = float4(lerp(float3(0.3, 0.2, 0.0), float3(0.1, 0.5, 0.7), dayTime), dayTime);
o._r1 = float4(lerp(float3(0.0, 0.0, 0.1), float3(0., 0.1, 0.1), dayTime), 1.0);
o._r2 = float4(lerp(float3(0.2, 0.0, 0.3), float3(0.6, 0.5, 0.6), dayTime), 1.0);
o._r3 = float4(lerp(float3(0.8, 0.6, 0.0), float3(0.7, 0.6, 0.5), dayTime), 1.0);
int seeds[19] = { // good ones: 90, 91, 96
55, 58, 2, 7, 111, // intro
11, 90, 0, 17, // drums
39, 83, 29, 91, // climax
69, 55, 59, 51, // cooldown
61, 55
};
float3 position, direction, up;
getCamera(seeds[floor(_t)], position, direction, up);
o._v = lookTo(position, direction, up);
float3 lposition = position + direction * 25;
lposition.y = position.y;
float3 ldir = normalize(o._l);
lposition -= ldir * 25;
o._d = float4(direction, 0);
o._c = float4(position, 0);
o._p = float4x4( // ortho matrix
0.04, 0, 0, 0,
0, 0.04, 0, 0,
0, 0, 0.0005, 0,
0, 0, -0.0005, 1
);
o._lvp = mul(lookTo(lposition, ldir, direction), o._p);
o._p = float4x4( // perspective matrix
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 1,
0, 0, -1, 0
);
return o;
}
// Cell vertex shader
void VSC(uint id : SV_VertexID, out _2 output)
{
float x = id % 512;
float y = id / 512;
output.o = float3(-256 + x, 0, -256 + y);
output.tc = (float2(x, y) + 0.5) / 512;
}
// Terrain vertex shader
void VSV(uint id : SV_VertexID, out _2 output)
{
uint row = id % 2048;
float y = id / 2048;
uint vid = row % 4;
float x = row / 4;
output.o = float3(-256 + x, 0, -256 + y);
if (vid == 0)
{
output.o += float3(-0.5f, 0, -0.5f);
output.tc = float2(x, y) / 512;
}
else if (vid == 1)
{
output.o += float3(-0.5f, 0, 0.5f);
output.tc = float2(x, y+1) / 512;
}
else if (vid == 2)
{
output.o += float3(0.5f, 0, 0.5f);
output.tc = float2(x+1, y+1) / 512;
}
else // if (vid == 3
{
output.o += float3(0.5f, 0, -0.5f);
output.tc = float2(x+1, y) / 512;
}
}
// Terrain Vertex shader
void VS(_2 input, out _5 output)
{
output.o = input.o;
output.tc = input.tc;
output.c =
output._r =
output._s = 0;
output._t = float4(0, terrainHeight(input.tc).r, 0, 0);
}
float SphereToScreenSpaceTessellation(float3 p0, float3 p1)
{
float4 view0 = mul(float4((p0 + p1) / 2, 1), _c._v);
float4 view1 = view0;
view1.x++;
float4 clip0 = mul(view0, _c._p);
float4 clip1 = mul(view1, _c._p);
float t = distance(clip0 / clip0.w, clip1 / clip1.w) / 8; // tessellatedTriWidth
return clamp(t, 0, 64);
}
bool inFrustum(const float3 pt)
{
float3 eyeToPt = pt - _c._c.rgb;
float3 v = _c._d.rgb * dot(eyeToPt, _c._d.rgb) - eyeToPt;
float4 p = mul(mul(float4(pt + normalize(v) * min(1.4, length(v)), 1.0), _c._v), _c._p);
p /= p.w;
return abs(p.x) <= 1.0 &&
abs(p.y) <= 1.0 &&
p.w >= 0 || length(eyeToPt) <= 1.4;
}
// Hull shader (terrain)
_4 CPCFT(InputPatch<_5, 4> ip)
{
_4 o;
float3 v0 = ip[0].o + ip[0]._t;
float3 v1 = ip[1].o + ip[1]._t;
float3 v2 = ip[2].o + ip[2]._t;
float3 v3 = ip[3].o + ip[3]._t;
if (distance(v0, _c._c.rgb) > 200 || !inFrustum(v0) && !inFrustum(v1) && !inFrustum(v2) && !inFrustum(v3))
{
o.i[0] = o.i[1] = o.e[0] = o.e[1] = o.e[2] = o.e[3] = -1;
}
else
{
o.e[0] = SphereToScreenSpaceTessellation(v0, v1);
o.e[1] = SphereToScreenSpaceTessellation(v1, v2);
o.e[2] = SphereToScreenSpaceTessellation(v2, v3);
o.e[3] = SphereToScreenSpaceTessellation(v3, v0);
o.i[1] = (o.e[0] + o.e[2]) / 2;
o.i[0] = (o.e[1] + o.e[3]) / 2;
}
return o;
}
// Hull shader (plant)
_4 CPCFP(InputPatch<_5, 4> ip)
{
_4 o;
float3 v0 = ip[0].o + ip[0]._t;
float3 v1 = ip[1].o + ip[1]._t;
float3 v2 = ip[2].o + ip[2]._t;
float3 v3 = ip[3].o + ip[3]._t;
if (distance(v0, _c._c.rgb) > 200 || !inFrustum(v0) && !inFrustum(v1) && !inFrustum(v2) && !inFrustum(v3))
{
o.i[0] = o.i[1] = o.e[0] = o.e[1] = o.e[2] = o.e[3] = -1;
}
else
{
o.e[0] = o.e[2] = 1;
o.e[1] = o.e[3] = 8;
o.i[0] = 8;
o.i[1] = 1;
}
return o;
}
// Hull shader (terrain)
[domain("quad")]
[partitioning("fractional_even")]
[outputtopology("triangle_cw")]
[outputcontrolpoints(4)]
[patchconstantfunc("CPCFT")]
_5 HS(InputPatch<_5, 4> patch, uint pointId : SV_OutputControlPointID)
{
return patch[pointId];
}
// Hull shader (plant)
[domain("quad")]
[partitioning("fractional_even")]
[outputtopology("triangle_cw")]
[outputcontrolpoints(4)]
[patchconstantfunc("CPCFP")]
_5 HSP(InputPatch<_5, 4> patch, uint pointId : SV_OutputControlPointID)
{
return patch[pointId];
}
// Terrain Domain shader
[domain("quad")]
void DS(_4 input, float2 UV : SV_DomainLocation, const OutputPatch<_5, 4> patch, out _2 output)
{
output.tc = lerp(lerp(patch[0].tc, patch[1].tc, UV.x), lerp(patch[3].tc, patch[2].tc, UV.x), UV.y);
output.o = lerp(lerp(patch[0].o, patch[1].o, UV.x), lerp(patch[3].o, patch[2].o, UV.x), UV.y);
output.o.y += terrainHeight(output.tc).r;
if (_sh == 2)
output.o.y = 5 - output.o.y;
}
// Texture Vertex shader
void VST(uint vertexId : SV_VertexID, out _3 output)
{
if (vertexId == 0)
output.o = float4(-1.0, -1.0, 0.0, 1.0);
else if (vertexId == 1)
output.o = float4(-1.0, 1.0, 0.0, 1.0);
else if (vertexId == 2)
output.o = float4(1.0, -1.0, 0.0, 1.0);
else
output.o = float4(1.0, 1.0, 0.0, 1.0);
output.tc = output.o.xy * 0.5 + 0.5;
output.c = 0;
output.n = _c._c;
}
// Terrain project vertex shader
void VSTP(_2 input, out _3 output)
{
output.o = mul(mul(float4(input.o, 1), _c._v), _c._p);
output.c = mul(float4(input.o, 1), _c._lvp);
output.tc = input.tc;
output.n = input.o;
}
float grassAmount(float4 t)
{
return max(0, min(1, smoothstep(0.4, 0.7, t.w) * smoothstep(3.0, 3.5, t.x)));
}
float sandAmount(float4 t)
{
return max(smoothstep(-0.4, -0.2, -t.w), smoothstep(-3.5, -3.0, -t.x));
}
float3 rayDir(float2 uv)
{
float2 viewCoord = 2 * uv - 1;
float3 right = normalize(cross(float3(0, 1, 0), _c._d));
return normalize(_c._d + right * viewCoord.x * _a + normalize(cross(_c._d, right)) * viewCoord.y);
}
float3 fog(float3 rd)
{
return pow(saturate(1 - rd.y), 4) * 0.2 + _c._f;
}
// Terrain Pixel shader
float4 PS(_3 input) : SV_TARGET
{
float alpha = 1.0;
float shadowFactor = 1.0f;
float2 uv = input.tc;
float4 t = terrainHeight(uv);
float3 f = fog(rayDir(input.tc));
if (t.x < 2.5)
{
if (_sh == 2)
discard;
else
alpha = (0.5 - normalize(input.n - _c._c).y) * saturate(t.x/2.5);
f *= 0.8;
}
float dist = distance(input.n, _c._c);
float3 n = normalize(float3(t.y, -1, t.z));
float3 detail3 = fbm(uv * 2000, 4, 1.5, 0.95);
n = normalize(float3(detail3.y, -1, detail3.z)) * (1 - grassAmount(t)) + n;
float shadowContrib = saturate(dist / 50.0);
if (shadowContrib < 1)
{
float3 depth = input.c / input.c.w;
float2 luv = depth.xy*.5 + .5;
luv = float2(luv.x, 1 - luv.y);
float sum = 0.0;
for (float y = -1.5; y <= 1.5; y++)
for (float x = -1.5; x <= 1.5; x++)
sum += shadowTexture.SampleCmpLevelZero(cmpSampler, luv + float2(x, y) / 4096, depth.z);
shadowFactor = lerp(sum / 16.0, 1, shadowContrib);
}
float tAmbient = 0.2 + 0.8 * (0.2 + 0.8 * _c._f.a) * (t.x / 10.0);
float tDiffuse = max(0, dot(n, normalize(_c._l)));
float3 color = terrainDiffuseTexture.Sample(sampleType, float2(uv.x, 1.0 - uv.y)).rgb;
color *= lerp(1.0, 2 * fbm(uv * float2(10000, 20000), 4, 1.5, 0.95).x, grassAmount(t));
float3 ambient = f * tAmbient;
float3 diffuse = _c._f.a * float3(2.0, 2.0, 1.0) * tDiffuse * (0.2 + 0.8 * shadowFactor);
return float4(lerp((diffuse + ambient) * color, f, max(0, min(1, dist / 200.0))), alpha);
}
// Terrain Texture Pixel shader
float4 PSTD(_3 input) : SV_TARGET
{
float2 uv = input.tc;
float4 t = terrainHeight(uv);
float3 detail1 = fbm(uv * 2000, 4, 2.0, 0.5);
float3 detail2 = dnoise2f(uv * 1000);
float3 detail3 = fbm(uv * 1000, 8, 1.5, 0.95);
float3 grass = lerp(lerp(float3(0.57, 0.51, 0.0), float3(0.16, 0.37, 0.1), detail2.x), float3(0.03, 0.21, 0.24), detail1.x);
float3 gray = float3(0.56, 0.62, 0.67);
float3 sand = lerp(lerp(float3(0.41, 0.37, 0.12), float3(0.57, 0.51, 0.32), detail2.x), gray, detail1.x);
float3 stone = lerp(gray, float3(0.27, 0.22, 0.11), detail2.x);
stone *= 0.5 * detail3.x;
float3 ground = lerp(stone, 0.5 * sand, sandAmount(t));
float3 color = lerp(ground * (0.5 + 0.5 * dnoise2f(uv * 900).x), 0.5 * grass, grassAmount(t));
color *= 0.25 + (t.x / 10 - 0.25)*step(t.x, 2.5) + 0.75*sqrt(smoothstep(2.5, 3.0, t.x));
return float4(color, 1);
}
// HeightMap Pixel shader
float4 PSH(_3 input) : SV_TARGET
{
float2 n = fbm(input.tc * 20, 3, 2.0, 0.5).yz;
return float4(fbm(input.tc * 20, 10, 2.0, 0.5).x, n, normalize(float3(n.x, 0.5, n.y)).y);
}
bool intersectPlane(float3 n, float3 p0, float3 ro, float3 rd, out float t)
{
float denom = dot(n, rd);
if (denom > 0)
{
t = dot(p0 - ro, n) / denom;
return t >= 0;
}
return false;
}
// Cloud Pixel shader
float4 PSC(_3 input) : SV_TARGET
{
float t = 0;
float3 ro = _c._c;
float3 rd = rayDir(input.tc);
float a = 0;
float intensity = 2.0;
if (intersectPlane(float3(0, -1, 0), float3(0, 0, 0), ro, rd, t))
{
ro += rd * t;
rd.y *= -1;
a = -0.4;
intensity = 1.2;
}
if (intersectPlane(float3(0, 1, 0), float3(0, 200, 0), ro, rd, t))
{
ro += rd * t;
a +=
pow(abs(fbm(_t * 0.1 - ro.xz / 80, 6, 2.0, 0.5)), 0.1)
* smoothstep(0.1, 0.9, pow(abs(fbm(-_t * 0.1 - ro.zx / 400, 6, 1.7, 0.49)), 0.6))
* (1 - pow(min(1, max(0, abs(t) / 100000.0)), 0.1));
}
float3 f = fog(rd);
return float4(lerp(f, lerp((1 - rd.y*.5)*f, intensity, a), pow(rd.y, 0.4)) + smoothstep(0.995, 0.998, dot(rd, -normalize(_c._l))) * float3(2.0, 2.0, 1.0), 1);
}
// Post Processing Pixel shader
float4 PSDD(_3 input, uint nSampleIndex : SV_SAMPLEINDEX) : SV_TARGET
{
uint x, y, s;
backBuffer.GetDimensions(x, y, s);
float2 texCoord = float2(input.tc.x, 1 - input.tc.y);
float3 finalColor = backBuffer.Load(texCoord * float2(x - 1, y - 1), nSampleIndex).rgb;
// Sun
finalColor += pow(0.00001 + _c._f.a, 0.1) * smoothstep(0.0, 1.0, pow(saturate(dot(rayDir(input.tc), -normalize(_c._l))), 1.0 / (0.1 + 1 - _c._f.a))) * float3(2.0, 2.0, 1.0) * 0.2;
// Color grading
finalColor = pow(abs(finalColor * (_c._r3 - _c._r1) + _c._r1), 2 * (1 - _c._r2));
// Vignette
finalColor *= 1.4 - pow(1.2 * distance(texCoord, float2(0.5, 0.5)), 2);
// Film grain
finalColor *= 1 + 0.07 * dnoise2f((texCoord + sin(_t * 333)) * 333).x;
// Flackern
finalColor *= 1 + 0.05 * pow(dnoise2f(float2(1, _t * 222)).x, 8);
// Fade
finalColor *= min(1, _c._f.a * 33) * min(1, abs(sin(_t * PI) * 9));
return float4(finalColor, 1);
}
float4 shadeFlora(_3 input, float3 color1, float3 color2, float2 tex)
{
float dist = distance(input.n, _c._c);
float3 color = lerp(color1, color2, tex.r);
color = lerp(color.rgb, color.grb, input.c.x * 0.5) * pow(abs(tex.g), input.c.y);
float2 uv = (input.n.xz / 256) * 0.5 + 0.5;
float4 t = terrainHeight(float2(uv.x, uv.y));
float3 n = normalize(float3(t.y, -1, t.z));
float tDiffuse = max(0, dot(n, normalize(_c._l)));
float f = fog(rayDir(input.tc));
float tAmbient = 0.2 + 0.8 * (0.2 + 0.8 * _c._f.a) * (t.x / 10.0);
float3 ambient = f * tAmbient;
float3 diffuse = _c._f.a * float3(1.5, 1.5, 0.6) * tDiffuse;
return float4(lerp(color * (diffuse + ambient), _c._f.rgb, max(0, min(1, dist / 200.0))), 1.0 - min(1, dist / 100.0));
}
// Plant Pixel shader (normal)
float4 PSTN(_3 input) : SV_TARGET
{
return shadeFlora(input, float3(0.67, 0.71, 0.14), float3(0.06, 0.37, 0.17), terrainDiffuseTexture.Sample(sampleType, input.tc).rg);
}
// Plant Pixel shader (shadow)
float4 PSTS(_3 input) : SV_TARGET
{
return float4(input.c.z / input.c.w, 0, 0, 0);
}
// Flower Pixel shader (normal)
float4 FSTN(_3 input) : SV_TARGET
{
return shadeFlora(input, float3(1, 0, 1), 1, terrainDiffuseTexture.Sample(sampleType, input.tc).ba);
}
// Plant Texture Pixel shader
float4 PSP(_3 input) : SV_TARGET
{
float y = input.tc.y;
float x = input.tc.x;
// Leaf
float2 uv = input.tc*float2(0.5, 0.25) + float2(0.4, 0);
float3 noise = shaderTexture.Sample(sampleType, uv).rgb;
float l = (1 + max(0, sin(pow(2 - 2 * y, 2)))*max(0, sin(x * 5 * PI))*max(step(0.75, x), step(x, 0.25)))
* (1 - 0.2 * min(1, 1.25*cos((-x + .5) * 5 * PI)*min(step(0.4, x), step(x, 0.6))))
* max(sin((1 - y)*PI), step(0.5, 1 - y))
* pow(abs(noise.r), 0.25);
// Flower
float c = y + 0.3*sin(x * 8 + 4) - 0.2;
return float4(y, l, smoothstep(c - 0.1, c + 0.1, 0.7 + 0.1*noise.x), (noise.x*.4 + .6) * (1 - min(1, pow(abs(y), 4))));
}
// Plant Vertex shader
void VSP(_6 instance, uint id : SV_VertexID, out _5 output)
{
uint vertexId = id % 4;
if (vertexId == 0)
output.o = float3(0, -1.0, 1.0);
else if (vertexId == 1)
output.o = float3(0, 1.0, 1.0);
else if (vertexId == 2)
output.o = float3(0, 1.0, -1.0);
else
output.o = float3(0, -1.0, -1.0);
output.tc = output.o.yz * 0.5 + 0.5;
output.c = float4(instance.tc.zw, 0, 0);
output._t = instance._t;
output._r = instance._r;
output._s = instance._s;
}
void plantDomain(inout _3 output, int shadow, const OutputPatch<_5, 4> patch, float2 UV)
{
float2 texCoords = lerp(lerp(patch[0].tc, patch[1].tc, UV.x), lerp(patch[3].tc, patch[2].tc, UV.x), UV.y);
float x = texCoords.x;
float y = texCoords.y;
float t = _t * 8;
float size = (2 * sin(pow((1 - x) + 0.825, 3)*0.15*PI) - 0.5)*0.1;
float3 pos = float3(x, -pow(x, 4) + 0.07*((max(sin(y * 2 * PI), sin(y * 2 * PI + PI)) + sin(y*PI)) / 1.765), (2 * y - 1) * size);
pos = qmul(qmul(patch[0]._r, float4(pos, 0)), qconj(patch[0]._r));
pos *= (0.5 + patch[0]._s.x) * 0.7 * (0.7 + 0.3 * patch[0].c.x);
pos += dnoise2f(patch[0]._t.xz + pos.xz * 0.2 + t) * pow(abs(x), 8) * (0.2 + 0.1 * sin(t));
pos.xyz += patch[0]._t.xyz;
output.n = pos;
output.tc = texCoords.yx;
float4 l = mul(float4(pos, 1.0f), _c._lvp);
if (shadow == 0)
{
output.o = mul(mul(float4(pos, 1.0f), _c._v), _c._p);
output.c = patch[0].c;
}
else
{
output.o = l;
output.c = output.o;
}
}
// Plant Domain shader (normal)
[domain("quad")]
void DSPN(_4 input, float2 UV : SV_DomainLocation, const OutputPatch<_5, 4> patch, out _3 output)
{
plantDomain(output, 0, patch, UV);
}
// Plant Domain shader (shadow)
[domain("quad")]
void DSPS(_4 input, float2 UV : SV_DomainLocation, const OutputPatch<_5, 4> patch, out _3 output)
{
plantDomain(output, 1, patch, UV);
}
void flowerDomain(inout _3 output, int shadow, const OutputPatch<_5, 4> patch, float2 UV)
{
float2 texCoords = lerp(lerp(patch[0].tc, patch[1].tc, UV.x), lerp(patch[3].tc, patch[2].tc, UV.x), UV.y);
float x = texCoords.x;
float y = texCoords.y;
float size = 0.2*lerp(lerp(8 * x, 0, pow(x, 2)), 0, x);
float3 pos = float3(x, -log(pow(x, 0.85) + 1), (2 * y - 1) * size);
pos = qmul(qmul(patch[0]._r, float4(pos, 0)), qconj(patch[0]._r));
pos *= (0.5 + patch[0]._s.x) * 0.3 * (0.7 + 0.3 * patch[0].c.x);
pos.xyz += patch[0]._t.xyz;
pos += dnoise2f(pos.xz + _t) * pow(abs(x), 2) * (0.05 + 0.02 * sin(_t));
output.n = pos;
output.tc = texCoords.yx;
float4 l = mul(float4(pos, 1.0f), _c._lvp);
if (shadow == 0)
{
output.o = mul(mul(float4(pos, 1.0f), _c._v), _c._p);
output.c = patch[0].c;
}
else
{
output.o = l;
output.c = output.o;
}
}
// Flower Domain shader (normal)
[domain("quad")]
void DSFN(_4 input, float2 UV : SV_DomainLocation, const OutputPatch<_5, 4> patch, out _3 output)
{
flowerDomain(output, 0, patch, UV);
}
// Flower Domain shader (shadow)
[domain("quad")]
void DSFS(_4 input, float2 UV : SV_DomainLocation, const OutputPatch<_5, 4> patch, out _3 output)
{
flowerDomain(output, 1, patch, UV);
}
_2 reflect(_2 i)
{
i.o.y = 5 - i.o.y;
return i;
}
[maxvertexcount(6)]
// Terrain geometry shader
void GST(triangle _2 input[3], inout PointStream<_2> water, inout PointStream<_2> land)
{
land.Append(input[0]);
land.Append(input[1]);
land.Append(input[2]);
land.RestartStrip();
if (input[0].o.y >= 2.5 || input[1].o.y >= 2.5 || input[2].o.y >= 2.5)
{
water.Append(reflect(input[0]));
water.Append(reflect(input[1]));
water.Append(reflect(input[2]));
water.RestartStrip();
}
}
[maxvertexcount(1)]
// Plant layout geometry shader
void GSP(point _2 input[1], inout PointStream<_6> output)
{
float2 uv = input[0].tc;
float2 offset = float2(dnoise2f((uv - (1 / 1024)) * 999).x, dnoise2f((uv.yx - (1 / 1024)) * 999).x);
uv += offset / 512;
float4 t = terrainHeight(uv);
if (grassAmount(t) < 0.5)
return;
float3 v = input[0].o;
v.xzy += float3(offset, t.r);
_6 result;
result._t = float4(v, 1);
result._r =
result._s = 0;
result.tc = float4(uv, 0, 0);
output.Append(result);
output.RestartStrip();
}
// Multiplication Vertex shader
_6 VSM(_6 input)
{
return input;
}
[maxvertexcount(28)]
// Rotation geometry shader
void GSR(point _6 input[1], inout PointStream<_6> output, inout PointStream<_6> flower)
{
_6 result = input[0];
float3 v = input[0]._t;
float3 v0 = v + float3(0.5, 0, 0.5);
float3 v1 = v + float3(-0.5, 0, 0.5);
float3 v2 = v + float3(0.5, 0, -0.5);
float3 v3 = v + float3(-0.5, 0, -0.5);
if (distance(v, _c._c) > 100 || !inFrustum(v0) && !inFrustum(v1) && !inFrustum(v2) && !inFrustum(v3))
return;
float3 cellNoise = dnoise2f(result._t.xz);
float2 offset = cellNoise.yz * 0.5;
float2 uv = input[0].tc.xy;
float4 t = terrainHeight(uv);
float3 n = normalize(float3(t.y, 3.0, t.z));
float3 forward = float3(0, 0, 1);
float3 up = float3(0, 1, 0);
float i;
float leafsUpper = 7.0;
float leafsLower = 5.0;
float flowerCount = 4.0;
float4 q;
float3 noise;
result._s = float4(cellNoise, 1);
for (i = 0; i < 1; i += 1 / leafsUpper)
{
noise = dnoise2f(result._t.xz * i * leafsUpper);
q = quaternion(forward, 1 + 0.5 * noise.x);
q = qnorm(qmul(quaternion(up, offset.x + i * (1 + 0.2 * noise.x) * 2 * PI), q));
q = qnorm(qmul(float4(cross(n, up), dot(n, up)), q));
result._r = q;
result.tc.z = noise.y;
result.tc.w = 1;
output.Append(result);
output.RestartStrip();
}
for (i = 0; i < 1; i += 1 / leafsLower)
{
noise = dnoise2f(result._t.xz * i * leafsLower + 1);
q = quaternion(forward, 0.5 + 0.5 * noise.x);
q = qnorm(qmul(quaternion(up, offset.y + i * (1 + 0.2 * noise.x) * 2 * PI), q));
q = qnorm(qmul(float4(float3(-1, 1, 1)*cross(n, up), dot(n, up)), q));
result._r = q;
result.tc.z = noise.z;
result.tc.w = 2;
output.Append(result);
output.RestartStrip();
}
if (cellNoise.x < 0.25)
{
float flowerCount = 1 + floor(cellNoise.x * 4 * 7);
for (i = 0; i < 1; i += 1 / flowerCount)
{
float2 offset = float2(dnoise2f((uv + i) * 283).x, dnoise2f((uv.yx + i) * 185).x)* 0.5;
uv += offset / 512;
float4 t = terrainHeight(uv);
result._t.y = t.x + 0.1;
result._t.xz += offset;
result._s = float4(dnoise2f(result._t.xz), 1);
for (int j = 0; j < 4; ++j)
{
q = quaternion(forward, 1 + 0.5 * noise.x);
q = qnorm(qmul(quaternion(up, (offset.y + j / 4.0) * 2 * PI), q));
q = qnorm(qmul(float4(cross(n, up), dot(n, up)), q));
result._r = q;
result.tc.z = offset.x;
result.tc.w = 1;
flower.Append(result);
flower.RestartStrip();
}
}
}
}
[maxvertexcount(4)]
// Multiplication geometry shader
void GSM(point _6 input[1], inout PointStream<_6> output)
{
output.Append(input[0]);
output.RestartStrip();
output.Append(input[0]);
output.RestartStrip();
output.Append(input[0]);
output.RestartStrip();
output.Append(input[0]);
output.RestartStrip();
}
[maxvertexcount(6)]
// Quad geometry shader
void GSQ(point _6 input[1], inout TriangleStream<_3> output)
{
_3 result;
float size = 1 / 1024.0;
float4 location = float4(input[0]._t.xz / 256 + 2 * size, 1, 1); // -1..1
result.c = 0;
result.n = 0;
result.o = location + float4(-size, size, 0, 0);
result.tc = float2(-1, 1);
output.Append(result);
result.o = location + float4(size, -size, 0, 0);
result.tc = float2(1, -1);
output.Append(result);
result.o = location + float4(-size, -size, 0, 0);
result.tc = float2(-1, -1);
output.Append(result);
output.RestartStrip();
result.o = location + float4(-size, size, 0, 0);
result.tc = float2(-1, 1);
output.Append(result);
result.o = location + float4(size, size, 0, 0);
result.tc = float2(1, 1);
output.Append(result);
result.o = location + float4(size, -size, 0, 0);
result.tc = float2(1, -1);
output.Append(result);
output.RestartStrip();
}

View File

@@ -0,0 +1,284 @@
#pragma bss_seg(".analysisbss")
static ID3D11Texture2D* resolvedTexture;
static ID3D11Texture2D* stagingTexture;
static D3D11_MAPPED_SUBRESOURCE analysisResource;
static int* pixels;
static HBITMAP hbmp;
static HDC hdcMem;
static HDC hdc;
static D3D11_TEXTURE2D_DESC stagingDesc;
static unsigned int hR[256];
static unsigned int hG[256];
static unsigned int hB[256];
static unsigned int waveForm[screenWidth * 256];
static unsigned int paradeR[screenWidth * 256];
static unsigned int paradeG[screenWidth * 256];
static unsigned int paradeB[screenWidth * 256];
static unsigned int vectorScope[256 * 256];
#pragma data_seg(".analysisdata")
extern ID3D11Texture2D* backBufferPtr;
extern ID3D11Device* device;
extern ID3D11DeviceContext* deviceContext;
float fast_log2(float val)
{
int * const exp_ptr = reinterpret_cast <int *> (&val);
int x = *exp_ptr;
const int log_2 = ((x >> 23) & 255) - 128;
x &= ~(255 << 23);
x += 127 << 23;
*exp_ptr = x;
return (val + log_2);
}
void InitAnalysis(HWND hwnd)
{
backBufferPtr->GetDesc(&stagingDesc);
stagingDesc.Usage = D3D11_USAGE_DEFAULT;
stagingDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
stagingDesc.BindFlags = 0;
stagingDesc.SampleDesc.Count = 1;
device->CreateTexture2D(&stagingDesc, NULL, &resolvedTexture);
stagingDesc.Usage = D3D11_USAGE_STAGING;
stagingDesc.CPUAccessFlags |= D3D11_CPU_ACCESS_READ;
device->CreateTexture2D(&stagingDesc, NULL, &stagingTexture);
BITMAPINFO bmi;
bmi.bmiHeader.biSize = sizeof(BITMAPINFO);
bmi.bmiHeader.biWidth = 1024;
bmi.bmiHeader.biHeight = -512; // Order pixels from top to bottom
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32; // last byte not used, 32 bit for alignment
bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biSizeImage = 0;
bmi.bmiHeader.biXPelsPerMeter = 0;
bmi.bmiHeader.biYPelsPerMeter = 0;
bmi.bmiHeader.biClrUsed = 0;
bmi.bmiHeader.biClrImportant = 0;
bmi.bmiColors[0].rgbBlue = 0;
bmi.bmiColors[0].rgbGreen = 0;
bmi.bmiColors[0].rgbRed = 0;
bmi.bmiColors[0].rgbReserved = 0;
hdc = ::GetDC(hwnd);
hdcMem = CreateCompatibleDC(hdc);
hbmp = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, (void**)&pixels, NULL, 0);
}
void Analyze()
{
SelectObject(hdcMem, hbmp);
deviceContext->ResolveSubresource(resolvedTexture, 0, backBufferPtr, 0, stagingDesc.Format);
deviceContext->CopyResource(stagingTexture, resolvedTexture);
deviceContext->Map(stagingTexture, 0, D3D11_MAP_READ, 0, &analysisResource);
int* image = (int*)analysisResource.pData;
memset(pixels, 0, 1024 * 512 * 4);
memset(hR, 0, 256 * 4);
memset(hG, 0, 256 * 4);
memset(hB, 0, 256 * 4);
memset(waveForm, 0, screenWidth * 256 * 4);
memset(paradeR, 0, screenWidth * 256 * 4);
memset(paradeG, 0, screenWidth * 256 * 4);
memset(paradeB, 0, screenWidth * 256 * 4);
memset(vectorScope, 0, 256 * 256 * 4);
// Gather data
for (int y = 0; y < screenHeight; ++y)
{
for (int x = 0; x < screenWidth; ++x)
{
unsigned char* colors = (unsigned char*)&image[y * (analysisResource.RowPitch / 4) + x]; // BGRA
float luminance = 0.2126f * colors[2] + 0.7152f * colors[1] + 0.0722f * colors[0];
float umax = 0.436f;
float vmax = 0.615f;
float ly = luminance / 255.0f;
float fu = 0.492f * (colors[0] / 255.0f - ly);
float fv = 0.877f * (colors[2] / 255.0f - ly);
int u = min(255, max(0, 128 * (1 + fu / umax)));
int v = min(255, max(0, 128 * (1 + fv / vmax)));
int l = (int)(luminance);
waveForm[l * screenWidth + x]++;
vectorScope[v * 256 + u]++;
paradeR[colors[2] * screenWidth + x]++;
paradeG[colors[1] * screenWidth + x]++;
paradeB[colors[0] * screenWidth + x]++;
hR[colors[2]]++;
hG[colors[1]]++;
hB[colors[0]]++;
}
}
deviceContext->Unmap(stagingTexture, 0);
// Determine max values
float maxHistogramValue = 0;
float maxVectorscopeValue = 0;
float maxWaveForm = 0;
float maxParadeR = 0;
float maxParadeG = 0;
float maxParadeB = 0;
for (int i = 0; i < 256; ++i)
{
if (hR[i] > maxHistogramValue)
maxHistogramValue = hR[i];
if (hG[i] > maxHistogramValue)
maxHistogramValue = hG[i];
if (hB[i] > maxHistogramValue)
maxHistogramValue = hB[i];
for (int j = 0; j < screenWidth; ++j)
{
if (waveForm[i * screenWidth + j] > maxWaveForm)
maxWaveForm = waveForm[i * screenWidth + j];
if (paradeR[i * screenWidth + j] > maxParadeR)
maxParadeR = paradeR[i * screenWidth + j];
if (paradeG[i * screenWidth + j] > maxParadeG)
maxParadeG = paradeG[i * screenWidth + j];
if (paradeB[i * screenWidth + j] > maxParadeB)
maxParadeB = paradeB[i * screenWidth + j];
}
for (int j = 0; j < 256; ++j)
{
if (vectorScope[i * 256 + j] > maxVectorscopeValue)
maxVectorscopeValue = vectorScope[i * 256 + j];
}
}
maxHistogramValue = fast_log2(1 + maxHistogramValue);
maxVectorscopeValue = fast_log2(1 + maxVectorscopeValue);
maxWaveForm = fast_log2(1 + maxWaveForm);
maxParadeR = fast_log2(1 + maxParadeR);
maxParadeG = fast_log2(1 + maxParadeG);
maxParadeB = fast_log2(1 + maxParadeB);
// Draw histogram
int oldYR = 255;
int oldYG = 255;
int oldYB = 255;
for (int i = 0; i < 768; ++i)
{
int x = i * 256 / 768;
int yR = 255 - min(255, max(0, (int)(fast_log2(1 + hR[x]) * 256.0f / maxHistogramValue)));
int yG = 255 - min(255, max(0, (int)(fast_log2(1 + hG[x]) * 256.0f / maxHistogramValue)));
int yB = 255 - min(255, max(0, (int)(fast_log2(1 + hB[x]) * 256.0f / maxHistogramValue)));
if (oldYR < yR)
{
for (int y = oldYR; y <= yR; ++y)
pixels[y * 1024 + i] |= 0x000000FF;
}
else
{
for (int y = yR; y <= oldYR; ++y)
pixels[y * 1024 + i] |= 0x000000FF;
}
if (oldYG < yG)
{
for (int y = oldYG; y <= yG; ++y)
pixels[y * 1024 + i] |= 0x0000FF00;
}
else
{
for (int y = yG; y <= oldYG; ++y)
pixels[y * 1024 + i] |= 0x0000FF00;
}
if (oldYB < yB)
{
for (int y = oldYB; y <= yB; ++y)
pixels[y * 1024 + i] |= 0x00FF0000;
}
else
{
for (int y = yB; y <= oldYB; ++y)
pixels[y * 1024 + i] |= 0x00FF0000;
}
for (int y = yR; y <= 255; ++y)
pixels[y * 1024 + i] |= 0x00000080;
for (int y = yG; y <= 255; ++y)
pixels[y * 1024 + i] |= 0x00008000;
for (int y = yB; y <= 255; ++y)
pixels[y * 1024 + i] |= 0x00800000;
oldYR = yR;
oldYG = yG;
oldYB = yB;
}
for (int y = 0; y < 256; ++y)
{
// Draw Waveform and RGB parade
for (int wx = 0; wx < screenWidth; ++wx)
{
int x = (int)(wx * 255.0f / screenWidth);
int luminance = (int)(fast_log2(1 + waveForm[y * screenWidth + wx]) * 256.0f / maxWaveForm);
int r = (int)(fast_log2(1 + paradeR[y * screenWidth + wx]) * 256.0f / maxParadeR);
int g = (int)(fast_log2(1 + paradeG[y * screenWidth + wx]) * 256.0f / maxParadeG);
int b = (int)(fast_log2(1 + paradeB[y * screenWidth + wx]) * 256.0f / maxParadeB);
luminance = max(luminance, pixels[(511 - y) * 1024 + x] & 0x000000FF);
r = max(r, pixels[(511 - y) * 1024 + x + 768]);
g = max(g, pixels[(511 - y) * 1024 + x + 512] >> 8);
b = max(b, pixels[(511 - y) * 1024 + x + 256] >> 16);
int pixel = luminance | (luminance << 8) | (luminance << 16);
pixels[(511 - y) * 1024 + x] = pixel;
pixels[(511 - y) * 1024 + x + 768] = r;
pixels[(511 - y) * 1024 + x + 512] = g << 8;
pixels[(511 - y) * 1024 + x + 256] = b << 16;
}
// Draw Vectorscope
for (int x = 0; x < 256; ++x)
{
float luminance = 0.1f + 0.9f * (1.0f - max(0, min(1, fast_log2(vectorScope[y * 256 + x] + 1) / maxVectorscopeValue)));
float fx = (x - 128) / 128.0f;
float fy = (y - 128) / 128.0f;
if (fx*fx + fy*fy > 1)
luminance = 0.0f;
float umax = 0.436f;
float vmax = 0.615f;
float ly = 0.5;
float u = ((x / 128.0f) - 1.0f) * umax;
float v = ((y / 128.0f) - 1.0f) * vmax;
int r = luminance * 255.0f * min(1, max(0, (ly + v / 0.877f)));
int b = luminance * 255.0f * min(1, max(0, (ly + u / 0.492f)));
int g = luminance * 255.0f * min(1, max(0, (ly - u * 0.395f - v * 0.581f)));
int pixel = r | (g << 8) | (b << 16);
pixels[(255 - y) * 1024 + x + 768] = pixel;
}
}
RECT rect = { 0 };
rect.left = 0;
rect.top = 0;
DrawText(hdcMem, "Histogram", -1, &rect, DT_SINGLELINE | DT_NOCLIP);
rect.left = 768;
rect.top = 0;
DrawText(hdcMem, "Vectorscope", -1, &rect, DT_SINGLELINE | DT_NOCLIP);
rect.left = 0;
rect.top = 256;
DrawText(hdcMem, "Waveform", -1, &rect, DT_SINGLELINE | DT_NOCLIP);
rect.left = 256;
rect.top = 256;
DrawText(hdcMem, "RGB Parade", -1, &rect, DT_SINGLELINE | DT_NOCLIP);
BitBlt(hdc, 0, 0, 1024, 512, hdcMem, 0, 0, SRCCOPY);
}

1040
hgplus/bliss/Engine/data.h Normal file

File diff suppressed because it is too large Load Diff

1024
hgplus/bliss/Engine/main.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,657 @@
#include "data.h"
#include "shaders.h"
enum RenderMode
{
Normal,
Shadow,
Water
};
#pragma code_seg("._ftol2_sse")
extern "C" __forceinline unsigned long _ftol2_sse(float Value)
{
__asm fld Value
__asm fistp dword ptr[eax]
}
#pragma code_seg(".InitD3D")
__forceinline void InitD3D()
{
swapChainDesc.OutputWindow = hwnd;
D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, D3D_DEVICE_FLAGS, featureLevel, 1, D3D11_SDK_VERSION, &swapChainDesc, &swapChain, &device, NULL, &deviceContext);
swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&backBufferPtr);
_asm
{
XOR EDI, EDI
MOV ESI, dword ptr[device]
MOV EBX, [ESI]
PUSH offset swapChainDepthStencilBuffer
PUSH EDI
PUSH offset depthBufferDesc
PUSH ESI
PUSH offset shadowDepthStencilBuffer
PUSH EDI
PUSH offset shadowDepthBufferDesc
PUSH ESI
PUSH offset backBufferTexture
PUSH EDI
PUSH offset backBuffer1Desc
PUSH ESI
PUSH offset terrainDiffuseRenderTexture
PUSH EDI
PUSH offset terrainRenderTextureDesc
PUSH ESI
PUSH offset terrainRenderTexture
PUSH EDI
PUSH offset terrainRenderTextureDesc
PUSH ESI
PUSH offset floraRenderTexture
PUSH EDI
PUSH offset floraRenderTextureDesc
PUSH ESI
PUSH offset depthRenderTexture
PUSH EDI
PUSH offset depthRenderTextureDesc
PUSH ESI
CALL dword ptr[EBX + 0x14]
CALL dword ptr[EBX + 0x14]
CALL dword ptr[EBX + 0x14]
CALL dword ptr[EBX + 0x14]
CALL dword ptr[EBX + 0x14]
CALL dword ptr[EBX + 0x14]
CALL dword ptr[EBX + 0x14]
PUSH offset constantBuffers + 0
PUSH EDI
PUSH offset constantBuffer1Desc
PUSH ESI
PUSH offset constantBuffers + 4
PUSH EDI
PUSH offset constantBuffer2Desc
PUSH ESI
PUSH offset constantBufferTemp
PUSH EDI
PUSH offset constantBufferTempDesc
PUSH ESI
PUSH offset vertexBuffer
PUSH EDI
PUSH offset vertexBufferDesc
PUSH ESI
PUSH offset cellBuffer
PUSH EDI
PUSH offset cellBufferDesc
PUSH ESI
PUSH offset plantInstanceBuffer
PUSH EDI
PUSH offset instanceBufferDescs + 0x0
PUSH ESI
PUSH offset soBuffers + 0
PUSH EDI
PUSH offset instanceBufferDescs + 0x18
PUSH ESI
PUSH offset soBuffers + 4
PUSH EDI
PUSH offset instanceBufferDescs + 0x30
PUSH ESI
PUSH offset multipliedPlantInstanceBuffer
PUSH EDI
PUSH offset instanceBufferDescs + 0x48
PUSH ESI
PUSH offset multipliedFlowerInstanceBuffer
PUSH EDI
PUSH offset instanceBufferDescs + 0x60
PUSH ESI
PUSH offset terrainBuffers + 0
PUSH EDI
PUSH offset instanceBufferDescs + 0x78
PUSH ESI
PUSH offset terrainBuffers + 4
PUSH EDI
PUSH offset instanceBufferDescs + 0x78
PUSH ESI
PUSH offset solidRasterState
PUSH offset solidRasterDesc
PUSH ESI
PUSH offset solidFrontCullingRasterState
PUSH offset solidFrontCullingRasterDesc
PUSH ESI
PUSH offset solidNoCullingRasterState
PUSH offset solidNoCullingRasterDesc
PUSH ESI
PUSH offset swapChainDepthStencilView
PUSH offset depthStencilViewDesc
PUSH dword ptr[swapChainDepthStencilBuffer]
PUSH ESI
PUSH offset shadowDepthStencilView
PUSH offset depthStencilViewDesc
PUSH dword ptr[shadowDepthStencilBuffer]
PUSH ESI
PUSH offset depthStencilState
PUSH offset depthStencilDesc
PUSH ESI
PUSH offset noDepthStencilState
PUSH offset noDepthStencilDesc
PUSH ESI
PUSH offset alphaEnableBlendingState
PUSH offset blendStateDescription
PUSH ESI
PUSH offset samplerStates + 0
PUSH offset samplerDesc
PUSH ESI
PUSH offset samplerStates + 4
PUSH offset compSamplerDesc
PUSH ESI
PUSH offset samplerStates + 8
PUSH offset clampSamplerDesc
PUSH ESI
PUSH offset depthStencilShaderResourceView
PUSH offset depthStencilResourceViewDesc
PUSH dword ptr[swapChainDepthStencilBuffer]
PUSH ESI
PUSH offset terrainViews + 4
PUSH offset shaderResourceViewDesc
PUSH dword ptr[terrainDiffuseRenderTexture]
PUSH ESI
PUSH offset terrainViews + 8
PUSH offset depthResourceViewDesc
PUSH dword ptr[depthRenderTexture]
PUSH ESI
PUSH offset plantResources + 0
PUSH offset shaderResourceViewDesc
PUSH dword ptr[terrainRenderTexture]
PUSH ESI
PUSH offset plantResources + 4
PUSH offset shaderResourceViewDesc
PUSH dword ptr[floraRenderTexture]
PUSH ESI
PUSH offset postProcessResources + 12
PUSH offset backBufferShaderResourceViewDesc
PUSH dword ptr[backBufferTexture]
PUSH ESI
PUSH offset swapChainRenderTargetView
PUSH EDI
PUSH dword ptr[backBufferPtr]
PUSH ESI
PUSH offset terrainDiffuseRenderTargetView
PUSH offset renderTargetViewDesc
PUSH dword ptr[terrainDiffuseRenderTexture]
PUSH ESI
PUSH offset backBufferRenderTargetView
PUSH offset backBufferRenderTargetViewDesc
PUSH dword ptr[backBufferTexture]
PUSH ESI
PUSH offset heightMapRenderTargetView
PUSH offset renderTargetViewDesc
PUSH dword ptr[terrainRenderTexture]
PUSH ESI
PUSH offset floraTextureRenderTargetView
PUSH offset renderTargetViewDesc
PUSH dword ptr[floraRenderTexture]
PUSH ESI
PUSH offset depthTextureRenderTargetView
PUSH offset depthRenderTargetViewDesc
PUSH dword ptr[depthRenderTexture]
PUSH ESI
CALL dword ptr[EBX + 0x24]
CALL dword ptr[EBX + 0x24]
CALL dword ptr[EBX + 0x24]
CALL dword ptr[EBX + 0x24]
CALL dword ptr[EBX + 0x24]
CALL dword ptr[EBX + 0x24]
CALL dword ptr[EBX + 0x1C]
CALL dword ptr[EBX + 0x1C]
CALL dword ptr[EBX + 0x1C]
CALL dword ptr[EBX + 0x1C]
CALL dword ptr[EBX + 0x1C]
CALL dword ptr[EBX + 0x1C]
CALL dword ptr[EBX + 0x5C]
CALL dword ptr[EBX + 0x5C]
CALL dword ptr[EBX + 0x5C]
CALL dword ptr[EBX + 0x50]
CALL dword ptr[EBX + 0x54]
CALL dword ptr[EBX + 0x54]
CALL dword ptr[EBX + 0x28]
CALL dword ptr[EBX + 0x28]
CALL dword ptr[EBX + 0x58]
CALL dword ptr[EBX + 0x58]
CALL dword ptr[EBX + 0x58]
CALL dword ptr[EBX + 0x0C]
CALL dword ptr[EBX + 0x0C]
CALL dword ptr[EBX + 0x0C]
CALL dword ptr[EBX + 0x0C]
CALL dword ptr[EBX + 0x0C]
CALL dword ptr[EBX + 0x0C]
CALL dword ptr[EBX + 0x0C]
CALL dword ptr[EBX + 0x0C]
CALL dword ptr[EBX + 0x0C]
CALL dword ptr[EBX + 0x0C]
CALL dword ptr[EBX + 0x0C]
CALL dword ptr[EBX + 0x0C]
}
/*device->CreateTexture2D(&depthBufferDesc, NULL, &swapChainDepthStencilBuffer);
device->CreateTexture2D(&shadowDepthBufferDesc, NULL, &shadowDepthStencilBuffer);
device->CreateTexture2D(&backBuffer1Desc, NULL, &backBufferTexture);
device->CreateTexture2D(&terrainRenderTextureDesc, NULL, &terrainDiffuseRenderTexture);
device->CreateTexture2D(&terrainRenderTextureDesc, NULL, &terrainRenderTexture);
device->CreateTexture2D(&floraRenderTextureDesc, NULL, &floraRenderTexture);
device->CreateTexture2D(&depthRenderTextureDesc, NULL, &depthRenderTexture);*/
//device->CreateRenderTargetView(backBufferPtr, NULL, &swapChainRenderTargetView);
//device->CreateRenderTargetView(terrainDiffuseRenderTexture, &renderTargetViewDesc, &terrainDiffuseRenderTargetView);
//device->CreateRenderTargetView(backBufferTexture, &backBufferRenderTargetViewDesc, &backBufferRenderTargetView);
//device->CreateRenderTargetView(terrainRenderTexture, &renderTargetViewDesc, &heightMapRenderTargetView);
//device->CreateRenderTargetView(floraRenderTexture, &renderTargetViewDesc, &floraTextureRenderTargetView);
//device->CreateRenderTargetView(depthRenderTexture, &depthRenderTargetViewDesc, &depthTextureRenderTargetView);
//device->CreateShaderResourceView(terrainDiffuseRenderTexture, &shaderResourceViewDesc, &terrainViews[1]);
//device->CreateShaderResourceView(backBufferTexture, &backBufferShaderResourceViewDesc, &postProcessResources[3]);
//device->CreateShaderResourceView(terrainRenderTexture, &shaderResourceViewDesc, &plantResources[0]);
//device->CreateShaderResourceView(floraRenderTexture, &shaderResourceViewDesc, &plantResources[1]);
//device->CreateShaderResourceView(depthRenderTexture, &depthResourceViewDesc, &terrainViews[2]);
//device->CreateShaderResourceView(swapChainDepthStencilBuffer, &depthStencilResourceViewDesc, &depthStencilShaderResourceView);
//device->CreateSamplerState(&samplerDesc, &samplerStates[0]);
//device->CreateSamplerState(&compSamplerDesc, &samplerStates[1]);
//device->CreateSamplerState(&clampSamplerDesc, &samplerStates[2]);
//device->CreateBlendState(&blendStateDescription, &alphaEnableBlendingState);
//device->CreateDepthStencilState(&depthStencilDesc, &depthStencilState);
//device->CreateDepthStencilState(&noDepthStencilDesc, &noDepthStencilState);
//device->CreateDepthStencilView(swapChainDepthStencilBuffer, &depthStencilViewDesc, &swapChainDepthStencilView);
//device->CreateDepthStencilView(shadowDepthStencilBuffer, &depthStencilViewDesc, &shadowDepthStencilView);
//device->CreateRasterizerState(&solidRasterDesc, &solidRasterState);
//device->CreateRasterizerState(&solidNoCullingRasterDesc, &solidNoCullingRasterState);
//device->CreateRasterizerState(&solidFrontCullingRasterDesc, &solidFrontCullingRasterState);
//device->CreateBuffer(&constantBuffer1Desc, NULL, &constantBuffers[0]);
//device->CreateBuffer(&constantBuffer2Desc, NULL, &constantBuffers[1]);
//device->CreateBuffer(&constantBufferTempDesc, NULL, &constantBufferTemp);
//device->CreateBuffer(&vertexBufferDesc, NULL, &vertexBuffer);
//device->CreateBuffer(&cellBufferDesc, NULL, &cellBuffer);
//device->CreateBuffer(&instanceBufferDescs[0], NULL, &plantInstanceBuffer);
//device->CreateBuffer(&instanceBufferDescs[1], NULL, &soBuffers[0]);
//device->CreateBuffer(&instanceBufferDescs[2], NULL, &soBuffers[1]);
//device->CreateBuffer(&instanceBufferDescs[3], NULL, &multipliedPlantInstanceBuffer);
//device->CreateBuffer(&instanceBufferDescs[4], NULL, &multipliedFlowerInstanceBuffer);
//device->CreateBuffer(&instanceBufferDescs[5], NULL, &terrainBuffers[0]);
//device->CreateBuffer(&instanceBufferDescs[5], NULL, &terrainBuffers[1]);
terrainViews[0] = plantResources[0];
}
#pragma code_seg(".UpdateFrameConstantBuffer")
void UpdateFrameConstantBuffer()
{
deviceContext->VSSetSamplers(0, 3, samplerStates);
deviceContext->HSSetSamplers(0, 3, samplerStates);
deviceContext->GSSetSamplers(0, 3, samplerStates);
deviceContext->DSSetSamplers(0, 3, samplerStates);
deviceContext->PSSetSamplers(0, 3, samplerStates);
deviceContext->VSSetConstantBuffers(0, 2, constantBuffers);
deviceContext->GSSetConstantBuffers(0, 2, constantBuffers);
deviceContext->HSSetConstantBuffers(0, 2, constantBuffers);
deviceContext->DSSetConstantBuffers(0, 2, constantBuffers);
deviceContext->PSSetConstantBuffers(0, 2, constantBuffers);
deviceContext->VSSetShader(constantBufferVertexShader, NULL, 0);
deviceContext->GSSetShader(constantBufferGeometryShader, NULL, 0);
deviceContext->SOSetTargets(1, &constantBufferTemp, (UINT*)zero);
deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
deviceContext->Draw(1, 0);
deviceContext->CopyResource(constantBuffers[1], constantBufferTemp);
}
#pragma code_seg(".BeginRender")
void BeginRender(RenderMode mode)
{
deviceContext->Map(constantBuffers[0], 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
auto constantBufferVertexData = (ConstantBuffer1Type*)mappedResource.pData;
constantBufferVertexData->time = time;
constantBufferVertexData->shader = mode;
constantBufferVertexData->screenY = screenHeight;
constantBufferVertexData->aspect = aspectRatio;
deviceContext->Unmap(constantBuffers[0], 0);
}
#pragma code_seg(".InitBuffers")
__forceinline void InitBuffers()
{
deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
deviceContext->SOSetTargets(1, &cellBuffer, (UINT*)zero);
deviceContext->VSSetShader(cellBufferVertexShader, NULL, 0);
deviceContext->GSSetShader(cellBufferGeometryShader, NULL, 0);
deviceContext->Draw(CELL_COUNT, 0);
deviceContext->SOSetTargets(1, &vertexBuffer, (UINT*)zero);
deviceContext->VSSetShader(vertexBufferVertexShader, NULL, 0);
deviceContext->GSSetShader(vertexBufferGeometryShader, NULL, 0);
deviceContext->Draw(VERTEX_COUNT, 0);
}
#pragma code_seg(".RenderPlantPositions")
__forceinline void RenderPlantPositions()
{
deviceContext->SOSetTargets(2, soBuffers, (UINT*)zero);
deviceContext->IASetInputLayout(instancedLayout);
deviceContext->IASetVertexBuffers(0, 1, &plantInstanceBuffer, &strides[1], (UINT*)zero);
deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
deviceContext->VSSetShader(instanceVertexShader, NULL, 0);
deviceContext->GSSetShaderResources(0, 1, &plantResources[0]);
deviceContext->GSSetShader(rotationGeometryShader, NULL, 0);
deviceContext->DrawAuto();
deviceContext->GSSetShader(multiplyGeometryShader, NULL, 0);
deviceContext->SOSetTargets(1, &multipliedPlantInstanceBuffer, (UINT*)zero);
deviceContext->IASetVertexBuffers(0, 1, &soBuffers[0], &strides[1], (UINT*)zero);
deviceContext->DrawAuto();
deviceContext->SOSetTargets(1, &multipliedFlowerInstanceBuffer, (UINT*)zero);
deviceContext->IASetVertexBuffers(0, 1, &soBuffers[1], &strides[1], (UINT*)zero);
deviceContext->DrawAuto();
deviceContext->SOSetTargets(0, (ID3D11Buffer* const*)zero, (UINT*)zero);
}
#pragma code_seg(".RenderPlants")
void RenderPlants(RenderMode mode)
{
deviceContext->IASetInputLayout(instancedLayout);
deviceContext->IASetVertexBuffers(0, 1, &multipliedPlantInstanceBuffer, &strides[1], (UINT*)zero);
deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST);
deviceContext->VSSetShader(plantVertexShader, NULL, 0);
deviceContext->HSSetShader(hullShaderPlant, NULL, 0);
deviceContext->DSSetShader(mode == Normal ? plantDomainNormalShader : plantDomainShadowShader, NULL, 0);
deviceContext->GSSetShader(NULL, NULL, 0);
deviceContext->PSSetShader(mode == Normal ? plantPixelNormalShader : plantPixelShadowShader, NULL, 0);
deviceContext->VSSetShaderResources(0, 2, plantResources);
deviceContext->HSSetShaderResources(0, 2, plantResources);
deviceContext->DSSetShaderResources(0, 2, plantResources);
deviceContext->PSSetShaderResources(0, 2, plantResources);
if (mode == Normal)
deviceContext->OMSetBlendState(alphaEnableBlendingState, zero, 0xffffffff);
deviceContext->DrawAuto();
deviceContext->DSSetShader(mode == Normal ? flowerDomainNormalShader : flowerDomainShadowShader, NULL, 0);
deviceContext->PSSetShader(mode == Normal ? flowerPixelNormalShader : plantPixelShadowShader, NULL, 0);
deviceContext->IASetVertexBuffers(0, 1, &multipliedFlowerInstanceBuffer, &strides[1], (UINT*)zero);
deviceContext->DrawAuto();
}
#pragma code_seg(".RenderTextures")
__forceinline void RenderTextures()
{
deviceContext->RSSetState(solidRasterState);
deviceContext->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
deviceContext->VSSetShader(textureVertexShader, NULL, 0);
deviceContext->GSSetShader(NULL, NULL, 0);
deviceContext->OMSetDepthStencilState(noDepthStencilState, 1);
deviceContext->VSSetShaderResources(0, 4, (ID3D11ShaderResourceView* const*)zero);
deviceContext->HSSetShaderResources(0, 4, (ID3D11ShaderResourceView* const*)zero);
deviceContext->DSSetShaderResources(0, 4, (ID3D11ShaderResourceView* const*)zero);
deviceContext->GSSetShaderResources(0, 4, (ID3D11ShaderResourceView* const*)zero);
deviceContext->PSSetShaderResources(0, 4, (ID3D11ShaderResourceView* const*)zero);
deviceContext->OMSetRenderTargets(1, &heightMapRenderTargetView, NULL);
deviceContext->RSSetViewports(1, &terrainTextureViewport);
deviceContext->PSSetShader(heightMapPixelShader, NULL, 0);
deviceContext->SOSetTargets(0, (ID3D11Buffer* const*)zero, (UINT*)zero);
deviceContext->Draw(4, 0);
deviceContext->OMSetRenderTargets(1, &terrainDiffuseRenderTargetView, NULL);
deviceContext->PSSetShaderResources(0, 1, &plantResources[0]);
deviceContext->PSSetShader(terrainTexturePixelShader, NULL, 0);
deviceContext->Draw(4, 0);
deviceContext->OMSetRenderTargets(1, &floraTextureRenderTargetView, NULL);
deviceContext->RSSetViewports(1, &floraTextureViewport);
deviceContext->PSSetShader(plantTexturePixelShader, NULL, 0);
deviceContext->Draw(4, 0);
deviceContext->GenerateMips(terrainViews[1]);
deviceContext->GenerateMips(plantResources[0]);
deviceContext->GenerateMips(plantResources[1]);
deviceContext->IASetInputLayout(layout);
deviceContext->IASetVertexBuffers(0, 1, &cellBuffer, strides, (UINT*)zero);
deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
deviceContext->VSSetShader(terrainVertexShader, NULL, 0);
deviceContext->GSSetShader(plantInstanceGeometryShader, NULL, 0);
deviceContext->SOSetTargets(1, &plantInstanceBuffer, (UINT*)zero);
deviceContext->VSSetShaderResources(0, 1, &plantResources[0]);
deviceContext->GSSetShaderResources(0, 1, &plantResources[0]);
deviceContext->Draw(CELL_COUNT, 0);
}
#pragma code_seg(".Postprocess")
__forceinline void Postprocess()
{
BeginRender(Normal);
deviceContext->RSSetState(solidRasterState);
deviceContext->OMSetDepthStencilState(noDepthStencilState, 1);
deviceContext->OMSetRenderTargets(1, &swapChainRenderTargetView, NULL);
deviceContext->RSSetViewports(1, &swapChainViewport);
deviceContext->IASetInputLayout(NULL);
deviceContext->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
deviceContext->VSSetShader(textureVertexShader, NULL, 0);
deviceContext->HSSetShader(NULL, NULL, 0);
deviceContext->DSSetShader(NULL, NULL, 0);
deviceContext->PSSetShader(postProcessPixelShader, NULL, 0);
deviceContext->PSSetShaderResources(0, 4, postProcessResources);
deviceContext->Draw(4, 0);
deviceContext->PSSetShaderResources(0, 4, (ID3D11ShaderResourceView* const*)zero);
}
#pragma code_seg(".RenderCloud")
__forceinline void RenderCloud()
{
BeginRender(Normal);
deviceContext->RSSetState(solidRasterState);
deviceContext->OMSetDepthStencilState(noDepthStencilState, 1);
deviceContext->IASetInputLayout(NULL);
deviceContext->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
deviceContext->VSSetShader(textureVertexShader, NULL, 0);
deviceContext->HSSetShader(NULL, NULL, 0);
deviceContext->DSSetShader(NULL, NULL, 0);
deviceContext->PSSetShader(cloudPixelShader, NULL, 0);
deviceContext->Draw(4, 0);
}
#pragma code_seg(".RenderTerrain")
__forceinline void RenderTerrain()
{
deviceContext->IASetInputLayout(layout);
deviceContext->IASetVertexBuffers(0, 1, &vertexBuffer, strides, (UINT*)zero);
deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST);
deviceContext->VSSetShader(terrainVertexShader, NULL, 0);
deviceContext->HSSetShader(hullShader, NULL, 0);
deviceContext->DSSetShader(terrainDomainShader, NULL, 0);
deviceContext->GSSetShader(terrainGeometryShader, NULL, 0);
deviceContext->PSSetShader(NULL, NULL, 0);
deviceContext->SOSetTargets(2, terrainBuffers, (UINT*)zero);
deviceContext->VSSetShaderResources(0, 3, terrainViews);
deviceContext->HSSetShaderResources(0, 3, terrainViews);
deviceContext->DSSetShaderResources(0, 3, terrainViews);
deviceContext->GSSetShaderResources(0, 3, terrainViews);
deviceContext->Draw(VERTEX_COUNT, 0);
deviceContext->SOSetTargets(0, (ID3D11Buffer* const*)zero, (UINT*)zero);
deviceContext->OMSetDepthStencilState(depthStencilState, 1);
BeginRender(Water);
deviceContext->VSSetShader(terrainProjectVertexShader, NULL, 0);
deviceContext->HSSetShader(NULL, NULL, 0);
deviceContext->DSSetShader(NULL, NULL, 0);
deviceContext->GSSetShader(NULL, NULL, 0);
deviceContext->PSSetShader(terrainPixelShader, NULL, 0);
deviceContext->PSSetShaderResources(0, 3, terrainViews);
deviceContext->RSSetState(solidFrontCullingRasterState);
deviceContext->IASetInputLayout(layout);
deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
deviceContext->IASetVertexBuffers(0, 1, &terrainBuffers[0], strides, (UINT*)zero);
deviceContext->DrawAuto();
BeginRender(Normal);
deviceContext->OMSetBlendState(alphaEnableBlendingState, zero, 0xffffffff);
deviceContext->RSSetState(solidRasterState);
deviceContext->IASetVertexBuffers(0, 1, &terrainBuffers[1], strides, (UINT*)zero);
deviceContext->DrawAuto();
deviceContext->OMSetBlendState(NULL, NULL, 0xffffffff);
deviceContext->VSSetShaderResources(0, 3, (ID3D11ShaderResourceView* const *)zero);
deviceContext->HSSetShaderResources(0, 3, (ID3D11ShaderResourceView* const *)zero);
deviceContext->DSSetShaderResources(0, 3, (ID3D11ShaderResourceView* const *)zero);
deviceContext->GSSetShaderResources(0, 3, (ID3D11ShaderResourceView* const *)zero);
deviceContext->PSSetShaderResources(0, 3, (ID3D11ShaderResourceView* const *)zero);
}
#pragma code_seg(".RenderShadow")
__forceinline void RenderShadow()
{
deviceContext->ClearDepthStencilView(shadowDepthStencilView, D3D11_CLEAR_DEPTH, 1.0f, 0);
deviceContext->ClearRenderTargetView(depthTextureRenderTargetView, depthClearColor);
deviceContext->OMSetRenderTargets(1, &depthTextureRenderTargetView, shadowDepthStencilView);
deviceContext->RSSetViewports(1, &depthTextureViewport);
BeginRender(Shadow);
RenderPlantPositions();
deviceContext->RSSetState(solidRasterState);
deviceContext->OMSetBlendState(NULL, NULL, 0xffffffff);
RenderPlants(Shadow);
}
#pragma code_seg(".Frame")
__forceinline void Frame()
{
waveOutGetPosition(hWaveOut, &mmtime, sizeof(MMTIME));
time = mmtime.u.sample / (MAX_SAMPLES / 38.0f);
UpdateFrameConstantBuffer();
RenderShadow();
deviceContext->ClearDepthStencilView(swapChainDepthStencilView, D3D11_CLEAR_DEPTH, 1.0f, 0);
deviceContext->OMSetRenderTargets(1, &backBufferRenderTargetView, swapChainDepthStencilView);
deviceContext->RSSetViewports(1, &swapChainViewport);
RenderCloud();
RenderTerrain();
deviceContext->RSSetState(solidNoCullingRasterState);
RenderPlants(Normal);
Postprocess();
swapChain->Present(1, 0);
}
#pragma code_seg(".initsnd")
__forceinline void InitSound()
{
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)_4klang_render, soundBuffer, 0, 0);
::Sleep(8192);// give the 4klang render call some time
waveOutOpen(&hWaveOut, -1, &WaveFMT, 0, 0, 0);
//waveOutPrepareHeader(hWaveOut, &WaveHDR, 0x20);
waveOutWrite(hWaveOut, &WaveHDR, 0x20);
}
#pragma code_seg(".main")
void main()
{
hwnd = CreateWindowExA(0, (LPCSTR)0x0000C019, 0, WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, screenWidth + 16, screenHeight + 40, 0, 0, 0, 0);
ShowCursor(false);
#ifdef FULLSCREEN
ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);
#endif
InitD3D();
CreateShaders();
InitBuffers();
BeginRender(Normal);
UpdateFrameConstantBuffer();
RenderTextures();
InitSound();
while (!GetAsyncKeyState(VK_ESCAPE) && time < 19)
Frame();
ExitProcess(0);
}

View File

@@ -0,0 +1,168 @@
#ifdef _DEBUG
class Profiler
{
public:
static Profiler GlobalProfiler;
bool EnableProfiling;
void Initialize(ID3D11Device* device, ID3D11DeviceContext* immContext)
{
this->device = device;
this->context = immContext;
this->currentFrame = 0;
this->EnableProfiling = false;
}
void StartFrame()
{
currentFrame++;
profileCount = 0;
if (!EnableProfiling)
return;
startFrame = currentFrame;
}
int StartProfile(char* name)
{
if (!EnableProfiling)
return -1;
int index = profileCount++;
ProfileData& profileData = profiles[index];
profileData.Name = name;
// Create the queries
D3D11_QUERY_DESC desc;
desc.Query = D3D11_QUERY_TIMESTAMP_DISJOINT;
desc.MiscFlags = 0;
device->CreateQuery(&desc, &profileData.DisjointQuery);
desc.Query = D3D11_QUERY_TIMESTAMP;
device->CreateQuery(&desc, &profileData.TimestampStartQuery);
device->CreateQuery(&desc, &profileData.TimestampEndQuery);
// Start a disjoint query first
context->Begin(profileData.DisjointQuery);
// Insert the start timestamp
context->End(profileData.TimestampStartQuery);
profileData.QueryStarted = TRUE;
profileData.QueryFinished = FALSE;
return index;
}
void EndProfile(int index)
{
if (!EnableProfiling)
return;
ProfileData& profileData = profiles[index];
if (profileData.QueryFinished)
throw;
// Insert the end timestamp
context->End(profileData.TimestampEndQuery);
// End the disjoint query
context->End(profileData.DisjointQuery);
profileData.QueryStarted = FALSE;
profileData.QueryFinished = TRUE;
}
void EndFrame()
{
if (currentFrame < startFrame + queryLatency)
return;
if (!EnableProfiling)
return;
deviceContext->Flush();
EnableProfiling = false;
float queryTime = 0.0f;
// Iterate over all of the profiles
for (int i = 0; i < profileCount; ++i)
{
ProfileData& profile = profiles[i];
if (profile.QueryFinished == FALSE)
continue;
profile.QueryFinished = FALSE;
// Get the query data
UINT64 startTime = 0;
while (context->GetData(profile.TimestampStartQuery, &startTime, sizeof(startTime), 0) != S_OK);
UINT64 endTime = 0;
while (context->GetData(profile.TimestampEndQuery, &endTime, sizeof(endTime), 0) != S_OK);
D3D11_QUERY_DATA_TIMESTAMP_DISJOINT disjointData;
while (context->GetData(profile.DisjointQuery, &disjointData, sizeof(disjointData), 0) != S_OK);
float time = 9.0f;
if (disjointData.Disjoint == FALSE)
{
UINT64 delta = endTime - startTime;
float frequency = static_cast<float>(disjointData.Frequency);
time = (delta * 1000.0f) / frequency;
}
char message[256] = { 0 };
sprintf_s(message, 256, "%s: %.8f ms\n", profile.Name, time);
printf(message);
OutputDebugStringA(message);
}
}
protected:
struct ProfileData
{
ID3D11Query* DisjointQuery;
ID3D11Query* TimestampStartQuery;
ID3D11Query* TimestampEndQuery;
BOOL QueryStarted;
BOOL QueryFinished;
char* Name;
ProfileData() : QueryStarted(FALSE), QueryFinished(FALSE) {}
};
typedef ProfileData ProfileMap[64];
ProfileMap profiles;
int profileCount;
int startFrame;
int currentFrame;
const int queryLatency = 5;
ID3D11Device* device;
ID3D11DeviceContext* context;
};
struct ProfileBlock
{
public:
ProfileBlock(char* name)
{
this->index = Profiler::GlobalProfiler.StartProfile(name);
}
~ProfileBlock()
{
Profiler::GlobalProfiler.EndProfile(this->index);
}
protected:
int index;
};
Profiler Profiler::GlobalProfiler;
#endif

View File

@@ -0,0 +1,44 @@
if "%1"=="Release" goto Release
if "%1"=="Compress" goto Release
if "%1"=="DebugShader" goto Debug
echo "Not happening, %1."
goto End
:Debug
fxc /Zi /E"VS" /Od /Fo"%3%1\VS.cso" /Fd"%3%1\VS.pdb" /T vs_5_0 /nologo %2
fxc /Zi /E"VSCB" /Od /Fo"%3%1\VSCB.cso" /Fd"%3%1\VSCB.pdb" /T vs_5_0 /nologo %2
fxc /Zi /E"VSP" /Od /Fo"%3%1\VSP.cso" /Fd"%3%1\VSP.pdb" /T vs_5_0 /nologo %2
fxc /Zi /E"VSC" /Od /Fo"%3%1\VSC.cso" /Fd"%3%1\VSC.pdb" /T vs_5_0 /nologo %2
fxc /Zi /E"VSV" /Od /Fo"%3%1\VSV.cso" /Fd"%3%1\VSV.pdb" /T vs_5_0 /nologo %2
fxc /Zi /E"HS" /Od /Fo"%3%1\HS.cso" /Fd"%3%1\HS.pdb" /T hs_5_0 /nologo %2
fxc /Zi /E"HSP" /Od /Fo"%3%1\HSP.cso" /Fd"%3%1\HSP.pdb" /T hs_5_0 /nologo %2
fxc /Zi /E"DS" /Od /Fo"%3%1\DS.cso" /Fd"%3%1\DS.pdb" /T ds_5_0 /nologo %2
fxc /Zi /E"DSPN" /Od /Fo"%3%1\DSPN.cso" /Fd"%3%1\DSPN.pdb" /T ds_5_0 /nologo %2
fxc /Zi /E"DSPS" /Od /Fo"%3%1\DSPS.cso" /Fd"%3%1\DSPS.pdb" /T ds_5_0 /nologo %2
fxc /Zi /E"DSFN" /Od /Fo"%3%1\DSFN.cso" /Fd"%3%1\DSFN.pdb" /T ds_5_0 /nologo %2
fxc /Zi /E"DSFS" /Od /Fo"%3%1\DSFS.cso" /Fd"%3%1\DSFS.pdb" /T ds_5_0 /nologo %2
fxc /Zi /E"VST" /Od /Fo"%3%1\VST.cso" /Fd"%3%1\VST.pdb" /T vs_5_0 /nologo %2
fxc /Zi /E"VSTP" /Od /Fo"%3%1\VSTP.cso" /Fd"%3%1\VSTP.pdb" /T vs_5_0 /nologo %2
fxc /Zi /E"PS" /Od /Fo"%3%1\PS.cso" /Fd"%3%1\PS.pdb" /T ps_5_0 /nologo %2
fxc /Zi /E"PSH" /Od /Fo"%3%1\PSH.cso" /Fd"%3%1\PSH.pdb" /T ps_5_0 /nologo %2
fxc /Zi /E"PSTN" /Od /Fo"%3%1\PSTN.cso" /Fd"%3%1\PSTN.pdb" /T ps_5_0 /nologo %2
fxc /Zi /E"FSTN" /Od /Fo"%3%1\FSTN.cso" /Fd"%3%1\FSTN.pdb" /T ps_5_0 /nologo %2
fxc /Zi /E"PSTS" /Od /Fo"%3%1\PSTS.cso" /Fd"%3%1\PSTS.pdb" /T ps_5_0 /nologo %2
fxc /Zi /E"PSTD" /Od /Fo"%3%1\PSTD.cso" /Fd"%3%1\PSTD.pdb" /T ps_5_0 /nologo %2
fxc /Zi /E"PSDD" /Od /Fo"%3%1\PSDD.cso" /Fd"%3%1\PSDD.pdb" /T ps_5_0 /nologo %2
fxc /Zi /E"PSP" /Od /Fo"%3%1\PSP.cso" /Fd"%3%1\PSP.pdb" /T ps_5_0 /nologo %2
fxc /Zi /E"PSC" /Od /Fo"%3%1\PSC.cso" /Fd"%3%1\PSC.pdb" /T ps_5_0 /nologo %2
fxc /Zi /E"PSPS" /Od /Fo"%3%1\PSPS.cso" /Fd"%3%1\PSPS.pdb" /T ps_5_0 /nologo %2
fxc /Zi /E"GSP" /Od /Fo"%3%1\GSP.cso" /Fd"%3%1\GSP.pdb" /T gs_5_0 /nologo %2
fxc /Zi /E"GSM" /Od /Fo"%3%1\GSM.cso" /Fd"%3%1\GSM.pdb" /T gs_5_0 /nologo %2
fxc /Zi /E"GSR" /Od /Fo"%3%1\GSR.cso" /Fd"%3%1\GSR.pdb" /T gs_5_0 /nologo %2
fxc /Zi /E"GSQ" /Od /Fo"%3%1\GSQ.cso" /Fd"%3%1\GSQ.pdb" /T gs_5_0 /nologo %2
fxc /Zi /E"GST" /Od /Fo"%3%1\GST.cso" /Fd"%3%1\GST.pdb" /T gs_5_0 /nologo %2
fxc /Zi /E"VSM" /Od /Fo"%3%1\VSM.cso" /Fd"%3%1\VSM.pdb" /T vs_5_0 /nologo %2
goto End
:Release
..\ShaderMinifier\shader_minifier.exe -o %3Engine\Shader.h --hlsl --no-renaming-list VS,VSV,VSC,VSCB,VSP,HS,HSP,DS,DSFN,DSFS,DSPN,DSPS,VST,PSTS,PSTN,VSTP,PS,PSC,PSH,PST,PSP,PSPS,GSP,GSM,GSR,GSQ,GST,VSM,FSTN,PSTD,PSDD,CPCFT,CPCFP %2
goto End
:End

View File

@@ -0,0 +1,260 @@
#ifdef _DEBUG
#include <process.h>
#include <io.h>
#include <stdio.h>
HANDLE shaderCompileEvent;
static char** lastShader;
static __time64_t shaderChangedDate;
static char shaderDir[4096];
static char shaderFile[] = "E:\\blu-flame.org\\hgplus\\bliss\\Engine\\Shader.hlsl";
char* ReadFile(char* name, size_t* fileLen)
{
FILE *file = 0;
char *buffer = 0;
//Open file
fopen_s(&file, name, "rb");
if (!file)
{
printf("Unable to open file %s\n", name);
return 0;
}
//Get file length
fseek(file, 0, SEEK_END);
*fileLen = ftell(file);
fseek(file, 0, SEEK_SET);
//Allocate memory
buffer = (char *)malloc(*fileLen + 1);
if (!buffer)
{
fprintf(stderr, "Memory error!\n");
fclose(file);
return 0;
}
//Read file contents into buffer
fread(buffer, *fileLen, 1, file);
fclose(file);
return buffer;
}
void log(char* text)
{
printf(text);
OutputDebugStringA(text);
}
DWORD WINAPI filemon(void* args)
{
while (true)
{
_finddata_t fdata;
long hfile = _findfirst(shaderFile, &fdata);
if (hfile != -1)
{
if (fdata.time_write != shaderChangedDate)
{
shaderChangedDate = fdata.time_write;
::SetEvent(shaderCompileEvent);
}
_findclose(hfile);
}
::Sleep(100);
}
return 0;
}
void InitShader()
{
_finddata_t fdata;
long hfile = _findfirst(shaderFile, &fdata);
if (hfile != -1)
{
shaderChangedDate = fdata.time_write;
_findclose(hfile);
}
}
#endif
#ifdef _DEBUG
#ifdef SHADERDEBUG
#define CompileShader(entryPoint, profile) CompileShaderD(shaderDir entryPoint ".cso", entryPoint, profile);
#else
#define CompileShader(entryPoint, profile) CompileShaderD(shaderFile, entryPoint, profile);
#endif
void CompileShaderD(char* fileName, char* entryPoint, char* profile)
{
#ifdef SHADERDEBUG
shaderCode = ReadFile(fileName, &shaderSize);
#else
size_t blobLength = 0;
auto blob = ReadFile(fileName, &blobLength);
d3dCompile(blob, blobLength, shaderFile, NULL, NULL, entryPoint, profile, 0, 0, &shaderBlob, &errorBlob);
if (errorBlob != NULL)
{
auto error = errorBlob->GetBufferPointer();
OutputDebugStringA((char*)error);
if (shaderBlob == 0)
{
printf("Error compiling shader: ");
printf((char*)error);
printf("\n");
ExitProcess(-1);
}
}
if (shaderBlob != 0)
{
shaderSize = shaderBlob->GetBufferSize();
shaderCode = shaderBlob->GetBufferPointer();
}
#endif
}
#else
#define CompileShader(entryPoint, profile) CompileShaderR(entryPoint, profile);
#endif
#pragma code_seg(".CompileShader")
void CompileShaderR(char* entryPoint, char* profile)
{
#ifndef COMPRESS
d3dCompile(Shader_hlsl, sizeof(Shader_hlsl), NULL, NULL, NULL, entryPoint, profile, 0, 0, &shaderBlob, &errorBlob);
if (errorBlob != NULL)
{
auto error = errorBlob->GetBufferPointer();
OutputDebugStringA((char*)error);
}
#else
d3dCompile(Shader_hlsl, sizeof(Shader_hlsl), NULL, NULL, NULL, entryPoint, profile, 0, 0, &shaderBlob, NULL);
#endif
//if (shaderBlob != 0)
{
shaderSize = shaderBlob->GetBufferSize();
shaderCode = shaderBlob->GetBufferPointer();
}
};
#pragma data_seg(".vs_5_0")
static char vs_5_0[] = "vs_5_0";
#pragma data_seg(".gs_5_0")
static char gs_5_0[] = "gs_5_0";
#pragma data_seg(".ds_5_0")
static char ds_5_0[] = "ds_5_0";
#pragma data_seg(".hs_5_0")
static char hs_5_0[] = "hs_5_0";
#pragma data_seg(".ps_5_0")
static char ps_5_0[] = "ps_5_0";
#pragma code_seg(".CreateShaders")
void CreateShaders()
{
HINSTANCE hl = LoadLibrary(d3dcompiler);
if (!hl)
{
d3dcompiler[13] = '3';
hl = LoadLibrary(d3dcompiler);
}
d3dCompile = (pD3DCompile)GetProcAddress(hl, "D3DCompile");
CompileShader("GSQ", gs_5_0);
device->CreateGeometryShader(shaderCode, shaderSize, NULL, &quadGeometryShader);
CompileShader("HS", hs_5_0);
device->CreateHullShader(shaderCode, shaderSize, NULL, &hullShader);
CompileShader("HSP", hs_5_0);
device->CreateHullShader(shaderCode, shaderSize, NULL, &hullShaderPlant);
CompileShader("VSC", vs_5_0);
device->CreateVertexShader(shaderCode, shaderSize, NULL, &cellBufferVertexShader);
device->CreateGeometryShaderWithStreamOutput(shaderCode, shaderSize, cellBufferSODeclarations, 2, strides, 1, D3D11_SO_NO_RASTERIZED_STREAM, NULL, &cellBufferGeometryShader);
CompileShader("VSV", vs_5_0);
device->CreateVertexShader(shaderCode, shaderSize, NULL, &vertexBufferVertexShader);
device->CreateGeometryShaderWithStreamOutput(shaderCode, shaderSize, cellBufferSODeclarations, 2, strides, 1, D3D11_SO_NO_RASTERIZED_STREAM, NULL, &vertexBufferGeometryShader);
CompileShader("VSCB", vs_5_0);
device->CreateVertexShader(shaderCode, shaderSize, NULL, &constantBufferVertexShader);
device->CreateGeometryShaderWithStreamOutput(shaderCode, shaderSize, constantBufferSODeclarations, 19, &strides[3], 1, D3D11_SO_NO_RASTERIZED_STREAM, NULL, &constantBufferGeometryShader);
CompileShader("GSP", gs_5_0);
device->CreateGeometryShaderWithStreamOutput(shaderCode, shaderSize, plantSODeclarations, 4, plantStrides, 1, D3D11_SO_NO_RASTERIZED_STREAM, NULL, &plantInstanceGeometryShader);
CompileShader("GSM", gs_5_0);
device->CreateGeometryShaderWithStreamOutput(shaderCode, shaderSize, plantSODeclarations, 4, plantStrides, 1, D3D11_SO_NO_RASTERIZED_STREAM, NULL, &multiplyGeometryShader);
CompileShader("GSR", gs_5_0);
device->CreateGeometryShaderWithStreamOutput(shaderCode, shaderSize, plantSODeclarations, 8, plantStrides, 2, D3D11_SO_NO_RASTERIZED_STREAM, NULL, &rotationGeometryShader);
CompileShader("GST", gs_5_0);
device->CreateGeometryShaderWithStreamOutput(shaderCode, shaderSize, terrainSODeclarations, 4, vertexStrides, 2, D3D11_SO_NO_RASTERIZED_STREAM, NULL, &terrainGeometryShader);
CompileShader("VS", vs_5_0);
device->CreateVertexShader(shaderCode, shaderSize, NULL, &terrainVertexShader);
device->CreateInputLayout(polygonLayout, 2, shaderCode, shaderSize, &layout);
CompileShader("VSP", vs_5_0);
device->CreateVertexShader(shaderCode, shaderSize, NULL, &plantVertexShader);
device->CreateInputLayout(instancedLayoutDesc, 4, shaderCode, shaderSize, &instancedLayout);
CompileShader("VSM", vs_5_0);
device->CreateVertexShader(shaderCode, shaderSize, NULL, &instanceVertexShader);
CompileShader("VSTP", vs_5_0);
device->CreateVertexShader(shaderCode, shaderSize, NULL, &terrainProjectVertexShader);
CompileShader("VST", vs_5_0);
device->CreateVertexShader(shaderCode, shaderSize, NULL, &textureVertexShader);
CompileShader("DS", ds_5_0);
device->CreateDomainShader(shaderCode, shaderSize, NULL, &terrainDomainShader);
CompileShader("DSPN", ds_5_0);
device->CreateDomainShader(shaderCode, shaderSize, NULL, &plantDomainNormalShader);
CompileShader("DSPS", ds_5_0);
device->CreateDomainShader(shaderCode, shaderSize, NULL, &plantDomainShadowShader);
CompileShader("DSFN", ds_5_0);
device->CreateDomainShader(shaderCode, shaderSize, NULL, &flowerDomainNormalShader);
CompileShader("DSFS", ds_5_0);
device->CreateDomainShader(shaderCode, shaderSize, NULL, &flowerDomainShadowShader);
CompileShader("PS", ps_5_0);
device->CreatePixelShader(shaderCode, shaderSize, NULL, &terrainPixelShader);
CompileShader("PSH", ps_5_0);
device->CreatePixelShader(shaderCode, shaderSize, NULL, &heightMapPixelShader);
CompileShader("PSTN", ps_5_0);
device->CreatePixelShader(shaderCode, shaderSize, NULL, &plantPixelNormalShader);
CompileShader("FSTN", ps_5_0);
device->CreatePixelShader(shaderCode, shaderSize, NULL, &flowerPixelNormalShader);
CompileShader("PSTS", ps_5_0);
device->CreatePixelShader(shaderCode, shaderSize, NULL, &plantPixelShadowShader);
CompileShader("PSDD", ps_5_0);
device->CreatePixelShader(shaderCode, shaderSize, NULL, &postProcessPixelShader);
CompileShader("PSP", ps_5_0);
device->CreatePixelShader(shaderCode, shaderSize, NULL, &plantTexturePixelShader);
CompileShader("PSC", ps_5_0);
device->CreatePixelShader(shaderCode, shaderSize, NULL, &cloudPixelShader);
CompileShader("PSTD", ps_5_0);
device->CreatePixelShader(shaderCode, shaderSize, NULL, &terrainTexturePixelShader);
}

View File

@@ -0,0 +1,142 @@
#pragma once
static int* tpixels;
static HBITMAP thbmp;
static HDC thdcMem;
static HDC thdc;
static char* sceneNames[] =
{
"Wind", // 0
"Intro", // 1
"Intro+Sax", // 2
"Intro", // 3
"Intro+Sax", // 4
"Drums", // 5
"Drums+Sax", // 6
"Drums", // 7
"Drums+Sax", // 8
"Climax", // 9
"Climax", // 10
"Climax", // 11
"Climax", // 12
"Cool down", // 13
"Cool down", // 14
"Cool down", // 15
"Cool down", // 16
"Mute instr.", // 17
"Mute all", // 18
};
static int sceneColors[] =
{
0x007F0000, // 0
0x007F0000, // 1
0x007F0000, // 2
0x007F0000, // 3
0x007F0000, // 4
0x007F7F00, // 5
0x007F7F00, // 6
0x007F7F00, // 7
0x007F7F00, // 8
0x00007F00, // 9
0x00007F00, // 10
0x00007F00, // 11
0x00007F00, // 12
0x00007F7F, // 13
0x00007F7F, // 14
0x00007F7F, // 15
0x00007F7F, // 16
0x0000007F, // 17
0x0000007F, // 18
};
void InitTimeline(HWND hwnd)
{
BITMAPINFO bmi;
bmi.bmiHeader.biSize = sizeof(BITMAPINFO);
bmi.bmiHeader.biWidth = 20 * 50;
bmi.bmiHeader.biHeight = -128; // Order pixels from top to bottom
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32; // last byte not used, 32 bit for alignment
bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biSizeImage = 0;
bmi.bmiHeader.biXPelsPerMeter = 0;
bmi.bmiHeader.biYPelsPerMeter = 0;
bmi.bmiHeader.biClrUsed = 0;
bmi.bmiHeader.biClrImportant = 0;
bmi.bmiColors[0].rgbBlue = 0;
bmi.bmiColors[0].rgbGreen = 0;
bmi.bmiColors[0].rgbRed = 0;
bmi.bmiColors[0].rgbReserved = 0;
thdc = ::GetDC(hwnd);
thdcMem = CreateCompatibleDC(thdc);
thbmp = CreateDIBSection(thdc, &bmi, DIB_RGB_COLORS, (void**)&tpixels, NULL, 0);
}
void updateTimeline(HWND hwnd, bool playMusic, bool loopScene, float time)
{
SelectObject(thdcMem, thbmp);
memset(tpixels, 0, 20 * 50 * 128 * 4);
int x = 0;
RECT rect = { 0 };
char titleStr[255];
int seconds = (time * (MAX_SAMPLES / 38)) / SAMPLE_RATE;
sprintf_s(titleStr, "[F5] toggle playback [F6] toggle scene loop [F7] Previous scene [F8] Next scene Current scene: %d Time: %02d:%02d", (int)time, seconds / 60, seconds % 60);
DrawText(thdcMem, titleStr, -1, &rect, DT_SINGLELINE | DT_NOCLIP);
for (int i = 0; i < 19; ++i)
{
x = 50 * i;
for (int y = 64; y < 128; ++y)
{
for (int dx = x; dx < x + 50; ++dx)
tpixels[20 * 50 * y + dx] = sceneColors[i] | 0xFF000000;
tpixels[20 * 50 * y + x] = (2 * sceneColors[i]) | 0xFF000000;
}
}
for (int x = 0; x < (_4klang_current_tick / (float)MAX_TICKS) * 50 * 20 - 25; ++x)
{
tpixels[20 * 50 * 23 + x] = 0xFFFFFFFF;
}
x = 50 * time;
for (int y = 16; y < 128 && x < 20 * 50; ++y)
tpixels[20 * 50 * y + x] = 0xFFFFFFFF;
for (int i = 0; i < 19; ++i)
{
rect.left = 50 * i;
rect.top = 64 + ((i + 3) % 4) * 16;
DrawText(thdcMem, sceneNames[i], -1, &rect, DT_SINGLELINE | DT_NOCLIP);
}
seconds = 0;
rect.top = 32;
while (seconds < MAX_SAMPLES / SAMPLE_RATE)
{
x = seconds * SAMPLE_RATE / (MAX_SAMPLES / (38 * 50));
if (x > 20 * 50)
break;
rect.left = x;
for (int y = 24; y < ((seconds % 5) > 0 ? 28 : 32); ++y)
{
tpixels[20 * 50 * y + x] = 0xFFFFFFFF;
}
if (seconds % 10 == 0)
{
char timeStr[6];
sprintf_s(timeStr, "%02d:%02d", seconds / 60, seconds % 60);
DrawText(thdcMem, timeStr, -1, &rect, DT_SINGLELINE | DT_NOCLIP);
}
++seconds;
}
BitBlt(thdc, 0, 0, 20 * 50, 128, thdcMem, 0, 0, SRCCOPY);
}

Binary file not shown.

View File

@@ -0,0 +1,8 @@
#pragma once
#define TWEAKVALUES_SIZE 160
#pragma data_seg(".tweakValues")
static unsigned char tweakValues[] = {
141, 140, 140, 62, 165, 164, 36, 62, 193, 192, 192, 60, 0, 0, 128, 63, 249, 248, 248, 61, 233, 232, 232, 62, 184, 183, 55, 63, 0, 0, 128, 63, 129, 128, 128, 59, 193, 192, 64, 60, 217, 216, 216, 61, 0, 0, 128, 63, 161, 160, 160, 60, 137, 136, 136, 61, 249, 248, 248, 61, 0, 0, 128, 63, 229, 228, 100, 62, 129, 128, 0, 60, 137, 136, 136, 62, 0, 0, 128, 63, 152, 151, 23, 63, 249, 248, 248, 62, 152, 151, 23, 63, 0, 0, 128, 63, 211, 210, 82, 63, 145, 144, 16, 63, 0, 0, 0, 0, 0, 0, 128, 63, 168, 167, 39, 63, 159, 158, 30, 63, 133, 132, 4, 63, 0, 0, 128, 63, 0, 0, 128, 191, 69, 91, 62, 62, 188, 166, 73, 61, 0, 0, 0, 0, 101, 183, 70, 61, 244, 78, 62, 191, 153, 172, 204, 60, 0, 0, 0, 0,
};

110
hgplus/bliss/Engine/video.h Normal file
View File

@@ -0,0 +1,110 @@
#include <windows.h>
#include <vfw.h>
typedef struct
{
PAVISTREAM m_ps;
PAVISTREAM m_psCompressed;
AVISTREAMINFO m_strhdr;
AVICOMPRESSOPTIONS m_opts;
PAVIFILE m_pfile;
BITMAPINFOHEADER m_alpbi;
} AVIWRITER;
static AVIWRITER avi;
static int frame;
static unsigned char* vbuffer;
static ID3D11Texture2D* vresolvedTexture;
static ID3D11Texture2D* vstagingTexture;
static D3D11_MAPPED_SUBRESOURCE vanalysisResource;
static D3D11_TEXTURE2D_DESC vstagingDesc;
extern ID3D11Texture2D* backBufferPtr;
extern ID3D11Device* device;
extern ID3D11DeviceContext* deviceContext;
void InitVideo()
{
frame = 0;
AVIFileInit();
if (AVIFileOpen(&avi.m_pfile, "out.avi", OF_WRITE | OF_CREATE, NULL) != 0)
return;
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 = 60;
avi.m_strhdr.dwSuggestedBufferSize = 3 * screenWidth * screenHeight;
SetRect(&avi.m_strhdr.rcFrame, 0, 0, screenWidth, screenHeight);
if (AVIFileCreateStream(avi.m_pfile, &avi.m_ps, &avi.m_strhdr) != 0)
return;
memset(&avi.m_opts, 0, sizeof(avi.m_opts));
avi.m_opts.fccType = streamtypeVIDEO;
//avi.m_opts.fccHandler = mmioFOURCC('d','i','v','x'); // divx
avi.m_opts.fccHandler = mmioFOURCC('x','2','6','4'); // huffman uv
//avi.m_opts.fccHandler = mmioFOURCC('D', 'I', 'B', ' '); // uncompressed frames
avi.m_opts.dwKeyFrameEvery = 1;
avi.m_opts.dwQuality = 100;
avi.m_opts.dwBytesPerSecond = 0;
avi.m_opts.dwFlags = AVICOMPRESSF_DATARATE | AVICOMPRESSF_KEYFRAMES;
if (AVIMakeCompressedStream(&avi.m_psCompressed, avi.m_ps, &avi.m_opts, NULL) != AVIERR_OK)
return;
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;
if (AVIStreamSetFormat(avi.m_psCompressed, 0, &avi.m_alpbi, sizeof(avi.m_alpbi)) != 0)
return;
vbuffer = (unsigned char *)malloc(screenWidth*screenHeight * 3 + 1);
if (!vbuffer)
return;
backBufferPtr->GetDesc(&vstagingDesc);
vstagingDesc.Usage = D3D11_USAGE_DEFAULT;
vstagingDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
vstagingDesc.BindFlags = 0;
vstagingDesc.SampleDesc.Count = 1;
device->CreateTexture2D(&vstagingDesc, NULL, &vresolvedTexture);
vstagingDesc.Usage = D3D11_USAGE_STAGING;
vstagingDesc.CPUAccessFlags |= D3D11_CPU_ACCESS_READ;
device->CreateTexture2D(&vstagingDesc, NULL, &vstagingTexture);
}
void VideoFrame()
{
deviceContext->ResolveSubresource(vresolvedTexture, 0, backBufferPtr, 0, vstagingDesc.Format);
deviceContext->CopyResource(vstagingTexture, vresolvedTexture);
deviceContext->Map(vstagingTexture, 0, D3D11_MAP_READ, 0, &vanalysisResource);
int* image = (int*)vanalysisResource.pData;
for (int y = 0; y < screenHeight; ++y)
for (int x = 0; x < screenWidth; ++x)
{
int pixel = image[screenWidth * y + x];
int* bufPtr = (int*)&vbuffer[(screenWidth * (screenHeight - y - 1) + x) * 3];
*bufPtr = ((pixel & 0x000000FF) << 16) | (pixel & 0x0000FF00) | ((pixel & 0x00FF0000) >> 16);
}
deviceContext->Unmap(stagingTexture, 0);
if (AVIStreamWrite(avi.m_psCompressed, frame++, 1, vbuffer, 3 * screenWidth * screenHeight, AVIIF_KEYFRAME, NULL, NULL) != 0)
throw;
}
void DoneVideo()
{
free(vbuffer);
AVIStreamClose(avi.m_ps);
AVIStreamClose(avi.m_psCompressed);
AVIFileClose(avi.m_pfile);
AVIFileExit();
}