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

107
hgplus/bliss/Engine.sln Normal file
View File

@@ -0,0 +1,107 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Engine", "Engine\Engine.vcxproj", "{CCF13486-5C89-4905-832E-C6C83230DA29}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tweaky", "Tweaky\Tweaky.csproj", "{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Compress|Any CPU = Compress|Any CPU
Compress|Mixed Platforms = Compress|Mixed Platforms
Compress|Win32 = Compress|Win32
CompressFast|Any CPU = CompressFast|Any CPU
CompressFast|Mixed Platforms = CompressFast|Mixed Platforms
CompressFast|Win32 = CompressFast|Win32
Debug (shader debug)|Any CPU = Debug (shader debug)|Any CPU
Debug (shader debug)|Mixed Platforms = Debug (shader debug)|Mixed Platforms
Debug (shader debug)|Win32 = Debug (shader debug)|Win32
Debug (shader edit)|Any CPU = Debug (shader edit)|Any CPU
Debug (shader edit)|Mixed Platforms = Debug (shader edit)|Mixed Platforms
Debug (shader edit)|Win32 = Debug (shader edit)|Win32
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|Win32 = Debug|Win32
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|Win32 = Release|Win32
Video|Any CPU = Video|Any CPU
Video|Mixed Platforms = Video|Mixed Platforms
Video|Win32 = Video|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CCF13486-5C89-4905-832E-C6C83230DA29}.Compress|Any CPU.ActiveCfg = Compress|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Compress|Mixed Platforms.ActiveCfg = Compress|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Compress|Mixed Platforms.Build.0 = Compress|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Compress|Win32.ActiveCfg = Compress|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Compress|Win32.Build.0 = Compress|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.CompressFast|Any CPU.ActiveCfg = CompressFast|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.CompressFast|Mixed Platforms.ActiveCfg = CompressFast|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.CompressFast|Mixed Platforms.Build.0 = CompressFast|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.CompressFast|Win32.ActiveCfg = CompressFast|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.CompressFast|Win32.Build.0 = CompressFast|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Debug (shader debug)|Any CPU.ActiveCfg = Debug|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Debug (shader debug)|Mixed Platforms.ActiveCfg = Debug|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Debug (shader debug)|Mixed Platforms.Build.0 = Debug|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Debug (shader debug)|Win32.ActiveCfg = DebugShader|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Debug (shader debug)|Win32.Build.0 = DebugShader|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Debug (shader edit)|Any CPU.ActiveCfg = Debug|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Debug (shader edit)|Mixed Platforms.ActiveCfg = Debug|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Debug (shader edit)|Mixed Platforms.Build.0 = Debug|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Debug (shader edit)|Win32.ActiveCfg = Debug|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Debug (shader edit)|Win32.Build.0 = Debug|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Debug|Any CPU.ActiveCfg = Debug|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Debug|Win32.ActiveCfg = Debug|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Debug|Win32.Build.0 = Debug|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Release|Any CPU.ActiveCfg = Release|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Release|Mixed Platforms.Build.0 = Release|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Release|Win32.ActiveCfg = Release|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Release|Win32.Build.0 = Release|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Video|Any CPU.ActiveCfg = Video|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Video|Mixed Platforms.ActiveCfg = Video|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Video|Mixed Platforms.Build.0 = Video|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Video|Win32.ActiveCfg = Video|Win32
{CCF13486-5C89-4905-832E-C6C83230DA29}.Video|Win32.Build.0 = Video|Win32
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Compress|Any CPU.ActiveCfg = Release|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Compress|Any CPU.Build.0 = Release|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Compress|Mixed Platforms.ActiveCfg = Release|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Compress|Mixed Platforms.Build.0 = Release|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Compress|Win32.ActiveCfg = Release|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.CompressFast|Any CPU.ActiveCfg = Debug|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.CompressFast|Any CPU.Build.0 = Debug|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.CompressFast|Mixed Platforms.ActiveCfg = Debug|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.CompressFast|Win32.ActiveCfg = Debug|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Debug (shader debug)|Any CPU.ActiveCfg = Debug|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Debug (shader debug)|Any CPU.Build.0 = Debug|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Debug (shader debug)|Mixed Platforms.ActiveCfg = Debug|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Debug (shader debug)|Mixed Platforms.Build.0 = Debug|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Debug (shader debug)|Win32.ActiveCfg = Debug|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Debug (shader edit)|Any CPU.ActiveCfg = Debug|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Debug (shader edit)|Any CPU.Build.0 = Debug|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Debug (shader edit)|Mixed Platforms.ActiveCfg = Debug|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Debug (shader edit)|Mixed Platforms.Build.0 = Debug|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Debug (shader edit)|Win32.ActiveCfg = Debug|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Debug|Win32.ActiveCfg = Debug|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Release|Any CPU.Build.0 = Release|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Release|Win32.ActiveCfg = Release|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Video|Any CPU.ActiveCfg = Debug|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Video|Any CPU.Build.0 = Debug|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Video|Mixed Platforms.ActiveCfg = Release|Any CPU
{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}.Video|Win32.ActiveCfg = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

BIN
hgplus/bliss/Engine.v12.suo Normal file

Binary file not shown.

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();
}

BIN
hgplus/bliss/Musik/8k.4kp Normal file

Binary file not shown.

BIN
hgplus/bliss/Musik/8k.mptm Normal file

Binary file not shown.

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="2.0.0.0" newVersion="4.3.0.0" />
<bindingRedirect oldVersion="2.3.5.0" newVersion="4.3.0.0" />
<bindingRedirect oldVersion="4.0.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -0,0 +1,277 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>FParsecCS</name>
</assembly>
<members>
<member name="M:FParsec.Buffer.PositiveDistance(System.Char*,System.Char*)">
<summary>Calculates: end - begin. <br />
Precondition: 2^31 > end - begin >= 0.</summary>
</member>
<member name="M:FParsec.Buffer.PositiveDistance64(System.Char*,System.Char*)">
<summary>Calculates: end - begin. <br />
Precondition: end - begin >= 0.</summary>
</member>
<member name="M:FParsec.Buffer.Copy(System.Byte*,System.Byte*,System.Int32)">
<summary>Copies size bytes from src to dst. Correctly handles overlapped memory blocks.</summary>
</member>
<member name="T:FParsec.CharStreamIndexToken">
<summary>An opaque representation of a CharStream index.</summary>
</member>
<member name="P:FParsec.CharStreamIndexToken.Block">
<summary>Returns -1 if the IndexToken was zero-initialized.</summary>
</member>
<member name="T:FParsec.CharStream">
<summary>Provides readaccess to a sequence of UTF16 chars.</summary>
</member>
<member name="F:FParsec.CharStream.Ptr">
<summary>Points to the current char in Buffer,
or is null if the end of the stream has been reached.</summary>
</member>
<member name="F:FParsec.CharStream.PtrBegin">
<summary>Equals Ptr == null ? null : BufferBegin.</summary>
</member>
<member name="F:FParsec.CharStream.PtrEnd">
<summary>Equals Ptr == null ? null : BufferEnd.</summary>
</member>
<member name="F:FParsec.CharStream.BufferBegin">
<summary>Begin of the used part of the char buffer. Is constant. Is null if the CharStream is empty.</summary>
</member>
<member name="F:FParsec.CharStream.BufferEnd">
<summary>End of the used part of the char buffer. Varies for a multi-block stream. Is null if the CharStream is empty.</summary>
</member>
<member name="F:FParsec.CharStream.Block">
<summary>The block currently loaded in the buffer.</summary>
</member>
<member name="F:FParsec.CharStream.StateTag">
<summary>Any CharStream method or property setter increments this value when it changes the CharStream state.
Backtracking to an old state also restores the old value of the StateTag.</summary>
</member>
<member name="F:FParsec.CharStream.BufferString">
<summary>The string holding the char buffer, or null if the buffer is not part of a .NET string.</summary>
</member>
<member name="F:FParsec.CharStream.BufferStringPointer">
<summary>A pointer to the beginning of BufferString, or null if BufferString is null.</summary>
</member>
<member name="F:FParsec.CharStream.BufferHandle">
<summary>Holds the GCHandle for CharStreams directly constructed from strings or char arrays.</summary>
</member>
<member name="F:FParsec.CharStream.StringBuffer">
<summary>Holds the StringBuffer for CharStreams constructed from a binary stream.</summary>
</member>
<member name="F:FParsec.CharStream.DoNotRoundUpBlockSizeToSimplifyTesting">
<summary>we modify this flag via reflection in the unit test</summary>
</member>
<member name="M:FParsec.CharStream.Seek(System.Int64)">
<summary>Returns an iterator pointing to the given index in the stream,
or to the end of the stream if the indexed position lies beyond the last char in the stream.</summary>
<exception cref="T:System.ArgumentOutOfRangeException">The index is negative or less than the BeginIndex.</exception>
<exception cref="T:System.NotSupportedException">Accessing the char with the given index requires seeking in the underlying byte stream, but the byte stream does not support seeking or the Encoding's Decoder is not serializable.</exception>
<exception cref="T:System.IO.IOException">An I/O error occured.</exception>
<exception cref="T:System.ArgumentException">The input stream contains invalid bytes and the encoding was constructed with the throwOnInvalidBytes option.</exception>
<exception cref="T:System.Text.DecoderFallbackException">The input stream contains invalid bytes for which the decoder fallback threw this exception.</exception>
<exception cref="T:System.OutOfMemoryException">Can not allocate enough memory for the internal data structure.</exception>
<exception cref="T:System.ObjectDisposedException">Method is called after the stream was disposed.</exception>
</member>
<member name="P:FParsec.CharStream.IndexOfFirstChar">
<summary>The index of the first char in the stream.</summary>
</member>
<member name="P:FParsec.CharStream.Line">
<summary>The line number for the next char. (The line count starts with 1.)</summary>
</member>
<member name="P:FParsec.CharStream.LineBegin">
<summary>The stream index of the first char of the line that also contains the next char.</summary>
</member>
<member name="P:FParsec.CharStream.Column">
<summary>The UTF16 column number of the next char, i.e. Index LineBegin + 1.</summary>
</member>
<member name="P:FParsec.CharStream.Encoding">
<summary>The Encoding that is used for decoding the underlying byte stream, or
System.Text.UnicodeEncoding in case the stream was directly constructed
from a string or char buffer.</summary>
</member>
<member name="F:FParsec.CharStream.BlockInfo.ByteIndex">
<summary>the byte stream index of the first char in the block after the OverhangCharsAtBlockBegin</summary>
</member>
<member name="F:FParsec.CharStream.BlockInfo.ByteBufferIndex">
<summary>the value of the CharStream's ByteBufferIndex before the block is read</summary>
</member>
<member name="F:FParsec.CharStream.BlockInfo.NumberOfBytesInOverlap">
<summary>the number of bytes in the stream from ByteIndex to the first char after the OverhangCharsAfterOverlap</summary>
</member>
<member name="F:FParsec.CharStream.BlockInfo.LastCharInOverlap">
<summary>the last char in the overlap with the previous block (used for integrity checking)</summary>
</member>
<member name="F:FParsec.CharStream.BlockInfo.OverhangCharsAtBlockBegin">
<summary>chars at the block begin that were already read together with chars of the last block before the overlap</summary>
</member>
<member name="F:FParsec.CharStream.BlockInfo.OverhangCharsAfterOverlap">
<summary>chars after the overlap with the previous block that were already read together with the overlap chars</summary>
</member>
<member name="T:FParsec.CharStream.MultiBlockData">
<summary>Contains the data and methods needed in case the input byte stream
is large enough to span multiple blocks of the CharStream.</summary>
</member>
<member name="F:FParsec.CharStream.MultiBlockData.LastBlock">
<summary>The index of the last block of the stream, or Int32.MaxValue if the end of stream has not yet been detected.</summary>
</member>
<member name="F:FParsec.CharStream.MultiBlockData.RegexSpaceThreshold">
<summary>BufferBegin + BlockSize - minRegexSpace</summary>
</member>
<member name="M:FParsec.CharStream.MultiBlockData.FillByteBuffer">
<summary>Refills the ByteBuffer if no unused byte is remaining.
Returns the number of unused bytes in the (refilled) ByteBuffer.</summary>
</member>
<member name="M:FParsec.CharStream.MultiBlockData.ClearAndRefillByteBuffer(System.Int32)">
<summary>Refills the ByteBuffer starting at the given index. If the underlying byte
stream contains enough bytes, the ByteBuffer is filled up to the ByteBuffer.Length.
Returns the number of bytes available for consumption in the refilled ByteBuffer.</summary>
</member>
<member name="M:FParsec.CharStream.MultiBlockData.ReadCharsFromStream(System.Char*,System.Int32,System.String@)">
<summary>Reads up to the given maximum number of chars into the given buffer.
If more than the maximum number of chars have to be read from the stream in order to
fill the buffer (due to the way the Decoder API works), the overhang chars are
returned through the output parameter.
Returns a pointer to one char after the last char read.</summary>
</member>
<member name="M:FParsec.CharStream.MultiBlockData.ReadBlock(System.Int32)">
<summary> Reads a block of chars (which must be different from the current block)
into the BufferString. If the current CharStream block is block - 1, this method
seeks the CharStream to the first char after the overlap of the two blocks.
Otherwise it seeks the CharStream to the first char in the block. It returns the
CharStream.Ptr value at the new position (which can be null).</summary>
</member>
<member name="P:FParsec.CharStream.MultiBlockData.ByteIndex">
<summary>The byte stream index of the first unused byte in the ByteBuffer.</summary>
</member>
<member name="T:FParsec.CharStream`1">
<summary>Provides readaccess to a sequence of UTF16 chars.</summary>
</member>
<member name="T:FParsec.Cloning.CloneImage">
<summary>Contains the serialized state of on object.</summary>
</member>
<member name="M:FParsec.Cloning.CloneImage.CreateClone">
<summary>Deserializes the object state into a new object.</summary>
</member>
<member name="M:FParsec.Cloning.Cloner.Create(System.Type)">
<summary>Returns a cloner for the given <em>run-time</em> type.</summary>
<param name="type">The run-time type of the objects to clone. The type must be serializable.</param>
</member>
<member name="M:FParsec.Cloning.Cloner.Clone(System.Object)">
<summary>Copies the given object using the serialization API.</summary>
<param name="instance">The object to clone. instance.GetType() must equal the Type the Cloner was created for.</param>
</member>
<member name="M:FParsec.Cloning.Cloner.CaptureImage(System.Object)">
<summary>Returns an image of the given object instance.</summary>
<param name="instance">The object to capture an image of.</param>
</member>
<member name="M:FParsec.Cloning.Cloner.GetSerializedFields(System.Type,System.Boolean@)">
<summary>Returns the public and non-public fields of the type (and its base types),
except fields with the NonSerialized attribute. In the returned array fields from
derived types come before fields from base types.</summary>
</member>
<member name="M:FParsec.Cloning.Cloner.FindStronglyConnectedComponents(FParsec.Cloning.Cloner.State[])">
<summary>Fills the Strongly StronglyConnectedComponent fields of the
states passed in the array. Returns an array mapping each state to an
integer component identifier.
</summary>
<param name="states">The object states to traverse. The object with array index
0 is ignored. All other objects are assumed to be reachable from the object
with array index 1.</param>
</member>
<member name="M:FParsec.Cloning.Cloner.ComputeTopologicalOrder(FParsec.Cloning.Cloner.State[])">
<summary>Returns an array with the topologically sorted indices of the states.
In the returned array the indices of states belonging to the same strongly
connected component are adjacent (but the order within a strongly connected
component is undefined).
</summary>
<param name="states">The object states to traverse. The object with array index
0 is ignored. All other objects are assumed to be reachable from the object
with array index 1.</param>
</member>
<member name="F:FParsec.Cloning.Cloner.State.EventHandlers">
<summary>May be null.</summary>
</member>
<member name="F:FParsec.Cloning.Cloner.State.ObjectIndices">
<summary>Indices of nested objects in the object graph. May be null.</summary>
</member>
<member name="F:FParsec.Cloning.Cloner.State.StronglyConnectedComponent">
<summary>May be null.</summary>
</member>
<member name="M:FParsec.FastGenericEqualityERComparer`1.Equals(`0,`0)">
<summary>For reference types it's faster to call Instance.Equals directly
(due to limitations of the inliner of the .NET JIT.)</summary>
</member>
<member name="T:FParsec.FastGenericEqualityERComparer.ArrayStructuralEqualityERComparer`1">
<summary>Forwards all work to F#'s GenericEqualityERComparer.</summary>
</member>
<member name="M:FParsec.IdentifierValidator.ValidateAndNormalize(System.String,System.Int32@)">
<summary>Returns the normalized string, or null in case an invalid identifier
character is found. If an invalid character is found, the string index of the
invalid character is assigned to the out parameter, otherwise -1.</summary>
</member>
<member name="F:FParsec.OperatorPrecedenceParser`3.OpsArrayLength">
<summary>The length of LhsOps and RhsOps. Must be a power of 2.</summary>
</member>
<member name="F:FParsec.OperatorPrecedenceParser`3.ErrorOp">
<summary>ParsePrefixOp returns this value to signal that it backtracked and we should try to parse a term.</summary>
</member>
<member name="F:FParsec.OperatorPrecedenceParser`3.ZeroPrecedenceOperatorData">
<summary>Can not be readonly because it is passed as as a ref (for performance reasons), but it is never mutated.</summary>
</member>
<member name="M:FParsec.OperatorPrecedenceParser`3.ParsePrefixOp(FParsec.OperatorPrecedenceParser{`0,`1,`2}.OperatorData@,FParsec.Operator{`0,`1,`2},FParsec.Reply{`0}@,FParsec.CharStream{`2})">
<summary>Parses the following prefix operators, plus the expression the operators apply to.</summary>
</member>
<member name="M:FParsec.OperatorPrecedenceParser`3.ParseExpressionContinue(FParsec.OperatorPrecedenceParser{`0,`1,`2}.OperatorData@,FParsec.Operator{`0,`1,`2},FParsec.Reply{`0}@,FParsec.CharStream{`2})">
<summary>Parses (higher-precedence) infix and postfix operators after the first term, together with the argument expressions.</summary>
</member>
<member name="T:FParsec.StringBuffer">
<summary>A substring of a pinned string on the large object heap.
StringBuffers are cached in a pool and hence need to be properly disposed.</summary>
</member>
<member name="F:FParsec.StringBuffer.Allocated">
<summary>Sum of the lengths of all currently allocated StringBuffers</summary>
</member>
<member name="F:FParsec.StringBuffer.PoolSegment.Last">
<summary>the last allocated segment</summary>
</member>
<member name="P:FParsec.StringBuffer.PoolSegment.Size">
<summary>String.Length - x, where x > 0</summary>
</member>
<member name="M:FParsec.Text.DetectPreamble(System.Byte[],System.Int32,System.Text.Encoding@,System.Boolean)">
<summary>Detects the presence of an encoding preamble in the first count bytes of the byte buffer.
If detectEncoding is false, this function only searches for the preamble of the given default encoding,
otherwise also for any of the standard unicode byte order marks (UTF-8, UTF-16 LE/BE, UTF-32 LE/BE).
If an encoding different from the given default encoding is detected, the new encoding
is assigned to the encoding reference.
Returns the number of bytes in the detected preamble, or 0 if no preamble is detected.
</summary>
</member>
<member name="M:FParsec.Text.ReadAllRemainingCharsFromStream(System.Char*,System.Int32,System.Byte[],System.Int32,System.Int32,System.IO.Stream,System.Int64,System.Text.Decoder,System.Boolean)">
<summary>Reads all remaining chars into the given buffer. If the remaining stream
content holds more than the given maximum number of chars, an exception will be thrown.</summary>
</member>
<member name="M:FParsec.Text.FoldCase(System.String)">
<summary>Returns a case-folded copy of the string argument. All chars are mapped
using the (non-Turkic) 1-to-1 case folding mappings (v. 6.0) for Unicode code
points in the Basic Multilingual Plane, i.e. code points below 0x10000.
If the argument is null, null is returned.</summary>
</member>
<member name="M:FParsec.Text.NormalizeNewlines(System.String)">
<summary>Returns the given string with all occurrences of "\r\n" and "\r" replaced
by "\n". If the argument is null, null is returned.</summary>
</member>
<member name="M:FParsec.Text.CountTextElements(System.String)">
<summary>A faster implementation of System.Globalization.StringInfo(str).LengthInTextElements.</summary>
</member>
<member name="M:FParsec.Text.IsWhitespace(System.Char)">
<summary>A faster implementation of System.Char.IsWhiteSpace.</summary>
</member>
<member name="T:FParsec.UnmanagedMemoryPool">
<summary>
Allocates and keeps references to chunks of unmanaged memory that we
intend to keep around for the lifetime of the AppDomain.
</summary>
</member>
</members>
</doc>

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="2.0.0.0" newVersion="4.3.0.0" />
<bindingRedirect oldVersion="2.3.5.0" newVersion="4.3.0.0" />
<bindingRedirect oldVersion="4.0.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Binary file not shown.

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>

View File

@@ -0,0 +1,14 @@
<Application x:Class="Tweaky.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Theme.xaml" />
<ResourceDictionary Source="Resources.xaml" />
<ResourceDictionary Source="EditorTemplates.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace Tweaky
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
public App()
{
this.DispatcherUnhandledException += App_DispatcherUnhandledException;
AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
}
private void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e)
{
try
{
ShowException(e.ExceptionObject as Exception);
this.Shutdown();
}
catch
{
}
}
void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
try
{
ShowException(e.Exception);
this.Shutdown();
}
catch
{
}
}
private static void ShowException(Exception exception)
{
var message = exception.Message + " at:\n" + exception.StackTrace + "\n\n";
do
{
exception = exception.InnerException;
if (exception != null)
message += exception.Message + " at:\n" + exception.StackTrace + "\n\n";
}
while (exception != null);
System.Windows.Forms.MessageBox.Show(message, "Unhandled exception");
}
}
}

View File

