; Candace

; Overrides -------------------------

[TextureOverrideCandacePosition]
hash = 9cee8711
vb0 = ResourceCandacePosition

[TextureOverrideCandaceBlend]
hash = e5fd4e8a
vb1 = ResourceCandaceBlend
handling = skip
draw = 60972,0 

[TextureOverrideCandaceTexcoord]
hash = 729f8219
vb1 = ResourceCandaceTexcoord

[TextureOverrideCandaceVertexLimitRaise]
hash = 593cbad4

[TextureOverrideCandaceIB]
hash = 9098a3ef
handling = skip
drawindexed = auto

[TextureOverrideCandaceHead]
hash = 9098a3ef
match_first_index = 0
ib = ResourceCandaceHeadIB
ps-t0 = ResourceCandaceHeadNormalMap
ps-t1 = ResourceCandaceHeadDiffuse
ps-t2 = ResourceCandaceHeadLightMap
ps-t3 = ResourceCandaceHeadMetalMap
$CharacterIB = 1
ResourceRefHeadDiffuse = reference ps-t1
ResourceRefHeadLightMap = reference ps-t2

[TextureOverrideCandaceBody]
hash = 9098a3ef
match_first_index = 32682
ib = ResourceCandaceBodyIB
ps-t0 = ResourceCandaceBodyNormalMap
ps-t1 = ResourceCandaceBodyDiffuse
ps-t2 = ResourceCandaceBodyLightMap
ps-t3 = ResourceCandaceBodyMetalMap
$CharacterIB = 2
ResourceRefBodyDiffuse = reference ps-t1
ResourceRefBodyLightMap = reference ps-t2

[TextureOverrideCandaceDress]
hash = 9098a3ef
match_first_index = 58719
ib = ResourceCandaceDressIB
ps-t0 = ResourceCandaceDressNormalMap
ps-t1 = ResourceCandaceDressDiffuse
ps-t2 = ResourceCandaceDressLightMap
ps-t3 = ResourceCandaceDressMetalMap
$CharacterIB = 3
ResourceRefDressDiffuse = reference ps-t1
ResourceRefDressLightMap = reference ps-t2

[TextureOverrideCandaceFaceHeadNormalMap]
hash = 01eb6d46
ps-t0 = ResourceCandaceFaceHeadNormalMap


; Resources -------------------------

[ResourceCandacePosition]
type = Buffer
stride = 40
filename = CandacePosition.buf

[ResourceCandaceBlend]
type = Buffer
stride = 32
filename = CandaceBlend.buf

[ResourceCandaceTexcoord]
type = Buffer
stride = 20
filename = CandaceTexcoord.buf

[ResourceCandaceHeadIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = CandaceHead.ib

[ResourceCandaceBodyIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = CandaceBody.ib

[ResourceCandaceDressIB]
type = Buffer
format = DXGI_FORMAT_R32_UINT
filename = CandaceDress.ib

[ResourceCandaceHeadNormalMap]
filename = CandaceHeadNormalMap.dds

[ResourceCandaceHeadDiffuse]
filename = CandaceHeadDiffuse.dds

[ResourceCandaceHeadLightMap]
filename = CandaceHeadLightMap.dds

[ResourceCandaceHeadMetalMap]
filename = CandaceHeadMetalMap.dds

[ResourceCandaceBodyNormalMap]
filename = CandaceBodyNormalMap.dds

[ResourceCandaceBodyDiffuse]
filename = CandaceBodyDiffuse.dds

[ResourceCandaceBodyLightMap]
filename = CandaceBodyLightMap.dds

[ResourceCandaceBodyMetalMap]
filename = CandaceBodyMetalMap.dds

[ResourceCandaceDressNormalMap]
filename = CandaceDressNormalMap.dds

[ResourceCandaceDressDiffuse]
filename = CandaceDressDiffuse.dds

[ResourceCandaceDressLightMap]
filename = CandaceDressLightMap.dds

[ResourceCandaceDressMetalMap]
filename = CandaceDressMetalMap.dds

[ResourceCandaceFaceHeadNormalMap]
filename = CandaceFaceHeadNormalMap.dds


; .ini generated by GIMI (Genshin-Impact-Model-Importer)
; If you have any issues or find any bugs, please open a ticket at https://github.com/SilentNightSound/GI-Model-Importer/issues or contact SilentNightSound#7430 on discord

; Version 1.0.0 AGMG Tool Developer Version 3 Shader Fixer


; Generated shader fix for 3.0+ GIMI importer characters. Please contact the tool developers at https://discord.gg/agmg if you have any questions.
; Variables -----------------------
[Constants]
global $CharacterIB
;0=none, 1=head, 2=body, 3=dress, 4=extra, etc.
[Present]
post $CharacterIB = 0
[ResourceRefHeadDiffuse]
[ResourceRefHeadLightMap]
[ResourceRefBodyDiffuse]
[ResourceRefBodyLightMap]
[ResourceRefDressDiffuse]
[ResourceRefDressLightMap]
[ResourceRefExtraDiffuse]
[ResourceRefExtraLightMap]
; ShaderOverride ---------------------------
[ShaderRegexCharReflection]
shader_model = ps_5_0
run = CommandListReflectionTexture
[ShaderRegexCharReflection.pattern]
mul r\d+\.\w+, r\d+\.\w+,[^.]*\.\w+\n
mad o\d+\.\w+, r\d+\.\w+, cb\d+\[\d+\]\.\w+, r\d+\.\w+\n
mov o\d+\.\w+, l\(\d+\.\d+\)\n
[ShaderRegexCharOutline]
shader_model = ps_5_0
run = CommandListOutline
[ShaderRegexCharOutline.pattern]
mov o\d+\.\w+, l\(\d+\)\n
mov o\d+\.\w+, r\d+\.\w+\n
mov o\d+\.\w+, l\(\d+\.\d+\)
; OPTIONAL: shader hash for reflection. replace this incase regex does not work.
[ShaderOverrideReflectionTexture]
hash=26eb354bad491b6f
allow_duplicate_hash=overrule
run=CommandListReflectionTexture
[ShaderOverrideReflectionTextureDress]
hash=b04806463c319e15
allow_duplicate_hash=overrule
run=CommandListReflectionTexture
[ShaderOverrideReflectionTextureBlink]
hash=167cf8a1f4f9ed4f
allow_duplicate_hash=overrule
run=CommandListReflectionTexture
; OPTIONAL: shader hash for outline. replace this incase regex does not work.
[ShaderOverrideOutlineTexture]
hash=f6eb050ef75da1b7
allow_duplicate_hash=overrule
run=CommandListOutline
; CommandList -------------------------
[CommandListReflectionTexture]
if $CharacterIB != 0
    if $CharacterIB == 1
        ps-t0 = copy ResourceRefHeadDiffuse
    else if $CharacterIB == 2
        ps-t0 = copy ResourceRefBodyDiffuse
    else if $CharacterIB == 3
        ps-t0 = copy ResourceRefDressDiffuse
    else if $CharacterIB == 4
        ps-t0 = copy ResourceRefExtraDiffuse    
    endif
drawindexed=auto
$CharacterIB = 0
endif
[CommandListOutline]
if $CharacterIB != 0
    if $CharacterIB == 1
        ps-t1 = copy ResourceRefHeadLightMap
    else if $CharacterIB == 2
        ps-t1 = copy ResourceRefBodyLightMap
    else if $CharacterIB == 3
        ps-t1 = copy ResourceRefDressLightMap
    else if $CharacterIB == 4
        ps-t1 = copy ResourceRefExtraLightMap
    endif
drawindexed=auto
$CharacterIB = 0
endif
