コード例 #1
0
	private void BuildMaterials()
	{
#if UNITY_EDITOR
		_InitialFalloff = Falloff;
#endif
		if (VignetteShader == null)
		{
			VignetteShader = Shader.Find("Oculus/OVRVignette");
		}
		if (VignetteShader == null)
		{
			Debug.LogError("Could not find Vignette Shader! Vignette will not be drawn!");
			return;
		}

		if (_OpaqueMaterial == null)
		{
			_OpaqueMaterial = new Material(VignetteShader)
			{
				name = "Opaque Vignette Material",
				hideFlags = HideFlags.HideAndDontSave,
				renderQueue = (int)RenderQueue.Background
			};
			_OpaqueMaterial.SetFloat("_BlendSrc", (float)BlendMode.One);
			_OpaqueMaterial.SetFloat("_BlendDst", (float)BlendMode.Zero);
			_OpaqueMaterial.SetFloat("_ZWrite", 1);
		}
		_OpaqueMeshRenderer.sharedMaterial = _OpaqueMaterial;

		if (_TransparentMaterial == null)
		{
			_TransparentMaterial = new Material(VignetteShader)
			{
				name = "Transparent Vignette Material",
				hideFlags = HideFlags.HideAndDontSave,
				renderQueue = (int)RenderQueue.Overlay
			};

			_TransparentMaterial.SetFloat("_BlendSrc", (float)BlendMode.SrcAlpha);
			_TransparentMaterial.SetFloat("_BlendDst", (float)BlendMode.OneMinusSrcAlpha);
			_TransparentMaterial.SetFloat("_ZWrite", 0);
		}

		if (Falloff == FalloffType.Quadratic)
		{
			_TransparentMaterial.EnableKeyword(QUADRATIC_FALLOFF);
		}
		else
		{
			_TransparentMaterial.DisableKeyword(QUADRATIC_FALLOFF);
		}
		_TransparentMeshRenderer.sharedMaterial = _TransparentMaterial;
	}
コード例 #2
0
 public void Init(ref DiscLight light)
 {
     instanceID     = light.instanceID;
     color          = light.color;
     indirectColor  = light.indirectColor;
     orientation    = light.orientation;
     position       = light.position;
     range          = light.range;
     coneAngle      = 0.0f;
     innerConeAngle = 0.0f;
     shape0         = light.radius;
     shape1         = 0.0f;
     type           = LightType.Disc;
     mode           = light.mode;
     shadow         = (byte)(light.shadow ? 1 : 0);
     falloff        = FalloffType.Undefined;
 }
コード例 #3
0
 public void Init(ref SpotLight light)
 {
     instanceID     = light.instanceID;
     color          = light.color;
     indirectColor  = light.indirectColor;
     orientation    = light.orientation;
     position       = light.position;
     range          = light.range;
     coneAngle      = light.coneAngle;
     innerConeAngle = light.innerConeAngle;
     shape0         = light.sphereRadius;
     shape1         = 0.0f;
     type           = LightType.Spot;
     mode           = light.mode;
     shadow         = (byte)(light.shadow ? 1 : 0);
     falloff        = light.falloff;
 }
コード例 #4
0
 public void Init(ref DirectionalLight light)
 {
     instanceID    = light.instanceID;
     color         = light.color;
     indirectColor = light.indirectColor;
     orientation.SetLookRotation(light.direction, Vector3.up);
     position       = Vector3.zero;
     range          = 0.0f;
     coneAngle      = 0.0f;
     innerConeAngle = 0.0f;
     shape0         = light.penumbraWidthRadian;
     shape1         = 0.0f;
     type           = LightType.Directional;
     mode           = light.mode;
     shadow         = (byte)(light.shadow ? 1 : 0);
     falloff        = FalloffType.Undefined;
 }
コード例 #5
0
 public void Init(ref SpotLightBoxShape light)
 {
     instanceID     = light.instanceID;
     color          = light.color;
     indirectColor  = light.indirectColor;
     orientation    = light.orientation;
     position       = light.position;
     range          = light.range;
     coneAngle      = 0.0f;
     innerConeAngle = 0.0f;
     shape0         = light.width;
     shape1         = light.height;
     type           = LightType.SpotBoxShape;
     mode           = light.mode;
     shadow         = (byte)(light.shadow ? 1 : 0);
     falloff        = FalloffType.Undefined;
 }
コード例 #6
0
 public void Init(ref RectangleLight light)
 {
     instanceID     = light.instanceID;
     color          = light.color;
     indirectColor  = light.indirectColor;
     orientation    = light.orientation;
     position       = light.position;
     range          = light.range;
     coneAngle      = 0.0f;
     innerConeAngle = 0.0f;
     shape0         = light.width;
     shape1         = light.height;
     type           = LightType.Rectangle;
     mode           = light.mode;
     shadow         = (byte)(light.shadow ? 1 : 0);
     falloff        = light.falloff;
 }
コード例 #7
0
 public void Init(ref SpotLight light, ref Cookie cookie)
 {
     this.instanceID     = light.instanceID;
     this.cookieID       = cookie.instanceID;
     this.cookieScale    = cookie.scale;
     this.color          = light.color;
     this.indirectColor  = light.indirectColor;
     this.orientation    = light.orientation;
     this.position       = light.position;
     this.range          = light.range;
     this.coneAngle      = light.coneAngle;
     this.innerConeAngle = light.innerConeAngle;
     this.shape0         = light.sphereRadius;
     this.shape1         = (float)light.angularFalloff;
     this.type           = LightType.Spot;
     this.mode           = light.mode;
     this.shadow         = (light.shadow ? 1 : 0);
     this.falloff        = light.falloff;
 }
コード例 #8
0
 public void Init(ref PointLight light, ref Cookie cookie)
 {
     this.instanceID     = light.instanceID;
     this.cookieID       = cookie.instanceID;
     this.cookieScale    = cookie.scale;
     this.color          = light.color;
     this.indirectColor  = light.indirectColor;
     this.orientation    = Quaternion.identity;
     this.position       = light.position;
     this.range          = light.range;
     this.coneAngle      = 0f;
     this.innerConeAngle = 0f;
     this.shape0         = light.sphereRadius;
     this.shape1         = 0f;
     this.type           = LightType.Point;
     this.mode           = light.mode;
     this.shadow         = (light.shadow ? 1 : 0);
     this.falloff        = light.falloff;
 }
コード例 #9
0
 public void Init(ref DirectionalLight light, ref Cookie cookie)
 {
     this.instanceID     = light.instanceID;
     this.cookieID       = cookie.instanceID;
     this.cookieScale    = cookie.scale;
     this.color          = light.color;
     this.indirectColor  = light.indirectColor;
     this.orientation    = light.orientation;
     this.position       = light.position;
     this.range          = 0f;
     this.coneAngle      = cookie.sizes.x;
     this.innerConeAngle = cookie.sizes.y;
     this.shape0         = light.penumbraWidthRadian;
     this.shape1         = 0f;
     this.type           = LightType.Directional;
     this.mode           = light.mode;
     this.shadow         = (light.shadow ? 1 : 0);
     this.falloff        = FalloffType.Undefined;
 }
コード例 #10
0
 public void Init(ref SpotLightPyramidShape light, ref Cookie cookie)
 {
     this.instanceID     = light.instanceID;
     this.cookieID       = cookie.instanceID;
     this.cookieScale    = cookie.scale;
     this.color          = light.color;
     this.indirectColor  = light.indirectColor;
     this.orientation    = light.orientation;
     this.position       = light.position;
     this.range          = light.range;
     this.coneAngle      = light.angle;
     this.innerConeAngle = 0f;
     this.shape0         = light.aspectRatio;
     this.shape1         = 0f;
     this.type           = LightType.SpotPyramidShape;
     this.mode           = light.mode;
     this.shadow         = (light.shadow ? 1 : 0);
     this.falloff        = light.falloff;
 }
コード例 #11
0
 public void Init(ref SpotLightBoxShape light, ref Cookie cookie)
 {
     this.instanceID     = light.instanceID;
     this.cookieID       = cookie.instanceID;
     this.cookieScale    = cookie.scale;
     this.color          = light.color;
     this.indirectColor  = light.indirectColor;
     this.orientation    = light.orientation;
     this.position       = light.position;
     this.range          = light.range;
     this.coneAngle      = 0f;
     this.innerConeAngle = 0f;
     this.shape0         = light.width;
     this.shape1         = light.height;
     this.type           = LightType.SpotBoxShape;
     this.mode           = light.mode;
     this.shadow         = (light.shadow ? 1 : 0);
     this.falloff        = FalloffType.Undefined;
 }
コード例 #12
0
 public void Init(ref SpotLightPyramidShape light, ref Cookie cookie)
 {
     instanceID     = light.instanceID;
     cookieID       = cookie.instanceID;
     cookieScale    = cookie.scale;
     color          = light.color;
     indirectColor  = light.indirectColor;
     orientation    = light.orientation;
     position       = light.position;
     range          = light.range;
     coneAngle      = light.angle;
     innerConeAngle = 0.0f;
     shape0         = light.aspectRatio;
     shape1         = 0.0f;
     type           = LightType.SpotPyramidShape;
     mode           = light.mode;
     shadow         = (byte)(light.shadow ? 1 : 0);
     falloff        = light.falloff;
 }
コード例 #13
0
 public void Init(ref DiscLight light, ref Cookie cookie)
 {
     instanceID     = light.instanceID;
     cookieID       = cookie.instanceID;
     cookieScale    = cookie.scale;
     color          = light.color;
     indirectColor  = light.indirectColor;
     orientation    = light.orientation;
     position       = light.position;
     range          = light.range;
     coneAngle      = 0.0f;
     innerConeAngle = 0.0f;
     shape0         = light.radius;
     shape1         = 0.0f;
     type           = LightType.Disc;
     mode           = light.mode;
     shadow         = (byte)(light.shadow ? 1 : 0);
     falloff        = light.falloff;
 }
コード例 #14
0
 public void Init(ref DirectionalLight light, ref Cookie cookie)
 {
     instanceID     = light.instanceID;
     cookieID       = cookie.instanceID;
     cookieScale    = cookie.scale;
     color          = light.color;
     indirectColor  = light.indirectColor;
     orientation    = light.orientation;
     position       = light.position;
     range          = 0.0f;
     coneAngle      = cookie.sizes.x;
     innerConeAngle = cookie.sizes.y;
     shape0         = light.penumbraWidthRadian;
     shape1         = 0.0f;
     type           = LightType.Directional;
     mode           = light.mode;
     shadow         = (byte)(light.shadow ? 1 : 0);
     falloff        = FalloffType.Undefined;
 }
コード例 #15
0
 public Atractor(FalloffType type, Entity origin, float scale)
 {
     this.type   = type;
     this.origin = origin;
     this.scale  = scale;
 }
コード例 #16
0
ファイル: Atractor.cs プロジェクト: HuntiXz/phantom
 public Atractor(FalloffType type, Entity origin, float scale)
 {
     this.type = type;
     this.origin = origin;
     this.scale = scale;
 }