@@ -0,0 +1,468 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Media;
using Tweaky.PropertyGrid;
namespace Tweaky
{
[TemplatePart(Name = "PART_PopupButton", Type = typeof(Button))]
[TemplatePart(Name = "PART_Popup", Type = typeof(Popup))]
[TemplatePart(Name = "PART_SatValImage", Type = typeof(Border))]
[TemplatePart(Name = "PART_HueImage", Type = typeof(Image))]
[TemplatePart(Name = "PART_OriginalColorBorder", Type = typeof(Border))]
[TemplatePart(Name = "HGradientBorder", Type = typeof(Border))]
public class ColorEditorBase : EditorBase<System.Drawing.Color>
{
public ColorEditorBase()
{
this.LayoutUpdated += ColorEditorBase_LayoutUpdated;
}
void ColorEditorBase_LayoutUpdated(object sender, EventArgs e)
{
RaisePropertyChanged(null);
}
static ColorEditorBase()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(ColorEditorBase), new FrameworkPropertyMetadata(typeof(ColorEditorBase)));
}
protected ToggleButton PopupButton;
protected Popup Popup;
protected Border SatValImage;
protected Image HueImage;
protected Border OriginalColorBorder;
protected Border HGradientBorder;
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
this.OriginalColorBorder = this.Template.FindName("PART_OriginalColorBorder", this) as Border;
this.PopupButton = this.Template.FindName("PART_PopupButton", this) as ToggleButton;
this.SatValImage = this.Template.FindName("PART_SatValImage", this) as Border;
this.HueImage = this.Template.FindName("PART_HueImage", this) as Image;
this.HGradientBorder = this.Template.FindName("HGradientBorder", this) as Border;
RaisePropertyChanged(null);
}
}
public abstract class ColorEditorBase<T> : ColorEditorBase
{
static ColorEditorBase()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(ColorEditorBase<T>), new FrameworkPropertyMetadata(typeof(ColorEditorBase<T>)));
}
public ColorEditorBase()
{
UseAlpha = true;
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
OriginalColorBorder.Cursor = new Cursor(Application.GetResourceStream(new Uri("pack://application:,,,/Tweaky;component/colorpicker.cur")).Stream);
OriginalColorBorder.PreviewMouseDown += OriginalColorBorder_MouseDown;
SatValImage.MouseDown += SatVal_MouseDown;
SatValImage.MouseMove += SatVal_MouseMove;
SatValImage.MouseUp += SatVal_MouseUp;
HGradientBorder.MouseDown += Hue_MouseDown;
HGradientBorder.MouseMove += Hue_MouseMove;
HGradientBorder.MouseUp += Hue_MouseUp;
InitializeFromExternalColor();
this.LayoutUpdated += ColorEditorBase_LayoutUpdated;
}
void ColorEditorBase_LayoutUpdated(object sender, EventArgs e)
{
RaisePropertyChanged("HueIndicatorPosition");
}
public CustomPopupPlacement[] placePopup(Size popupSize, Size targetSize, Point offset)
{
CustomPopupPlacement placement1 = new CustomPopupPlacement(new Point(targetSize.Width - popupSize.Width, targetSize.Height), PopupPrimaryAxis.Horizontal);
CustomPopupPlacement placement2 = new CustomPopupPlacement(new Point(0, targetSize.Height), PopupPrimaryAxis.Horizontal);
CustomPopupPlacement[] ttplaces = new CustomPopupPlacement[] { placement1, placement2 };
return ttplaces;
}
public abstract T Red { get; set; }
public abstract T Green { get; set; }
public abstract T Blue { get; set; }
public abstract T Alpha { get; set; }
protected double hue;
public double Hue
{
get
{
return hue;
}
set
{
hue = value;
UpdateColorFromHSV(hue, sat, val);
}
}
protected double sat;
public double Sat
{
get
{
return sat;
}
set
{
sat = value;
UpdateColorFromHSV(hue, sat, val);
}
}
protected double val;
public double Val
{
get
{
return val;
}
set
{
val = value;
UpdateColorFromHSV(hue, sat, val);
}
}
public Brush BackgroundBrush
{
get;
protected set;
}
protected abstract void UpdateColorFromHSV(double hue, double sat, double val);
protected abstract void UpdateColorFromRGB(T red, T green, T blue);
protected abstract void UpdateColor(System.Drawing.Color color);
public Brush ExternalBackgroundBrush
{
get;
protected set;
}
public Brush HueBrush
{
get;
protected set;
}
public T[] Values
{
get
{
return new T[]
{
Alpha,
Red,
Green,
Blue
};
}
set
{
Value = GetColorFromValues(value);
}
}
protected abstract System.Drawing.Color GetColorFromValues(T[] value);
protected static System.Drawing.Color ColorFromHex(string value)
{
var converter = new System.Drawing.ColorConverter();
if (value == null)
return System.Drawing.Color.White;
return (System.Drawing.Color)converter.ConvertFromString(null, System.Globalization.CultureInfo.InvariantCulture, value);
}
public string Hex
{
get
{
return ColorToHex(Value);
}
set
{
try
{
Value = ColorFromHex(value);
UpdateColor(Value);
}
catch (Exception)
{
}
}
}
public override System.Drawing.Color Value
{
get
{
return GetColorFromValue();
}
set
{
SetColorFromValue(value);
OnValueChanged();
}
}
protected virtual void SetColorFromValue(System.Drawing.Color value)
{
(this.DataContext as PropertyItem).Value = value;
}
protected virtual System.Drawing.Color GetColorFromValue()
{
if (!(this.DataContext is PropertyItem))
return System.Drawing.Color.White;
if ((this.DataContext as PropertyItem).Value == null)
return System.Drawing.Color.White;
if ((this.DataContext as PropertyItem).Value is System.Drawing.Color)
return (System.Drawing.Color)(this.DataContext as PropertyItem).Value;
return System.Drawing.Color.White;
}
public override void OnValueChanged()
{
base.OnValueChanged();
RaisePropertyChanged(null);
}
protected string ColorToHex(System.Drawing.Color value)
{
var values = new byte[] { value.A, value.R, value.G, value.B };
return "#" + BitConverter.ToString(values).Replace("-", string.Empty);
}
protected bool useAlpha;
public bool UseAlpha
{
get
{
return useAlpha;
}
set
{
if (useAlpha == value)
return;
useAlpha = value;
RaisePropertyChanged("UseAlpha");
RaisePropertyChanged("AlphaGuiVisibility");
}
}
public Visibility AlphaGuiVisibility
{
get
{
return useAlpha ? Visibility.Visible : Visibility.Collapsed;
}
}
protected double[] RGBtoHSV(double r, double g, double b)
{
double h, s, v;
double min, max, delta;
min = Math.Min(r, Math.Min(g, b));
max = Math.Max(r, Math.Max(g, b));
v = max;
delta = max - min;
if (max == 0 || delta == 0)
{
s = 0;
h = 0;
}
else
{
s = delta / max;
if (r == max)
h = (g - b) / delta;
else if (g == max)
h = 2 + (b - r) / delta;
else
h = 4 + (r - g) / delta;
h *= 60;
if (h < 0)
h += 360;
}
return new double[] { h, s, v };
}
protected double[] HSVtoRGB(double h, double s, double v)
{
int i;
double r, g, b;
double f, p, q, t;
if (s == 0)
{
r = g = b = v;
}
else
{
h /= 60;
i = (int)Math.Floor(h);
f = h - i;
p = v * (1 - s);
q = v * (1 - s * f);
t = v * (1 - s * (1 - f));
switch (i)
{
case 0:
r = v;
g = t;
b = p;
break;
case 1:
r = q;
g = v;
b = p;
break;
case 2:
r = p;
g = v;
b = t;
break;
case 3:
r = p;
g = q;
b = v;
break;
case 4:
r = t;
g = p;
b = v;
break;
default: // case 5:
r = v;
g = p;
b = q;
break;
}
}
return new double[] { r, g, b };
}
protected void Button_Click(object sender, RoutedEventArgs e)
{
Popup.IsOpen = true;
}
protected bool hueDown = false;
protected bool satValDown = false;
protected void Hue_MouseDown(object sender, MouseButtonEventArgs e)
{
HGradientBorder.CaptureMouse();
hueDown = true;
UpdateHue(e.GetPosition(HGradientBorder));
}
protected void UpdateHue(Point point)
{
if (!hueDown)
return;
Hue = Math.Max(0, Math.Min(360.0, 360.0 * (point.X / HGradientBorder.ActualWidth)));
}
protected void Hue_MouseMove(object sender, MouseEventArgs e)
{
UpdateHue(e.GetPosition(HGradientBorder));
}
protected void Hue_MouseUp(object sender, MouseButtonEventArgs e)
{
hueDown = false;
HGradientBorder.ReleaseMouseCapture();
}
protected void SatVal_MouseDown(object sender, MouseButtonEventArgs e)
{
SatValImage.CaptureMouse();
satValDown = true;
UpdateSatVal(e.GetPosition(SatValImage));
}
protected void UpdateSatVal(Point point)
{
if (!satValDown)
return;
Sat = Math.Max(0, Math.Min(1, point.X / SatValImage.ActualWidth));
Val = Math.Max(0, Math.Min(1, 1.0 - (point.Y / SatValImage.ActualHeight)));
}
protected void SatVal_MouseMove(object sender, MouseEventArgs e)
{
UpdateSatVal(e.GetPosition(SatValImage));
}
protected void SatVal_MouseUp(object sender, MouseButtonEventArgs e)
{
satValDown = false;
SatValImage.ReleaseMouseCapture();
}
public double HueIndicatorPosition
{
get
{
return Hue * (HueImage == null ? 1 : HueImage.ActualWidth) / 360.0;
}
}
public double SatIndicatorPosition
{
get
{
return Sat * (SatValImage == null ? 1 : SatValImage.ActualWidth);
}
}
public double ValIndicatorPosition
{
get
{
return (1.0 - Val) * (SatValImage == null ? 1 : SatValImage.ActualHeight);
}
}
protected abstract void InitializeFromExternalColor();
protected void OriginalColorBorder_MouseDown(object sender, MouseButtonEventArgs e)
{
InitializeFromExternalColor();
}
}
}

View File

@@ -0,0 +1,318 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
namespace Tweaky
{
public struct float3
{
public float x, y, z;
};
public struct float4
{
public float4(float x, float y, float z, float w)
{
this.x = x;
this.y = y;
this.z = z;
this.w = w;
}
public float x, y, z, w;
};
public struct TweakBufferType
{
public float4
_fN, // _f Night
_fD, // _f Day
_r1N, // grade Lift Night
_r1D, // grade Lift Day
_r2N, // grade Gamma Night
_r2D, // grade Gamma Day
_r3N, // grade Gain Night
_r3D, // grade Gain Day
_lN, // _f Night
_lD; // _f Day
};
public class DataViewModel : ViewModelBase, IDisposable
{
Timer timer;
string path;
unsafe public DataViewModel(string path)
{
this.path = path;
mem = new SharedMemory<TweakBufferType>(path, Marshal.SizeOf(typeof(TweakBufferType)));
mem.Open();
using (var stream = new FileStream(path + ".bin", FileMode.Open))
{
var buffer = new byte[Marshal.SizeOf(typeof(TweakBufferType))];
stream.Read(buffer, 0, buffer.Length);
fixed (byte* ptr = &buffer[0])
{
TweakBufferType* tweakBuffer = (TweakBufferType*)ptr;
mem.Data = tweakBuffer[0];
}
}
timer = new Timer();
timer.Interval = 1000;
timer.Elapsed += timer_Elapsed;
timer.Start();
}
void timer_Elapsed(object sender, ElapsedEventArgs e)
{
if (dirty)
{
dirty = false;
Save();
}
}
[Category("Night")]
public Color FogNight
{
get
{
var data = mem.Data;
return CreateColor(data._fN);
}
set
{
var data = mem.Data;
data._fN = ConvertColor(value);
mem.Data = data;
}
}
[Category("Day")]
public Color FogDay
{
get
{
var data = mem.Data;
return CreateColor(data._fD);
}
set
{
var data = mem.Data;
data._fD = ConvertColor(value);
mem.Data = data;
}
}
[Category("Night")]
[DisplayName("Color Grading: Lift")]
public Color GradeLiftNight
{
get
{
var data = mem.Data;
return CreateColor(data._r1N);
}
[ExecuteAfter("MarkDirty")]
set
{
var data = mem.Data;
data._r1N = ConvertColor(value);
mem.Data = data;
}
}
[Category("Day")]
[DisplayName("Color Grading: Lift")]
public Color GradeLiftDay
{
get
{
var data = mem.Data;
return CreateColor(data._r1D);
}
[ExecuteAfter("MarkDirty")]
set
{
var data = mem.Data;
data._r1D = ConvertColor(value);
mem.Data = data;
}
}
[Category("Night")]
[DisplayName("Color Grading: Gamma")]
public Color GradeGammaNight
{
get
{
var data = mem.Data;
return CreateColor(data._r2N);
}
[ExecuteAfter("MarkDirty")]
set
{
var data = mem.Data;
data._r2N = ConvertColor(value);
mem.Data = data;
}
}
[Category("Day")]
[DisplayName("Color Grading: Gamma")]
public Color GradeGammaDay
{
get
{
var data = mem.Data;
return CreateColor(data._r2D);
}
[ExecuteAfter("MarkDirty")]
set
{
var data = mem.Data;
data._r2D = ConvertColor(value);
mem.Data = data;
}
}
[Category("Night")]
[DisplayName("Color Grading: Gain")]
public Color GradeGainNight
{
get
{
var data = mem.Data;
return CreateColor(data._r3N);
}
[ExecuteAfter("MarkDirty")]
set
{
var data = mem.Data;
data._r3N = ConvertColor(value);
mem.Data = data;
}
}
[Category("Day")]
[DisplayName("Color Grading: Gain")]
public Color GradeGainDay
{
get
{
var data = mem.Data;
return CreateColor(data._r3D);
}
[ExecuteAfter("MarkDirty")]
set
{
var data = mem.Data;
data._r3D = ConvertColor(value);
mem.Data = data;
}
}
[Category("Night")]
[DisplayName("Light direction")]
[Range(-1, 1, 0.1f)]
public float4 LightDirectionNight
{
get
{
var data = mem.Data;
return data._lN;
}
[ExecuteAfter("MarkDirty")]
set
{
var data = mem.Data;
data._lN = value;
mem.Data = data;
}
}
[Category("Day")]
[DisplayName("Light direction")]
[Range(-1, 1, 0.1f)]
public float4 LightDirectionDay
{
get
{
var data = mem.Data;
return data._lD;
}
[ExecuteAfter("MarkDirty")]
set
{
var data = mem.Data;
data._lD = value;
mem.Data = data;
}
}
private static Color CreateColor(float4 val)
{
return Color.FromArgb((int)(val.w * 255), (int)(val.x * 255), (int)(val.y * 255), (int)(val.z * 255));
}
private static float4 ConvertColor(Color val)
{
return new float4() { x = val.R / 255.0f, y = val.G / 255.0f, z = val.B / 255.0f, w = val.A / 255.0f };
}
private SharedMemory<TweakBufferType> mem;
public void Dispose()
{
Save();
mem.Close();
}
private bool dirty = false;
public void MarkDirty()
{
this.dirty = true;
}
unsafe private void Save()
{
var buffer = new byte[Marshal.SizeOf(typeof(TweakBufferType))];
using (var stream = new FileStream(path + ".bin", FileMode.Create))
{
fixed (byte* ptr = &buffer[0])
{
TweakBufferType* tweakBuffer = (TweakBufferType*)ptr;
tweakBuffer[0] = mem.Data;
}
stream.Write(buffer, 0, buffer.Length);
}
using (var stream = new FileStream(path + ".h", FileMode.Create))
{
using (var writer = new StreamWriter(stream))
{
writer.Write("#pragma once\n\n");
writer.Write("#define " + path.ToUpper() + "_SIZE " + buffer.Length + "\n\n");
writer.Write("#pragma data_seg(\"." + path + "\")\n");
writer.Write("static unsigned char " + path + "[] = {\n\t");
foreach (var b in buffer)
{
writer.Write("" + b + ", ");
}
writer.Write("\n};\n");
}
}
}
}
}

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Tweaky
{
/// <summary>
/// Interaction logic for DefaultEditor.xaml
/// </summary>
public class DefaultEditor : EditorBase<object>
{
static DefaultEditor()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(DefaultEditor), new FrameworkPropertyMetadata(typeof(DefaultEditor)));
}
}
}

View File

@@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using Tweaky.PropertyGrid;
namespace Tweaky
{
public class EditorBase<T> : Control, INotifyPropertyChanged
{
static EditorBase()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(EditorBase<T>), new FrameworkPropertyMetadata(typeof(EditorBase<T>)));
}
public EditorBase()
{
this.DataContextChanged += EditorBase_DataContextChanged;
}
void EditorBase_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if (e.OldValue != null && e.OldValue is PropertyItem)
(e.OldValue as PropertyItem).PropertyChanged -= EditorBase_PropertyChanged;
if (e.NewValue != null && e.NewValue is PropertyItem)
{
(e.NewValue as PropertyItem).PropertyChanged -= EditorBase_PropertyChanged;
(e.NewValue as PropertyItem).PropertyChanged += EditorBase_PropertyChanged;
}
}
void EditorBase_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "Value")
OnValueChanged();
}
public event PropertyChangedEventHandler PropertyChanged;
public void RaisePropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
public virtual void OnValueChanged()
{
RaisePropertyChanged(null);
}
public float Step
{
get
{
return 1.0f;
}
}
public virtual T Value
{
get
{
if (this.DataContext is PropertyItem)
return (T)(this.DataContext as PropertyItem).Value;
return default(T);
}
set
{
if (this.DataContext is PropertyItem)
{
(this.DataContext as PropertyItem).Value = value;
OnValueChanged();
}
}
}
}
}

View File

@@ -0,0 +1,246 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:c="clr-namespace:Tweaky"
xmlns:e="clr-namespace:Tweaky">
<Style x:Key="{x:Type e:Float4Editor}" TargetType="{x:Type Control}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Control}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Margin="2,0,2,1" VerticalAlignment="Center">X:</TextBlock>
<TextBlock Grid.Column="3" Margin="2,0,2,1" VerticalAlignment="Center">Y:</TextBlock>
<TextBlock Grid.Column="6" Margin="2,0,2,1" VerticalAlignment="Center">Z:</TextBlock>
<TextBlock Grid.Column="9" Margin="2,0,2,1" VerticalAlignment="Center">W:</TextBlock>
<Slider SmallChange="{Binding Step, RelativeSource={RelativeSource TemplatedParent}}" Minimum="{Binding Minimum, RelativeSource={RelativeSource TemplatedParent}}" Maximum="{Binding Maximum, RelativeSource={RelativeSource TemplatedParent}}" Grid.Column="1" VerticalAlignment="Stretch" IsEnabled="{Binding IsEnabled, RelativeSource={RelativeSource TemplatedParent}}" Value="{Binding X, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" />
<Slider SmallChange="{Binding Step, RelativeSource={RelativeSource TemplatedParent}}" Minimum="{Binding Minimum, RelativeSource={RelativeSource TemplatedParent}}" Maximum="{Binding Maximum, RelativeSource={RelativeSource TemplatedParent}}" Grid.Column="4" VerticalAlignment="Stretch" IsEnabled="{Binding IsEnabled, RelativeSource={RelativeSource TemplatedParent}}" Value="{Binding Y, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" />
<Slider SmallChange="{Binding Step, RelativeSource={RelativeSource TemplatedParent}}" Minimum="{Binding Minimum, RelativeSource={RelativeSource TemplatedParent}}" Maximum="{Binding Maximum, RelativeSource={RelativeSource TemplatedParent}}" Grid.Column="7" VerticalAlignment="Stretch" IsEnabled="{Binding IsEnabled, RelativeSource={RelativeSource TemplatedParent}}" Value="{Binding Z, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" />
<Slider SmallChange="{Binding Step, RelativeSource={RelativeSource TemplatedParent}}" Minimum="{Binding Minimum, RelativeSource={RelativeSource TemplatedParent}}" Maximum="{Binding Maximum, RelativeSource={RelativeSource TemplatedParent}}" Grid.Column="10" VerticalAlignment="Stretch" IsEnabled="{Binding IsEnabled, RelativeSource={RelativeSource TemplatedParent}}" Value="{Binding W, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" />
<TextBlock Grid.Column="2" IsEnabled="{Binding IsEnabled, RelativeSource={RelativeSource TemplatedParent}}" Text="{Binding X, RelativeSource={RelativeSource TemplatedParent}, StringFormat=N2}" />
<TextBlock Grid.Column="5" IsEnabled="{Binding IsEnabled, RelativeSource={RelativeSource TemplatedParent}}" Text="{Binding Y, RelativeSource={RelativeSource TemplatedParent}, StringFormat=N2}" />
<TextBlock Grid.Column="8" IsEnabled="{Binding IsEnabled, RelativeSource={RelativeSource TemplatedParent}}" Text="{Binding Z, RelativeSource={RelativeSource TemplatedParent}, StringFormat=N2}" />
<TextBlock Grid.Column="11" IsEnabled="{Binding IsEnabled, RelativeSource={RelativeSource TemplatedParent}}" Text="{Binding W, RelativeSource={RelativeSource TemplatedParent}, StringFormat=N2}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="{x:Type e:ColorEditorBase}" TargetType="{x:Type e:ColorEditorBase}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type e:ColorEditorBase}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border x:Name="SVGradientBorder" Margin="5" BorderThickness="1" CornerRadius="2" Height="64" Width="64">
<Border.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFFFFFFF" Offset="0" />
<GradientStop Color="#80FFFFFF" Offset="1" />
</LinearGradientBrush>
</Border.BorderBrush>
<Grid>
<Border x:Name="PART_SatValImage" Background="{Binding HueBrush, RelativeSource={RelativeSource TemplatedParent}}" />
<Border IsHitTestVisible="False">
<Border.Background>
<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="Transparent" Offset="1" />
</LinearGradientBrush>
</Border.Background>
</Border>
<Border IsHitTestVisible="False">
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#00000000" Offset="0" />
<GradientStop Color="Black" Offset="1" />
</LinearGradientBrush>
</Border.Background>
</Border>
<Border CornerRadius="1" BorderThickness="1" IsHitTestVisible="False">
<Border.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#80000000" Offset="0" />
<GradientStop Color="#40000000" Offset="1" />
</LinearGradientBrush>
</Border.BorderBrush>
</Border>
<Canvas IsHitTestVisible="False" Margin="-3">
<Path Canvas.Left="{Binding SatIndicatorPosition, RelativeSource={RelativeSource TemplatedParent}}" Canvas.Top="{Binding ValIndicatorPosition, RelativeSource={RelativeSource TemplatedParent}}" x:Name="SatValIndicator" Data="M0,3 L3,0 L6,3 L3,6 Z" Stroke="{DynamicResource Foreground}" Fill="{DynamicResource DarkBackground}">
<Path.Effect>
<DropShadowEffect ShadowDepth="1" BlurRadius="1" Opacity="0.5" />
</Path.Effect>
</Path>
</Canvas>
</Grid>
</Border>
<Grid Grid.Column="1" Margin="0,5,5,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Grid.ColumnSpan="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border x:Name="HGradientBorder" BorderThickness="1" Height="30" Margin="0,0,10,0" Background="{DynamicResource PseudoTransparent}" CornerRadius="2">
<Border.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFFFFFFF" Offset="0" />
<GradientStop Color="#80FFFFFF" Offset="1" />
</LinearGradientBrush>
</Border.BorderBrush>
<Grid>
<Image x:Name="PART_HueImage" Stretch="Fill" Source="/Tweaky;component/hue.png" Height="8" />
<Canvas IsHitTestVisible="False" Margin="-3">
<Path Canvas.Left="{Binding HueIndicatorPosition, RelativeSource={RelativeSource TemplatedParent}}" x:Name="HueIndicator" Data="M0,0 L6,0 L3,3 Z M3,3 L3,31 M3,31 L0,34 L6,34 Z" Stroke="{DynamicResource Foreground}" Fill="{DynamicResource DarkBackground}">
<Path.Effect>
<DropShadowEffect ShadowDepth="1" BlurRadius="1" Opacity="0.5" Color="White" />
</Path.Effect>
</Path>
</Canvas>
<Border CornerRadius="1" BorderThickness="1" IsHitTestVisible="False">
<Border.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#80000000" Offset="0" />
<GradientStop Color="#40000000" Offset="1" />
</LinearGradientBrush>
</Border.BorderBrush>
</Border>
</Grid>
</Border>
<Border x:Name="ColorPreviewBorder" BorderThickness="1" Width="200" Height="30" Grid.Column="1" CornerRadius="2">
<Border.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFFFFFFF" Offset="0" />
<GradientStop Color="#80FFFFFF" Offset="1" />
</LinearGradientBrush>
</Border.BorderBrush>
<Border CornerRadius="1" BorderThickness="1">
<Border.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#80000000" Offset="0" />
<GradientStop Color="#40000000" Offset="1" />
</LinearGradientBrush>
</Border.BorderBrush>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border Background="White" Grid.Row="0" Grid.Column="0" />
<Border Background="Silver" Grid.Row="1" Grid.Column="0" />
<Border Background="Silver" Grid.Row="0" Grid.Column="1" />
<Border Background="White" Grid.Row="1" Grid.Column="1" />
<Border Background="White" Grid.Row="0" Grid.Column="2" />
<Border Background="Silver" Grid.Row="1" Grid.Column="2" />
<Border Background="Silver" Grid.Row="0" Grid.Column="3" />
<Border Background="White" Grid.Row="1" Grid.Column="3" />
<Border Background="White" Grid.Row="0" Grid.Column="4" />
<Border Background="Silver" Grid.Row="1" Grid.Column="4" />
<Border Background="Silver" Grid.Row="0" Grid.Column="5" />
<Border Background="White" Grid.Row="1" Grid.Column="5" />
<Border Background="White" Grid.Row="0" Grid.Column="6" />
<Border Background="Silver" Grid.Row="1" Grid.Column="6" />
<Border Background="Silver" Grid.Row="0" Grid.Column="7" />
<Border Background="White" Grid.Row="1" Grid.Column="7" />
<Border Background="White" Grid.Row="0" Grid.Column="8" />
<Border Background="Silver" Grid.Row="1" Grid.Column="8" />
<Border Background="Silver" Grid.Row="0" Grid.Column="9" />
<Border Background="White" Grid.Row="1" Grid.Column="9" />
<Border Background="White" Grid.Row="0" Grid.Column="10" />
<Border Background="Silver" Grid.Row="1" Grid.Column="10" />
<Border Background="Silver" Grid.Row="0" Grid.Column="11" />
<Border Background="White" Grid.Row="1" Grid.Column="11" />
<Border Background="White" Grid.Row="0" Grid.Column="12" />
<Border Background="Silver" Grid.Row="1" Grid.Column="12" />
<Border Background="Silver" Grid.Row="0" Grid.Column="13" />
<Border Background="White" Grid.Row="1" Grid.Column="13" />
<Border Grid.RowSpan="2" Grid.ColumnSpan="7" Background="{Binding ExternalBackgroundBrush, RelativeSource={RelativeSource TemplatedParent}}" Cursor="UpArrow" x:Name="PART_OriginalColorBorder" />
<Border Grid.RowSpan="2" Grid.Column="7" Grid.ColumnSpan="7" Background="{Binding BackgroundBrush, RelativeSource={RelativeSource TemplatedParent}}" />
</Grid>
</Border>
</Border>
</Grid>
<Border Grid.Row="1" Height="10" />
<TextBlock Grid.Row="3" Margin="2" VerticalAlignment="Center">Red:</TextBlock>
<Slider Grid.Row="3" Margin="2" Value="{Binding Red, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" Maximum="1" Grid.Column="1" />
<TextBlock Grid.Row="3" Margin="2" Grid.Column="2" VerticalAlignment="Center" Text="{Binding Red, StringFormat=N2, RelativeSource={RelativeSource TemplatedParent}}" />
<TextBlock Grid.Row="3" Margin="2" Grid.Column="3" VerticalAlignment="Center">Green:</TextBlock>
<Slider Grid.Row="3" Margin="2" Value="{Binding Green, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" Maximum="1" Grid.Column="4" />
<TextBlock Grid.Row="3" Margin="2" Grid.Column="5" VerticalAlignment="Center" Text="{Binding Green, StringFormat=N2, RelativeSource={RelativeSource TemplatedParent}}" />
<TextBlock Grid.Row="3" Margin="2" Grid.Column="6" VerticalAlignment="Center">Blue:</TextBlock>
<Slider Grid.Row="3" Margin="2" Value="{Binding Blue, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" Maximum="1" Grid.Column="7" />
<TextBlock Grid.Row="3" Margin="2" Grid.Column="8" VerticalAlignment="Center" Text="{Binding Blue, StringFormat=N2, RelativeSource={RelativeSource TemplatedParent}}" />
<TextBlock Visibility="{Binding AlphaGuiVisibility, RelativeSource={RelativeSource TemplatedParent}}" Grid.Row="3" Margin="2" Grid.Column="9" VerticalAlignment="Center">Alpha:</TextBlock>
<Slider Visibility="{Binding AlphaGuiVisibility, RelativeSource={RelativeSource TemplatedParent}}" Grid.Row="3" Margin="2" Maximum="1" Value="{Binding Alpha, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" Grid.Column="10" />
<TextBlock Grid.Row="3" Margin="2" Grid.Column="11" VerticalAlignment="Center" Text="{Binding Alpha, StringFormat=N2, RelativeSource={RelativeSource TemplatedParent}}" />
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Slider.Maximum" Value="255" />
<Setter Property="Slider.LargeChange" Value="16" />
<Setter Property="Slider.SmallChange" Value="1" />
</Style>
<Style x:Key="{x:Type e:FloatArrayColorEditor}" TargetType="{x:Type e:FloatArrayColorEditor}" BasedOn="{StaticResource {x:Type e:ColorEditorBase}}">
<Setter Property="Slider.Maximum" Value="1" />
<Setter Property="Slider.LargeChange" Value="0.1" />
<Setter Property="Slider.SmallChange" Value="0.01" />
</Style>
</ResourceDictionary>

View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Tweaky.PropertyGrid;
namespace Tweaky
{
/// <summary>
/// Interaction logic for EnumEditor.xaml
/// </summary>
public class EnumEditor : EditorBase<System.Enum>
{
static EnumEditor()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(EnumEditor), new FrameworkPropertyMetadata(typeof(EnumEditor)));
}
public virtual Array Items
{
get
{
if (this.DataContext == null)
return new object[0];
var pi = this.DataContext as PropertyItem;
return Enum.GetValues(pi.PropertyDescriptor.PropertyType);
}
}
}
}

View File

@@ -0,0 +1,58 @@
using PostSharp.Aspects;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace Tweaky
{
[Serializable]
[global::System.AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
public sealed class ExecuteAfterAttribute : OnMethodBoundaryAspect
{
public ExecuteAfterAttribute(string methodName)
{
this.methodName = methodName;
}
private string methodName;
private Type className;
private MethodInfo method;
public override void RuntimeInitialize(System.Reflection.MethodBase method)
{
className = method.DeclaringType;
try
{
var methods = className.GetMethods();
foreach (var m in methods)
{
if (m.Name == methodName)
{
this.method = m;
}
}
}
catch (Exception e)
{
if (Application.Current != null && Application.Current.MainWindow != null && !DesignerProperties.GetIsInDesignMode(Application.Current.MainWindow))
throw e;
}
}
public override void OnExit(MethodExecutionArgs args)
{
if (args == null)
return;
if (null != method)
{
method.Invoke(args.Instance, null);
}
}
}
}

View File

@@ -0,0 +1,91 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Tweaky.PropertyGrid;
namespace Tweaky
{
public class Float4Editor : EditorBase<float4>
{
static Float4Editor()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(Float4Editor), new FrameworkPropertyMetadata(typeof(Float4Editor)));
}
public override void OnValueChanged()
{
base.OnValueChanged();
RaisePropertyChanged("X");
RaisePropertyChanged("Y");
RaisePropertyChanged("Z");
RaisePropertyChanged("W");
}
public float Minimum
{
get
{
var pi = this.DataContext as PropertyItem;
var rangeAttribute = pi.PropertyDescriptor.Attributes.OfType<RangeAttribute>().FirstOrDefault();
if (rangeAttribute == null)
return 0.0f;
return rangeAttribute.Minimum;
}
}
public float Maximum
{
get
{
var pi = this.DataContext as PropertyItem;
var rangeAttribute = pi.PropertyDescriptor.Attributes.OfType<RangeAttribute>().FirstOrDefault();
if (rangeAttribute == null)
return 1.0f;
return rangeAttribute.Maximum;
}
}
public float StepHint
{
get
{
var pi = this.DataContext as PropertyItem;
var rangeAttribute = pi.PropertyDescriptor.Attributes.OfType<RangeAttribute>().FirstOrDefault();
if (rangeAttribute == null)
return 0.1f;
return rangeAttribute.StepHint;
}
}
public float X
{
get { return Value.x; }
set { Value = new float4(value, Value.y, Value.z, Value.w); }
}
public float Y
{
get { return Value.y; }
set { Value = new float4(Value.x, value, Value.z, Value.w); }
}
public float Z
{
get { return Value.z; }
set { Value = new float4(Value.x, Value.y, value, Value.w); }
}
public float W
{
get { return Value.w; }
set { Value = new float4(Value.x, Value.y, Value.z, value); }
}
}
}

View File

@@ -0,0 +1,123 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Media;
using Tweaky.PropertyGrid;
namespace Tweaky
{
public class FloatArrayColorEditor : ColorEditorBase<float>
{
static FloatArrayColorEditor()
{
}
public override float Red
{
get
{
return Value.R / 255.0f;
}
set
{
UpdateColorFromRGB(value, Green, Blue);
}
}
public override float Green
{
get
{
return Value.G / 255.0f;
}
set
{
UpdateColorFromRGB(Red, value, Blue);
}
}
public override float Blue
{
get
{
return Value.B / 255.0f;
}
set
{
UpdateColorFromRGB(Red, Green, value);
}
}
public override float Alpha
{
get
{
if (!UseAlpha)
return 0.0f;
return Value.A / 255.0f;
}
set
{
if (!UseAlpha)
return;
Values = new float[]
{
value,
Red,
Green,
Blue
};
UpdateColorFromHSV(hue, sat, val);
}
}
private bool colorInitialized;
protected override void UpdateColorFromHSV(double hue, double sat, double val)
{
var rgb = HSVtoRGB(hue, sat, val);
Values = new float[] { Alpha, (float)rgb[0], (float)rgb[1], (float)rgb[2] };
BackgroundBrush = new SolidColorBrush(Color.FromArgb(Value.A, Value.R, Value.G, Value.B));
if (!colorInitialized)
{
colorInitialized = true;
ExternalBackgroundBrush = new SolidColorBrush(Color.FromArgb(Value.A, Value.R, Value.G, Value.B));
}
rgb = HSVtoRGB(hue, 1.0, 1.0);
HueBrush = new SolidColorBrush(Color.FromArgb(255, (byte)(255 * rgb[0]), (byte)(255 * rgb[1]), (byte)(255 * rgb[2])));
RaisePropertyChanged(null);
}
protected override void UpdateColorFromRGB(float red, float green, float blue)
{
var hsv = RGBtoHSV(red, green, blue);
hue = hsv[0];
sat = hsv[1];
val = hsv[2];
UpdateColorFromHSV(hue, sat, val);
}
protected override void UpdateColor(System.Drawing.Color color)
{
UpdateColorFromRGB(color.R / 255.0f, color.G / 255.0f, color.B / 255.0f);
}
protected override void InitializeFromExternalColor()
{
var hsv = RGBtoHSV(Red, Green, Blue);
hue = hsv[0];
sat = hsv[1];
val = hsv[2];
UpdateColorFromHSV(hue, sat, val);
}
protected override System.Drawing.Color GetColorFromValues(float[] values)
{
return System.Drawing.Color.FromArgb((int)(values[0] * 255.0f), (int)(values[1] * 255.0f), (int)(values[2] * 255.0f), (int)(values[3] * 255.0f));
}
}
}

View File

@@ -0,0 +1,10 @@
<Window x:Class="Tweaky.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:pg="clr-namespace:Tweaky.PropertyGrid"
xmlns:l="clr-namespace:Tweaky"
Title="Tweaky" Height="1000" Width="600" Left="0" Top="0">
<Grid>
<pg:PropertyGrid Background="{DynamicResource GeneralBackground}" Foreground="{DynamicResource Foreground}" BorderBrush="Transparent" BorderThickness="0" ItemsSource="{Binding Data}" ItemsSourceName="Tweaky" ItemsSourceType="for intro variables" />
</Grid>
</Window>

View File

@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Tweaky
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.Loaded += MainWindow_Loaded;
this.Closed += MainWindow_Closed;
}
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
this.DataContext = this;
this.Data = new DataViewModel("tweakValues");
}
void MainWindow_Closed(object sender, EventArgs e)
{
if (this.Data != null)
this.Data.Dispose();
}
public DataViewModel Data { get; set; }
}
}

View File

@@ -0,0 +1,92 @@
using PostSharp.Aspects;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace Tweaky
{
[Serializable]
[global::System.AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
public sealed class NotifyAttribute : OnMethodBoundaryAspect
{
private List<string> additionalProperties = new List<string>();
public NotifyAttribute()
{
}
public NotifyAttribute(string additionalProperties)
{
if (additionalProperties != null)
{
var properties = additionalProperties.Split(',');
this.additionalProperties.AddRange(properties);
}
}
private string methodName;
private Type className;
private MethodInfo method;
private MethodInfo getter;
public override void RuntimeInitialize(System.Reflection.MethodBase method)
{
methodName = method.Name;
className = method.DeclaringType;
try
{
var methods = className.GetMethods();
foreach (var m in methods)
{
if (m.Name == "RaisePropertyChanged")
{
this.method = m;
}
}
}
catch (Exception e)
{
if (Application.Current != null && Application.Current.MainWindow != null && !DesignerProperties.GetIsInDesignMode(Application.Current.MainWindow))
throw e;
}
}
private object oldValue;
public override void OnEntry(MethodExecutionArgs args)
{
if (args == null)
return;
if (null != getter)
getter = args.Instance.GetType().GetMethod("get_" + methodName.Substring(4));
if (null != getter)
oldValue = getter.Invoke(args.Instance, null);
}
public override void OnExit(MethodExecutionArgs args)
{
if (args == null)
return;
if (null != method)
{
if (null != getter)
{
var newValue = getter.Invoke(args.Instance, null);
if (newValue == null && oldValue == null || (newValue != null && newValue.Equals(oldValue)))
return;
}
method.Invoke(args.Instance, new object[] { methodName.Substring(4) });
foreach (var prop in additionalProperties)
method.Invoke(args.Instance, new object[] { prop });
}
}
}
}

View File

@@ -0,0 +1,66 @@
using System.Collections.Generic;
using System.Linq;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
namespace Tweaky
{
public class ObservableCollectionEx<T> : ObservableCollection<T>
{
public virtual void NotifyCollectionChanged()
{
this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
}
protected bool preventCollectionChangedEvents = false;
protected override void OnCollectionChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if (!preventCollectionChangedEvents)
base.OnCollectionChanged(e);
}
public void AddRange(IEnumerable<T> range)
{
foreach (var item in range)
base.Add(item);
}
public void Replace(IEnumerable<T> range, bool useResetEvent = true)
{
preventCollectionChangedEvents = true;
List<T> oldItems = null;
List<T> newItems = null;
if (!useResetEvent)
{
oldItems = this.Except(range).ToList();
newItems = range.Except(this).ToList();
}
base.Clear();
foreach (var item in range)
base.Add(item);
preventCollectionChangedEvents = false;
if (useResetEvent)
{
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
}
else
{
foreach (var oldItem in oldItems)
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, oldItem));
foreach (var newItem in newItems)
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, newItem));
}
}
public void RemoveAll(IEnumerable<T> range)
{
foreach (var item in range)
base.Remove(item);
}
}
}

View File

@@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Tweaky")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Tweaky")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Tweaky.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tweaky.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34011
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Tweaky.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
namespace Tweaky.PropertyGrid
{
public class EditorTemplateSelector : DataTemplateSelector
{
public EditorTemplateSelector()
{
defaultDataTemplate = new DataTemplate() { VisualTree = new FrameworkElementFactory(typeof(DefaultEditor)) };
}
private DataTemplate defaultDataTemplate;
public override DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container)
{
if (item == null)
return defaultDataTemplate;
if (!(item is PropertyItem))
return defaultDataTemplate;
var pd = (item as PropertyItem).PropertyDescriptor;
var editorAttribute = pd.Attributes.OfType<EditorAttribute>().LastOrDefault();
if (editorAttribute != null)
{
var editorType = Type.GetType(editorAttribute.EditorTypeName);
if (typeof(FrameworkElement).IsAssignableFrom(editorType))
return new DataTemplate() { VisualTree = new FrameworkElementFactory(editorType) };
}
if (pd.PropertyType.IsEnum)
{
return new DataTemplate() { VisualTree = new FrameworkElementFactory(typeof(EnumEditor)) };
}
else if (pd.PropertyType == typeof(System.Drawing.Color))
{
return new DataTemplate() { VisualTree = new FrameworkElementFactory(typeof(FloatArrayColorEditor)) };
}
else if (pd.PropertyType == typeof(float4))
{
return new DataTemplate() { VisualTree = new FrameworkElementFactory(typeof(Float4Editor)) };
}
return defaultDataTemplate;
}
}
}

View File

@@ -0,0 +1,158 @@
<UserControl x:Class="Tweaky.PropertyGrid.PropertyGrid"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:pg="clr-namespace:Tweaky.PropertyGrid"
xmlns:t="clr-namespace:Tweaky"
xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
mc:Ignorable="d"
x:Name="Me"
d:DesignHeight="300" d:DesignWidth="300" d:DataContext="{d:DesignInstance Type={x:Type t:DataViewModel}}" >
<UserControl.Resources>
<pg:EditorTemplateSelector x:Key="EditorTemplateSelector" />
<Style x:Key="ClearFilterButtonStyle" TargetType="{x:Type Button}">
<Setter Property="Foreground" Value="{DynamicResource ForegroundGradient}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid Background="{DynamicResource PseudoTransparent}">
<Border x:Name="hoverBorder" CornerRadius="2" BorderBrush="{DynamicResource SeparatingBorder}" BorderThickness="1" Background="{DynamicResource ForegroundGradient}" Visibility="Collapsed" />
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="hoverBorder" Property="Visibility" Value="Visible" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="hoverBorder" Property="Background" Value="{DynamicResource BrightGradient}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<CollectionViewSource Source="{Binding PropertyItems, ElementName=Me}" x:Key="collectionView" Filter="CollectionViewSource_Filter" CollectionViewType="ListCollectionView">
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName="Category" Direction="Ascending" />
<scm:SortDescription PropertyName="Index" Direction="Ascending" />
</CollectionViewSource.SortDescriptions>
<CollectionViewSource.GroupDescriptions>
<PropertyGroupDescription PropertyName="Category" />
</CollectionViewSource.GroupDescriptions>
</CollectionViewSource>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border Grid.RowSpan="2" Background="{DynamicResource BarGradient}" />
<StackPanel Orientation="Horizontal" Margin="13,0,0,2">
<TextBlock Foreground="{DynamicResource Foreground}" Text="{Binding ItemsSourceName, ElementName=Me}" MinWidth="50" Margin="0,1,0,0" TextBlock.FontWeight="Bold" VerticalAlignment="Center" />
<TextBlock Foreground="{DynamicResource Foreground}" Text="{Binding ItemsSourceType, ElementName=Me}" Margin="5,1,0,0" VerticalAlignment="Center" />
</StackPanel>
<Border Name="searchBoxContainer" Grid.Row="1" Margin="4" BorderThickness="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Text="Search:" VerticalAlignment="Center" Margin="3,0" Foreground="{DynamicResource Foreground}" />
<TextBox Grid.Column="1" Text="{Binding Filter, ElementName=Me, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</Grid>
</Border>
<ScrollViewer ScrollViewer.VerticalScrollBarVisibility="Auto" Grid.Row="2" CanContentScroll="False">
<ItemsControl x:Name="PART_PropertyItemsControl" IsTabStop="False" Focusable="False" VerticalAlignment="Top" ItemsSource="{Binding Source={StaticResource collectionView}}">
<ItemsControl.Resources>
<Style TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource {x:Type ScrollViewer}}">
<Setter Property="HorizontalScrollBarVisibility" Value="Hidden" />
<Setter Property="VerticalScrollBarVisibility" Value="Hidden" />
<Setter Property="CanContentScroll" Value="False" />
</Style>
</ItemsControl.Resources>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.GroupStyle>
<GroupStyle>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Border>
<Expander IsExpanded="True">
<Expander.Header>
<TextBlock Foreground="{DynamicResource Foreground}" Text="{Binding Name}" />
</Expander.Header>
<ItemsPresenter Margin="10,0,0,0" />
</Expander>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</ItemsControl.GroupStyle>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type pg:PropertyItem}">
<Border x:Name="MainBorder" ContextMenuService.Placement="Bottom" SnapsToDevicePixels="True" UseLayoutRounding="False" Background="{DynamicResource PseudoTransparent}" PreviewMouseDown="PropertyItem_PreviewMouseDown">
<Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Border Name="PART_Name" VerticalAlignment="Stretch" Margin="0,0,0,1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="10" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
<TextBlock VerticalAlignment="Center" Text="{Binding Name}" Foreground="{DynamicResource Foreground}" />
<TextBlock VerticalAlignment="Center" Text=":" Foreground="{DynamicResource Foreground}" />
</StackPanel>
</Grid>
</Border>
<Border Name="PART_Editor" Grid.Row="1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="10,0,1,0">
<ContentPresenter ContentTemplateSelector="{StaticResource EditorTemplateSelector}" Content="{Binding}" SnapsToDevicePixels="True" UseLayoutRounding="False" />
<!--<TextBox Name="PART_ValueContainer" MaxLines="1" PreviewMouseWheel="PART_ValueContainer_PreviewMouseWheel" Text="{Binding Value, Mode=TwoWay}" Focusable="False" IsTabStop="False" IsEnabled="{Binding IsReadOnly, Converter={StaticResource InvBooleanToVisibilityConverter}}" TextOptions.TextFormattingMode="Display" />-->
</Border>
</Grid>
</Border>
<DataTemplate.Triggers>
<Trigger Property="UIElement.IsMouseOver" Value="True">
<Setter TargetName="MainBorder" Property="Border.Background" Value="{DynamicResource LightGradient}" />
</Trigger>
<DataTrigger Binding="{Binding IsSelected}" Value="True">
<Setter TargetName="MainBorder" Property="Border.Background" Value="{DynamicResource BrightGradient}" />
</DataTrigger>
<!--<Trigger Property="UIElement.IsEnabled" Value="False">
<Setter TargetName="PART_ValueContainer" Value="{DynamicResource DisabledForegroundBrush}" Property="Control.Foreground" />
</Trigger>-->
<Trigger Property="Validation.HasError" Value="True">
<Setter Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors).CurrentItem.ErrorContent}" Property="FrameworkElement.ToolTip" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<GridSplitter Grid.Row="3" Height="5" ResizeBehavior="PreviousAndNext" HorizontalAlignment="Stretch" Background="{DynamicResource PseudoTransparent}" ResizeDirection="Rows" />
<StackPanel Grid.Row="4" Margin="0,0,0,5">
<TextBlock Foreground="{DynamicResource Foreground}" Padding="2 2 2 0" TextBlock.FontWeight="Bold" Text="{Binding SelectedPropertyItem.Name, ElementName=Me}" />
<TextBlock Foreground="{DynamicResource Foreground}" Padding="5 2 2 0" TextWrapping="WrapWithOverflow" Text="{Binding SelectedPropertyItem.Description, ElementName=Me}" />
</StackPanel>
</Grid>
</UserControl>

View File

@@ -0,0 +1,172 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Tweaky.PropertyGrid
{
/// <summary>
/// Interaction logic for PropertyGrid.xaml
/// </summary>
public partial class PropertyGrid : UserControl, INotifyPropertyChanged
{
public PropertyGrid()
{
InitializeComponent();
PropertyItems = new ObservableCollection<PropertyItem>();
LeftColumn = new GridLength(150, GridUnitType.Pixel);
RightColumn = new GridLength(1, GridUnitType.Star);
}
public ObservableCollection<PropertyItem> PropertyItems
{
get;
private set;
}
public GridLength LeftColumn
{
get;
[Notify]
set;
}
public GridLength RightColumn
{
get;
[Notify]
set;
}
private string filter;
public string Filter
{
get
{
return filter;
}
[Notify]
set
{
filter = value;
(this.Resources["collectionView"] as CollectionViewSource).View.Refresh();
}
}
public PropertyItem SelectedPropertyItem
{
get { return (PropertyItem)this.GetValue(SelectedPropertyItemProperty); }
[Notify]
set { this.SetValue(SelectedPropertyItemProperty, value); }
}
public static readonly DependencyProperty SelectedPropertyItemProperty = DependencyProperty.Register("SelectedPropertyItem", typeof(PropertyItem), typeof(PropertyGrid), new FrameworkPropertyMetadata(null));
public string ItemsSourceType
{
get { return (string)this.GetValue(ItemsSourceTypeProperty); }
[Notify]
set { this.SetValue(ItemsSourceTypeProperty, value); }
}
public static readonly DependencyProperty ItemsSourceTypeProperty = DependencyProperty.Register("ItemsSourceType", typeof(string), typeof(PropertyGrid), new FrameworkPropertyMetadata(null));
public string ItemsSourceName
{
get { return (string)this.GetValue(ItemsSourceNameProperty); }
[Notify]
set { this.SetValue(ItemsSourceNameProperty, value); }
}
public static readonly DependencyProperty ItemsSourceNameProperty = DependencyProperty.Register("ItemsSourceName", typeof(string), typeof(PropertyGrid), new FrameworkPropertyMetadata(null));
public object ItemsSource
{
get { return this.GetValue(ItemsSourceProperty); }
[Notify]
set { this.SetValue(ItemsSourceProperty, value); }
}
public static readonly DependencyProperty ItemsSourceProperty = DependencyProperty.Register("ItemsSource", typeof(object), typeof(PropertyGrid), new FrameworkPropertyMetadata(null, OnItemsSourceChanged));
private static void OnItemsSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var me = d as PropertyGrid;
if (me != null)
{
if (e.OldValue != null && e.OldValue is INotifyPropertyChanged)
(e.OldValue as INotifyPropertyChanged).PropertyChanged -= me.PropertyGrid_PropertyChanged;
UpdatePropertyItems(me.ItemsSource, me.PropertyItems);
me.RaisePropertyChanged(null);
if (e.NewValue != null && e.NewValue is INotifyPropertyChanged)
(e.NewValue as INotifyPropertyChanged).PropertyChanged += me.PropertyGrid_PropertyChanged;
}
}
void PropertyGrid_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "Properties")
{
UpdatePropertyItems(ItemsSource, PropertyItems);
RaisePropertyChanged(null);
}
}
public static void UpdatePropertyItems(object itemsSource, IList<PropertyItem> propertyItems)
{
propertyItems.Clear();
int index = 0;
if (itemsSource != null)
{
var properties = (itemsSource is ICustomTypeDescriptor) ? (itemsSource as ICustomTypeDescriptor).GetProperties() : TypeDescriptor.GetProperties(itemsSource);
foreach (PropertyDescriptor pd in properties.Cast<PropertyDescriptor>())
{
var browsableAttribute = pd.Attributes.OfType<BrowsableAttribute>().FirstOrDefault();
if (browsableAttribute != null && !browsableAttribute.Browsable)
continue;
propertyItems.Add(new PropertyItem(itemsSource, index++, pd));
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
public void RaisePropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
private void CollectionViewSource_Filter(object sender, FilterEventArgs e)
{
e.Accepted = string.IsNullOrEmpty(this.Filter) || (e.Item as PropertyItem).Name.ToLower().Contains(this.Filter.ToLower());
}
public void PropertyItem_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
var pi = (sender as FrameworkElement).DataContext as PropertyItem;
if (this.SelectedPropertyItem == pi)
return;
if (pi != null)
{
if (this.SelectedPropertyItem != null)
this.SelectedPropertyItem.IsSelected = false;
pi.IsSelected = true;
this.SelectedPropertyItem = pi;
}
}
}
}

View File

@@ -0,0 +1,148 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
namespace Tweaky.PropertyGrid
{
public class PropertyItem : DependencyObject, INotifyPropertyChanged
{
public PropertyItem(object source, int index, PropertyDescriptor pd)
{
this.PropertyDescriptor = pd;
this.Instance = source;
this.Index = index;
this.PropertyItems = new ObservableCollectionEx<PropertyItem>();
if (source is INotifyPropertyChanged)
(source as INotifyPropertyChanged).PropertyChanged += Source_PropertyChanged;
var categoryAttribute = pd.Attributes.OfType<CategoryAttribute>().FirstOrDefault();
var descriptionAttribute = pd.Attributes.OfType<DescriptionAttribute>().FirstOrDefault();
var displayNameAttribute = pd.Attributes.OfType<DisplayNameAttribute>().FirstOrDefault();
var readOnlyAttribute = pd.Attributes.OfType<ReadOnlyAttribute>().FirstOrDefault();
Category = categoryAttribute == null ? "Misc" : categoryAttribute.Category;
Description = descriptionAttribute == null ? "" : descriptionAttribute.Description;
Name = displayNameAttribute == null ? pd.Name : displayNameAttribute.DisplayName;
if (!pd.IsReadOnly && (readOnlyAttribute == null || !readOnlyAttribute.IsReadOnly))
{
IsReadOnly = false;
BindingOperations.SetBinding(this, ValueProperty, new Binding() { Source = source, Path = new PropertyPath(pd.Name) });
}
else
{
IsReadOnly = true;
BindingOperations.SetBinding(this, ValueProperty, new Binding() { Source = source, Path = new PropertyPath(pd.Name), Mode = BindingMode.OneWay });
}
}
void Source_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == this.PropertyDescriptor.Name || string.IsNullOrEmpty(e.PropertyName))
RaisePropertyChanged("Value");
}
public int Index
{
get;
private set;
}
public PropertyItem Parent
{
get;
private set;
}
public object Instance
{
get;
private set;
}
public PropertyDescriptor PropertyDescriptor
{
get;
private set;
}
public string Category
{
get;
private set;
}
public string Description
{
get;
private set;
}
public string Name
{
get;
private set;
}
public bool IsReadOnly
{
get;
private set;
}
public bool IsEditable
{
get
{
return !IsReadOnly;
}
}
public bool IsExpanded
{
get;
[Notify]
set;
}
public bool IsSelected
{
get;
[Notify]
set;
}
public object Value
{
get { return this.GetValue(ValueProperty); }
[Notify]
set { this.SetValue(ValueProperty, value); }
}
public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(object), typeof(PropertyItem), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnValueChanged));
private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var pi = (d as PropertyItem);
pi.RaisePropertyChanged("Value");
(pi.Instance as ViewModelBase).RaisePropertyChanged("Name");
}
public event PropertyChangedEventHandler PropertyChanged;
public void RaisePropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
public ObservableCollectionEx<PropertyItem> PropertyItems
{
get;
private set;
}
}
}

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tweaky
{
public class RangeAttribute : Attribute
{
public RangeAttribute(float minimum, float maximum, float stepHint)
{
this.Minimum = minimum;
this.Maximum = maximum;
this.StepHint = stepHint;
}
public float Minimum { get; private set; }
public float Maximum { get; private set; }
public float StepHint { get; private set; }
}
}

View File

@@ -0,0 +1,78 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
<Style x:Key="{x:Type ButtonBase}" TargetType="{x:Type ButtonBase}">
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Foreground" Value="{DynamicResource ForegroundGradient}" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ButtonBase}">
<Grid Background="{DynamicResource PseudoTransparent}">
<Border x:Name="checkedBorder" CornerRadius="2" BorderBrush="{DynamicResource SunkenBorder}" BorderThickness="1" Background="{DynamicResource SunkenGradient}" Visibility="Collapsed" />
<Border x:Name="hoverBorder" CornerRadius="2" BorderBrush="{DynamicResource DimSeparatingBorder}" BorderThickness="1" Background="{DynamicResource LightGradient}" />
<ContentPresenter x:Name="contentPresenter" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="{TemplateBinding Padding}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="hoverBorder" Property="Background" Value="{DynamicResource BrightGradient}" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="hoverBorder" Property="Background" Value="{DynamicResource NormalGradient}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="contentPresenter" Property="Opacity" Value="0.5" />
</Trigger>
<Trigger Property="ToggleButton.IsChecked" Value="True">
<Setter TargetName="checkedBorder" Property="Visibility" Value="Visible" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="{DynamicResource HighlightGradient}" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Foreground" Value="{DynamicResource ForegroundGradient}" />
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="{x:Type Button}" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type ButtonBase}}" />
<Style x:Key="{x:Type TextBlock}" TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="{DynamicResource Foreground}" />
</Style>
<Style x:Key="ToolButton" TargetType="{x:Type ButtonBase}" BasedOn="{StaticResource {x:Type ButtonBase}}">
<Setter Property="Width" Value="20" />
<Setter Property="Height" Value="20" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ButtonBase}">
<Grid Background="{DynamicResource PseudoTransparent}">
<Border x:Name="checkedBorder" CornerRadius="2" BorderBrush="{DynamicResource SunkenBorder}" BorderThickness="1" Background="{DynamicResource SunkenGradient}" Visibility="Collapsed" />
<Border x:Name="hoverBorder" CornerRadius="2" BorderBrush="{DynamicResource DimSeparatingBorder}" BorderThickness="1" Background="{DynamicResource BrightGradient}" Visibility="Collapsed" />
<ContentPresenter x:Name="contentPresenter" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="hoverBorder" Property="Visibility" Value="Visible" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="hoverBorder" Property="Background" Value="{DynamicResource NormalGradient}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="contentPresenter" Property="Opacity" Value="0.5" />
</Trigger>
<Trigger Property="ToggleButton.IsChecked" Value="True">
<Setter TargetName="checkedBorder" Property="Visibility" Value="Visible" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

View File

@@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using System.IO.MemoryMappedFiles;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Tweaky
{
public class SharedMemory<T> where T : struct
{
// Constructor
public SharedMemory(string name, int size)
{
smName = name;
smSize = size;
}
// Methods
public bool Open()
{
try
{
// Create named MMF
mmf = MemoryMappedFile.CreateOrOpen(smName, smSize);
// Create accessors to MMF
accessor = mmf.CreateViewAccessor(0, smSize,
MemoryMappedFileAccess.ReadWrite);
// Create lock
smLock = new Mutex(true, "SM_LOCK", out locked);
}
catch
{
return false;
}
return true;
}
public void Close()
{
accessor.Dispose();
mmf.Dispose();
smLock.Close();
}
public T Data
{
get
{
T dataStruct;
accessor.Read<T>(0, out dataStruct);
return dataStruct;
}
set
{
smLock.WaitOne();
accessor.Write<T>(0, ref value);
smLock.ReleaseMutex();
}
}
// Data
private string smName;
private Mutex smLock;
private int smSize;
private bool locked;
private MemoryMappedFile mmf;
private MemoryMappedViewAccessor accessor;
}
}

View File

@@ -0,0 +1,87 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Color x:Key="TextShadowColor">Black</Color>
<Color x:Key="DarkBackgroundColor">#3B3B3B</Color>
<Color x:Key="LightBackgroundColor">#444444</Color>
<SolidColorBrush x:Key="GroupBackground" Color="#4A4A4A" />
<SolidColorBrush x:Key="LightBackground" Color="{StaticResource LightBackgroundColor}" />
<SolidColorBrush x:Key="GeneralBackground" Color="#404040" />
<SolidColorBrush x:Key="DarkBackground" Color="{StaticResource DarkBackgroundColor}" />
<SolidColorBrush x:Key="Highlight" Color="#B8B8B8" />
<SolidColorBrush x:Key="Foreground" Color="#D8D8D8" />
<SolidColorBrush x:Key="GroupText" Color="#C8C8C8" />
<SolidColorBrush x:Key="DimForeground" Color="#909090" />
<SolidColorBrush x:Key="LightSeparatingBorder" Color="#505050" />
<SolidColorBrush x:Key="SeparatingBorder" Color="#3A3A3A" />
<SolidColorBrush x:Key="DimSeparatingBorder" Color="#2D2D2D" />
<SolidColorBrush x:Key="DarkSeparatingBorder" Color="#111111" />
<SolidColorBrush x:Key="DisabledForegroundBrush" Color="#2D2D2D" />
<SolidColorBrush x:Key="SnapGuide" Color="#80A0A0A0" />
<SolidColorBrush x:Key="PlayPositionGuide" Color="Red" />
<SolidColorBrush x:Key="MenuBorder" Color="#707070" />
<SolidColorBrush x:Key="MenuBackground" Color="#606060" />
<SolidColorBrush x:Key="SeparatorHighlight" Color="#707070" />
<SolidColorBrush x:Key="SeparatorShadow" Color="#505050" />
<LinearGradientBrush x:Key="HighlightGradient" EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#D8D8D8" Offset="0" />
<GradientStop Color="#C8C8C8" Offset="1" />
</LinearGradientBrush>
<LinearGradientBrush x:Key="ForegroundGradient" EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#B5B5B5" Offset="0" />
<GradientStop Color="#949494" Offset="1" />
</LinearGradientBrush>
<LinearGradientBrush x:Key="BrightGradient" EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#707070" Offset="0" />
<GradientStop Color="#606060" Offset="1" />
</LinearGradientBrush>
<LinearGradientBrush x:Key="LightGradient" EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#606060" Offset="0" />
<GradientStop Color="#505050" Offset="1" />
</LinearGradientBrush>
<LinearGradientBrush x:Key="NormalGradient" EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#505050" Offset="0" />
<GradientStop Color="#484848" Offset="1" />
</LinearGradientBrush>
<LinearGradientBrush x:Key="BarGradient" EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#4B4B4B" Offset="0" />
<GradientStop Color="#3C3C3C" Offset="1" />
</LinearGradientBrush>
<LinearGradientBrush x:Key="SunkenGradient" EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#3C3C3C" Offset="0" />
<GradientStop Color="#4B4B4B" Offset="1" />
</LinearGradientBrush>
<LinearGradientBrush x:Key="SunkenBorder" EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#2D2D2D" Offset="0" />
<GradientStop Color="#606060" Offset="1" />
</LinearGradientBrush>
<LinearGradientBrush x:Key="ScrollbarGradient" EndPoint="1,0.5" StartPoint="0,0.5">
<GradientStop Color="#353535" Offset="0" />
<GradientStop Color="#3B3B3B" Offset="0.135" />
<GradientStop Color="#3B3B3B" Offset="0.865" />
<GradientStop Color="#353535" Offset="1" />
</LinearGradientBrush>
<SolidColorBrush x:Key="PseudoTransparent" Color="#01808080" />
<SolidColorBrush x:Key="TimelineItemForeground" Color="White" />
<LinearGradientBrush x:Key="TimelineItemGradient" EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#40000000" Offset="0" />
<GradientStop Color="#80000000" Offset="1" />
</LinearGradientBrush>
<SolidColorBrush x:Key="ToggleHBackgroundBright" Color="#E8E8E8" />
<SolidColorBrush x:Key="ToggleHForegroundBright" Color="#000000" />
<SolidColorBrush x:Key="ToggleHBackgroundDark" Color="#808080" />
<SolidColorBrush x:Key="ToggleHForegroundDark" Color="#606060" />
</ResourceDictionary>

View File

@@ -0,0 +1,168 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2C4744F2-FEAC-450E-B5C1-195F8F4E3B8E}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Tweaky</RootNamespace>
<AssemblyName>Tweaky</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<DontImportPostSharp>True</DontImportPostSharp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<UseVSHostingProcess>true</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="PostSharp">
<HintPath>..\packages\PostSharp.3.1.28\lib\net20\PostSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="ColorEditorBase.cs" />
<Compile Include="DataViewModel.cs" />
<Compile Include="DefaultEditor.cs" />
<Compile Include="EditorBase.cs" />
<Compile Include="EnumEditor.cs" />
<Compile Include="ExecuteAfterAspect.cs" />
<Compile Include="Float4Editor.cs" />
<Compile Include="FloatArrayColorEditor.cs" />
<Compile Include="ObservableCollectionEx.cs" />
<Compile Include="PropertyGrid\EditorTemplateSelector.cs" />
<Compile Include="PropertyGrid\PropertyGrid.xaml.cs">
<DependentUpon>PropertyGrid.xaml</DependentUpon>
</Compile>
<Compile Include="PropertyGrid\PropertyItem.cs" />
<Compile Include="RangeAttribute.cs" />
<Compile Include="SharedMemory.cs" />
<Compile Include="UserControl1.xaml.cs">
<DependentUpon>UserControl1.xaml</DependentUpon>
</Compile>
<Compile Include="ViewModelBase.cs" />
<Page Include="EditorTemplates.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="PropertyGrid\PropertyGrid.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Resources.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Theme.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UserControl1.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="NotifyAspect.cs" />
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Resource Include="hue.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="colorpicker.cur" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\PostSharp.3.1.28\tools\PostSharp.targets" Condition="Exists('..\packages\PostSharp.3.1.28\tools\PostSharp.targets')" />
<Target Name="EnsurePostSharpImported" BeforeTargets="BeforeBuild" Condition="'$(PostSharp30Imported)' == ''">
<Error Condition="!Exists('..\packages\PostSharp.3.1.28\tools\PostSharp.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://www.postsharp.net/links/nuget-restore." />
<Error Condition="Exists('..\packages\PostSharp.3.1.28\tools\PostSharp.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://www.postsharp.net/links/nuget-restore." />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartWorkingDirectory>E:\dx11intro\Engine\Engine\</StartWorkingDirectory>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,185 @@
<UserControl x:Class="Tweaky.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="74" d:DesignWidth="500">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border x:Name="SVGradientBorder" Margin="5" BorderThickness="1" CornerRadius="2" Height="64" Width="64">
<Border.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFFFFFFF" Offset="0" />
<GradientStop Color="#80FFFFFF" Offset="1" />
</LinearGradientBrush>
</Border.BorderBrush>
<Grid>
<Border x:Name="PART_SatValImage" Background="{Binding HueBrush, RelativeSource={RelativeSource TemplatedParent}}" />
<Border IsHitTestVisible="False">
<Border.Background>
<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="Transparent" Offset="1" />
</LinearGradientBrush>
</Border.Background>
</Border>
<Border IsHitTestVisible="False">
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#00000000" Offset="0" />
<GradientStop Color="Black" Offset="1" />
</LinearGradientBrush>
</Border.Background>
</Border>
<Border CornerRadius="1" BorderThickness="1" IsHitTestVisible="False">
<Border.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#80000000" Offset="0" />
<GradientStop Color="#40000000" Offset="1" />
</LinearGradientBrush>
</Border.BorderBrush>
</Border>
<Canvas IsHitTestVisible="False" Margin="-3">
<Path Canvas.Left="{Binding SatIndicatorPosition, RelativeSource={RelativeSource TemplatedParent}}" Canvas.Top="{Binding ValIndicatorPosition, RelativeSource={RelativeSource TemplatedParent}}" x:Name="SatValIndicator" Data="M0,3 L3,0 L6,3 L3,6 Z" Stroke="{DynamicResource Foreground}" Fill="{DynamicResource DarkBackground}">
<Path.Effect>
<DropShadowEffect ShadowDepth="1" BlurRadius="1" Opacity="0.5" />
</Path.Effect>
</Path>
</Canvas>
</Grid>
</Border>
<Grid Grid.Column="1" Margin="0,5,5,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Grid.ColumnSpan="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border x:Name="HGradientBorder" BorderThickness="1" Height="30" Margin="0,0,10,0" CornerRadius="2">
<Border.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFFFFFFF" Offset="0" />
<GradientStop Color="#80FFFFFF" Offset="1" />
</LinearGradientBrush>
</Border.BorderBrush>
<Grid>
<Image x:Name="PART_HueImage" Stretch="Fill" Source="/Tweaky;component/hue.png" Height="8" />
<Canvas IsHitTestVisible="False" Margin="-3">
<Path Canvas.Left="{Binding HueIndicatorPosition, RelativeSource={RelativeSource TemplatedParent}}" x:Name="HueIndicator" Data="M0,0 L6,0 L3,3 Z M3,3 L3,31 M3,31 L0,34 L6,34 Z" Stroke="{DynamicResource Foreground}" Fill="{DynamicResource DarkBackground}">
<Path.Effect>
<DropShadowEffect ShadowDepth="1" BlurRadius="1" Opacity="0.5" Color="White" />
</Path.Effect>
</Path>
</Canvas>
<Border CornerRadius="1" BorderThickness="1" IsHitTestVisible="False">
<Border.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#80000000" Offset="0" />
<GradientStop Color="#40000000" Offset="1" />
</LinearGradientBrush>
</Border.BorderBrush>
</Border>
</Grid>
</Border>
<Border x:Name="ColorPreviewBorder" BorderThickness="1" Width="200" Height="30" Grid.Column="1" CornerRadius="2">
<Border.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFFFFFFF" Offset="0" />
<GradientStop Color="#80FFFFFF" Offset="1" />
</LinearGradientBrush>
</Border.BorderBrush>
<Border CornerRadius="1" BorderThickness="1">
<Border.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#80000000" Offset="0" />
<GradientStop Color="#40000000" Offset="1" />
</LinearGradientBrush>
</Border.BorderBrush>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border Background="White" Grid.Row="0" Grid.Column="0" />
<Border Background="Silver" Grid.Row="1" Grid.Column="0" />
<Border Background="Silver" Grid.Row="0" Grid.Column="1" />
<Border Background="White" Grid.Row="1" Grid.Column="1" />
<Border Background="White" Grid.Row="0" Grid.Column="2" />
<Border Background="Silver" Grid.Row="1" Grid.Column="2" />
<Border Background="Silver" Grid.Row="0" Grid.Column="3" />
<Border Background="White" Grid.Row="1" Grid.Column="3" />
<Border Background="White" Grid.Row="0" Grid.Column="4" />
<Border Background="Silver" Grid.Row="1" Grid.Column="4" />
<Border Background="Silver" Grid.Row="0" Grid.Column="5" />
<Border Background="White" Grid.Row="1" Grid.Column="5" />
<Border Background="White" Grid.Row="0" Grid.Column="6" />
<Border Background="Silver" Grid.Row="1" Grid.Column="6" />
<Border Background="Silver" Grid.Row="0" Grid.Column="7" />
<Border Background="White" Grid.Row="1" Grid.Column="7" />
<Border Background="White" Grid.Row="0" Grid.Column="8" />
<Border Background="Silver" Grid.Row="1" Grid.Column="8" />
<Border Background="Silver" Grid.Row="0" Grid.Column="9" />
<Border Background="White" Grid.Row="1" Grid.Column="9" />
<Border Background="White" Grid.Row="0" Grid.Column="10" />
<Border Background="Silver" Grid.Row="1" Grid.Column="10" />
<Border Background="Silver" Grid.Row="0" Grid.Column="11" />
<Border Background="White" Grid.Row="1" Grid.Column="11" />
<Border Background="White" Grid.Row="0" Grid.Column="12" />
<Border Background="Silver" Grid.Row="1" Grid.Column="12" />
<Border Background="Silver" Grid.Row="0" Grid.Column="13" />
<Border Background="White" Grid.Row="1" Grid.Column="13" />
<Border Grid.RowSpan="2" Grid.ColumnSpan="7" Background="{Binding ExternalBackgroundBrush, RelativeSource={RelativeSource TemplatedParent}}" Cursor="UpArrow" x:Name="PART_OriginalColorBorder" />
<Border Grid.RowSpan="2" Grid.Column="7" Grid.ColumnSpan="7" Background="{Binding BackgroundBrush, RelativeSource={RelativeSource TemplatedParent}}" />
</Grid>
</Border>
</Border>
</Grid>
<Border Grid.Row="1" Height="10" />
<TextBlock Grid.Row="3" Margin="2" VerticalAlignment="Center">Red:</TextBlock>
<Slider Grid.Row="3" Margin="2" Value="{Binding Red, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" Grid.Column="1" />
<TextBlock Grid.Row="3" Margin="2" Grid.Column="2" VerticalAlignment="Center">Green:</TextBlock>
<Slider Grid.Row="3" Margin="2" Value="{Binding Green, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" Grid.Column="3" />
<TextBlock Grid.Row="3" Margin="2" Grid.Column="4" VerticalAlignment="Center">Blue:</TextBlock>
<Slider Grid.Row="3" Margin="2" Value="{Binding Blue, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" Grid.Column="5" />
<TextBlock Visibility="{Binding AlphaGuiVisibility, RelativeSource={RelativeSource TemplatedParent}}" Grid.Row="3" Margin="2" Grid.Column="6" VerticalAlignment="Center">Alpha:</TextBlock>
<Slider Visibility="{Binding AlphaGuiVisibility, RelativeSource={RelativeSource TemplatedParent}}" Grid.Row="3" Margin="2" Value="{Binding Alpha, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" Grid.Column="7" />
</Grid>
</Grid>
</UserControl>

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Tweaky
{
/// <summary>
/// Interaction logic for UserControl1.xaml
/// </summary>
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
}
}

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