mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-10 14:44:17 +00:00
wip
This commit is contained in:
parent
38e1d4f0b2
commit
b963a95d85
4 changed files with 48 additions and 7 deletions
|
@ -19,6 +19,8 @@ sampler2D _NoiseTex;
|
|||
fixed _Fade;
|
||||
#endif
|
||||
|
||||
half _NightMultiplier = 0.5;
|
||||
|
||||
struct Input
|
||||
{
|
||||
float2 uv_MainTex;
|
||||
|
@ -29,7 +31,17 @@ struct Input
|
|||
};
|
||||
|
||||
void vert (inout appdata_full v) {
|
||||
float4 c;
|
||||
c.rg = v.texcoord1.xy;
|
||||
c.ba = v.texcoord2.xy;
|
||||
|
||||
c.a = _NightMultiplier;
|
||||
|
||||
/*v.color = v.color * (1 - _NightMultiplier) + c * _NightMultiplier;*/
|
||||
|
||||
v.color = lerp(v.color, c, _NightMultiplier);
|
||||
|
||||
/*v.color = v.color * (c * _NightMultiplier);*/
|
||||
}
|
||||
|
||||
void surf(Input IN, inout SurfaceOutputStandard o)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using SanAndreasUnity.Utilities;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SanAndreasUnity.Behaviours.World
|
||||
|
@ -21,6 +23,10 @@ namespace SanAndreasUnity.Behaviours.World
|
|||
|
||||
private Light light;
|
||||
|
||||
public float maxTime = 1f;
|
||||
|
||||
public float timeSpeed = 0.2f;
|
||||
|
||||
public static float TimeFactor
|
||||
{
|
||||
get
|
||||
|
@ -53,11 +59,28 @@ namespace SanAndreasUnity.Behaviours.World
|
|||
// Use this for initialization
|
||||
private void Start()
|
||||
{
|
||||
SetTime(startTimeState);
|
||||
//SetTime(startTimeState);
|
||||
|
||||
StartCoroutine(ChangeTimeCoroutine());
|
||||
}
|
||||
|
||||
private IEnumerator ChangeTimeCoroutine()
|
||||
{
|
||||
float time = 0f;
|
||||
while (true)
|
||||
{
|
||||
yield return null;
|
||||
|
||||
time += timeSpeed * Time.deltaTime;
|
||||
if (time > maxTime)
|
||||
time = 0;
|
||||
|
||||
Shader.SetGlobalFloat("_NightMultiplier", time);
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
private void FixedUpdate()
|
||||
private void FixedUpdate_Renamed()
|
||||
{
|
||||
//360 = 24 minutos
|
||||
//x = Time.deltaTime
|
||||
|
|
|
@ -300,9 +300,11 @@ namespace SanAndreasUnity.Importing.Conversion
|
|||
{
|
||||
mesh.colors32 = src.Colours;
|
||||
}
|
||||
else if (hasNightColors)
|
||||
|
||||
if (hasNightColors)
|
||||
{
|
||||
mesh.colors = src.ExtraVertColor.Colors;
|
||||
mesh.uv2 = src.ExtraVertColor.Colors;
|
||||
mesh.uv3 = src.ExtraVertColor.Colors2;
|
||||
}
|
||||
|
||||
if (src.Colours != null && hasNightColors)
|
||||
|
|
|
@ -6,7 +6,8 @@ namespace SanAndreasUnity.Importing.RenderWareStream
|
|||
[SectionType(0x0253F2F9)]
|
||||
public class ExtraVertColor : SectionData
|
||||
{
|
||||
public readonly UnityEngine.Color[] Colors;
|
||||
public readonly UnityEngine.Vector2[] Colors;
|
||||
public readonly UnityEngine.Vector2[] Colors2;
|
||||
|
||||
public ExtraVertColor(SectionHeader header, Stream stream)
|
||||
: base(header, stream)
|
||||
|
@ -20,11 +21,14 @@ namespace SanAndreasUnity.Importing.RenderWareStream
|
|||
|
||||
var geometry = header.GetParent<Geometry>();
|
||||
|
||||
Colors = new UnityEngine.Color[geometry.VertexCount];
|
||||
Colors = new UnityEngine.Vector2[geometry.VertexCount];
|
||||
Colors2 = new UnityEngine.Vector2[geometry.VertexCount];
|
||||
|
||||
for (int i = 0; i < geometry.VertexCount; i++)
|
||||
{
|
||||
Colors[i] = Types.Convert(new Color4(reader));
|
||||
var color = Types.Convert(new Color4(reader));
|
||||
Colors[i] = new UnityEngine.Vector2(color.r, color.g);
|
||||
Colors2[i] = new UnityEngine.Vector2(color.b, color.a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue