Commit 52823614 authored by ATREVI Dieudonne's avatar ATREVI Dieudonne
Browse files

Merge remote-tracking branch 'origin/dev' into #24_real_menu

parents d7390b0d e2e8b54d
fileFormatVersion: 2
guid: 410254546779f4146913db5024de807c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -229,14 +229,14 @@ public class LoadEnv : MonoBehaviour
{
// -------------------
// LOAD AGENT IN UNITY
GameObject gameObject = Instantiate(Resources.Load<GameObject>(GetModelName_RocketBox(id)));
GameObject rb = Instantiate(Resources.Load<GameObject>(GetModelName_RocketBox(id)));
// -------------------
// SET BOUNDING BOXES ITEM
gameObject.AddComponent<GetMemberPositionRocketBox>();
rb.AddComponent<GetMemberPositionRocketBox>();
//gameObject.AddComponent<FollowTrajectory>();
GameObject headBoundingBox = Instantiate(Resources.Load<GameObject>("HeadBoundingBoxes/Hbb_RocketBox"));
Transform Head = gameObject.transform.Find("Bip01/Bip01 Pelvis/Bip01 Spine/Bip01 Spine1/Bip01 Spine2/Bip01 Neck/Bip01 Head");
Transform Head = rb.transform.Find("Bip01/Bip01 Pelvis/Bip01 Spine/Bip01 Spine1/Bip01 Spine2/Bip01 Neck/Bip01 Head");
headBoundingBox.transform.parent = Head;
// ---------------------------------------------
......@@ -247,12 +247,31 @@ public class LoadEnv : MonoBehaviour
var tmpMaterial = CreateMaterialWithColor(tmpColor.Value);
Material[] mats = new Material[] { tmpMaterial, tmpMaterial, tmpMaterial };
SkinnedMeshRenderer[] rendererList = gameObject.GetComponentsInChildren<SkinnedMeshRenderer>();
SkinnedMeshRenderer[] rendererList = rb.GetComponentsInChildren<SkinnedMeshRenderer>();
foreach (SkinnedMeshRenderer renderer in rendererList)
renderer.materials = mats;
}
// --------------------------------------
// ELSE ADD SOME VARIATION IN THE TEXTURE
else
{
TextureVariation[] tvList = rb.GetComponentsInChildren<TextureVariation>();
return gameObject;
int variation = 0;
if (tvList.Length>0)
{
variation = (int)(((int)(id / 2)) / 20);
variation = (variation % (tvList[0].getNumberOfVariationsMax()-1)) + 1;
}
foreach (TextureVariation tv in tvList)
{
tv.SetVariationId(variation);
}
}
return rb;
}
GameObject CreateAgent_PlasticMan(int id)
......
......@@ -99,7 +99,9 @@ public class CamRecorder : MonoBehaviour
}
imageIncrement++;
}
} else
Time.captureFramerate = 0;
}
}
fileFormatVersion: 2
guid: 2bb24139a86198b4a9ac013f37790283
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 71e4a6c39397f71419f039b0e6390c12
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
// Upgrade NOTE: upgraded instancing buffer 'Props' to new syntax.
Shader "Custom/HSVTextureVariation" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
_Glossiness ("Smoothness", Range(0,1)) = 0.0
_Metallic ("Metallic", Range(0,1)) = 0.0
_BumpScale("Scale", Float) = 1.0
_BumpMap("Normal Map", 2D) = "bump" {}
_EmissionColor("Color", Color) = (0,0,0)
_AlphaMask("Alpha Mask", 2D) = "white" {}
//_HSVoffset("HSV Offset", Color) = (0.5,0.5,0.5)
_HSVoffsetMap("HSV Offset", 2D) = "gray" {}
_DoVariation("Do Variation", Range(0.0, 1.0)) = 1.0
// Blending state
[HideInInspector] _Mode ("__mode", Float) = 0.0
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
sampler2D _BumpMap;
sampler2D _AlphaMask;
sampler2D _HSVoffsetMap;
struct Input {
float2 uv_MainTex;
};
half _Glossiness;
half _Metallic;
fixed4 _Color;
float _DoVariation;
// Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
// See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
// #pragma instancing_options assumeuniformscaling
UNITY_INSTANCING_BUFFER_START(Props)
// put more per-instance properties here
UNITY_INSTANCING_BUFFER_END(Props)
float3 rgb2hsv(float3 c)
{
float4 K = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
float4 p = c.g < c.b ? float4(c.bg, K.wz) : float4(c.gb, K.xy);
float4 q = c.r < p.x ? float4(p.xyw, c.r) : float4(c.r, p.yzx);
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
return float3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}
float3 hsv2rgb(float3 c)
{
float4 K = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
float3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * lerp(K.xxx, saturate(p - K.xxx), c.y);
}
void surf(Input IN, inout SurfaceOutputStandard o) {
// Albedo comes from a texture tinted by color
fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
if (_DoVariation > 0.0)
{
float channelVariationID = tex2D(_AlphaMask, IN.uv_MainTex).x;
float2 variationTexCoord = float2(channelVariationID, 0.0);
fixed3 _HSVoffset = tex2D(_HSVoffsetMap, variationTexCoord);
_HSVoffset = (_HSVoffset * 2.0 - 1.0);
_HSVoffset.x = _HSVoffset.x * 0.5;
fixed3 hsv = rgb2hsv(c.rgb) +_HSVoffset;
if (hsv.r > 1.0)
hsv.r -= 1.0;
if (hsv.r < 0)
hsv.r += 1.0;
hsv.g = clamp(hsv.g, 0.0, 1.0);
hsv.b = clamp(hsv.b, 0.0, 1.0);
c.rgb = hsv2rgb(hsv);
}
o.Albedo = c * _Color;
// Metallic and smoothness come from slider variables
o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_MainTex));
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
CustomEditor "HSVTextureVariationGUI"
}
fileFormatVersion: 2
guid: ec5d30d21a4c2044dad1c40d9d2cb52d
timeCreated: 1520433258
licenseType: Free
ShaderImporter:
externalObjects: {}
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
// Upgrade NOTE: upgraded instancing buffer 'Props' to new syntax.
Shader "Custom/HSVTextureVariationFade" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
_Glossiness ("Smoothness", Range(0,1)) = 0.0
_Metallic ("Metallic", Range(0,1)) = 0.0
_BumpScale("Scale", Float) = 1.0
_BumpMap("Normal Map", 2D) = "bump" {}
_EmissionColor("Color", Color) = (0,0,0)
_AlphaMask("Alpha Mask", 2D) = "white" {}
//_HSVoffset("HSV Offset", Color) = (0.5,0.5,0.5)
_HSVoffsetMap("HSV Offset", 2D) = "gray" {}
_DoVariation("Do Variation", Range(0.0, 1.0)) = 1.0
// Blending state
[HideInInspector] _Mode ("__mode", Float) = 0.0
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard alpha:fade fullforwardshadows
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
sampler2D _BumpMap;
sampler2D _AlphaMask;
sampler2D _HSVoffsetMap;
struct Input {
float2 uv_MainTex;
};
half _Glossiness;
half _Metallic;
fixed4 _Color;
float _DoVariation;
// Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
// See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
// #pragma instancing_options assumeuniformscaling
UNITY_INSTANCING_BUFFER_START(Props)
// put more per-instance properties here
UNITY_INSTANCING_BUFFER_END(Props)
float3 rgb2hsv(float3 c)
{
float4 K = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
float4 p = c.g < c.b ? float4(c.bg, K.wz) : float4(c.gb, K.xy);
float4 q = c.r < p.x ? float4(p.xyw, c.r) : float4(c.r, p.yzx);
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
return float3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}
float3 hsv2rgb(float3 c)
{
float4 K = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
float3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * lerp(K.xxx, saturate(p - K.xxx), c.y);
}
void surf(Input IN, inout SurfaceOutputStandard o) {
// Albedo comes from a texture tinted by color
fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
if (_DoVariation > 0.0)
{
//float channelVariationID = tex2D(_AlphaMask, IN.uv_MainTex).x;
float channelVariationID = 176.0 / 255.0; // Fix for Hair with opacity -> Single texture = no mask
float2 variationTexCoord = float2(channelVariationID, 0.0);
fixed3 _HSVoffset = tex2D(_HSVoffsetMap, variationTexCoord);
_HSVoffset = (_HSVoffset * 2.0 - 1.0);
_HSVoffset.x = _HSVoffset.x * 0.5;
fixed3 hsv = rgb2hsv(c.rgb) +_HSVoffset;
if (hsv.r > 1.0)
hsv.r -= 1.0;
if (hsv.r < 0)
hsv.r += 1.0;
hsv.g = clamp(hsv.g, 0.0, 1.0);
hsv.b = clamp(hsv.b, 0.0, 1.0);
c.rgb = hsv2rgb(hsv);
}
o.Albedo = c * _Color;
// Metallic and smoothness come from slider variables
o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_MainTex));
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
CustomEditor "HSVTextureVariationGUI"
}
fileFormatVersion: 2
guid: 7087c273dd283074db61e9e618646464
timeCreated: 1520433257
licenseType: Free
ShaderImporter:
externalObjects: {}
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 41ce65fba6f3ede418f7e887e7fcb95a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment