Tim Cooper
7 年前
当前提交
ae8e0962
共有 14 个文件被更改,包括 555 次插入 和 43 次删除
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/AbstractMaterialGraph.cs
-
17MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Util/ShaderGenerator.cs
-
4MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/PreviewManager.cs
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/LightWeightShaderPaths.cs
-
15MaterialGraphProject/Assets/ShaderConfig.cs.hlsl
-
9MaterialGraphProject/Assets/ShaderConfig.cs.hlsl.meta
-
266MaterialGraphProject/Assets/ShaderVariables.hlsl
-
9MaterialGraphProject/Assets/ShaderVariables.hlsl.meta
-
192MaterialGraphProject/Assets/ShaderVariablesFunctions.hlsl
-
10MaterialGraphProject/Assets/ShaderVariablesFunctions.hlsl.meta
-
21MaterialGraphProject/Assets/ShaderVariablesMatrixDefsLegacyUnity.hlsl
-
10MaterialGraphProject/Assets/ShaderVariablesMatrixDefsLegacyUnity.hlsl.meta
-
12MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/MaterialGraphAsset.cs.meta
-
19MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/MaterialGraphAsset.cs
|
|||
// |
|||
// This file was automatically generated. Please don't edit by hand. |
|||
// |
|||
|
|||
#ifndef SHADERCONFIG_CS_HLSL |
|||
#define SHADERCONFIG_CS_HLSL |
|||
// |
|||
// UnityEngine.Experimental.Rendering.HDPipeline.ShaderOptions: static fields |
|||
// |
|||
#define SHADEROPTIONS_VELOCITY_IN_GBUFFER (0) |
|||
#define SHADEROPTIONS_PACK_GBUFFER_IN_U16 (0) |
|||
#define SHADEROPTIONS_CAMERA_RELATIVE_RENDERING (1) |
|||
|
|||
|
|||
#endif |
|
|||
fileFormatVersion: 2 |
|||
guid: 2c6472a689b6ae34e806881d3066cfb3 |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: [] |
|||
nonModifiableTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
// UNITY_SHADER_NO_UPGRADE |
|||
|
|||
#ifndef UNITY_SHADER_VARIABLES_INCLUDED |
|||
#define UNITY_SHADER_VARIABLES_INCLUDED |
|||
|
|||
#include "ShaderConfig.cs.hlsl" |
|||
|
|||
// CAUTION: |
|||
// Currently the shaders compiler always include regualr Unity shaderVariables, so I get a conflict here were UNITY_SHADER_VARIABLES_INCLUDED is already define, this need to be fixed. |
|||
// As I haven't change the variables name yet, I simply don't define anything, and I put the transform function at the end of the file outside the guard header. |
|||
// This need to be fixed. |
|||
|
|||
#if defined (DIRECTIONAL_COOKIE) || defined (DIRECTIONAL) |
|||
#define USING_DIRECTIONAL_LIGHT |
|||
#endif |
|||
|
|||
#if defined(UNITY_SINGLE_PASS_STEREO) || defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED) |
|||
#define USING_STEREO_MATRICES |
|||
#endif |
|||
|
|||
#if defined(USING_STEREO_MATRICES) |
|||
#define glstate_matrix_projection unity_StereoMatrixP[unity_StereoEyeIndex] |
|||
#define unity_MatrixV unity_StereoMatrixV[unity_StereoEyeIndex] |
|||
#define unity_MatrixInvV unity_StereoMatrixInvV[unity_StereoEyeIndex] |
|||
#define unity_MatrixVP unity_StereoMatrixVP[unity_StereoEyeIndex] |
|||
|
|||
#define unity_CameraProjection unity_StereoCameraProjection[unity_StereoEyeIndex] |
|||
#define unity_CameraInvProjection unity_StereoCameraInvProjection[unity_StereoEyeIndex] |
|||
#define unity_WorldToCamera unity_StereoWorldToCamera[unity_StereoEyeIndex] |
|||
#define unity_CameraToWorld unity_StereoCameraToWorld[unity_StereoEyeIndex] |
|||
#define _WorldSpaceCameraPos unity_StereoWorldSpaceCameraPos[unity_StereoEyeIndex] |
|||
#endif |
|||
|
|||
#define UNITY_LIGHTMODEL_AMBIENT (glstate_lightmodel_ambient * 2) |
|||
|
|||
// ---------------------------------------------------------------------------- |
|||
|
|||
CBUFFER_START(UnityPerCamera) |
|||
// Time (t = time since current level load) values from Unity |
|||
float4 _Time; // (t/20, t, t*2, t*3) |
|||
float4 _SinTime; // sin(t/8), sin(t/4), sin(t/2), sin(t) |
|||
float4 _CosTime; // cos(t/8), cos(t/4), cos(t/2), cos(t) |
|||
float4 unity_DeltaTime; // dt, 1/dt, smoothdt, 1/smoothdt |
|||
|
|||
#if !defined(USING_STEREO_MATRICES) |
|||
float3 _WorldSpaceCameraPos; |
|||
#endif |
|||
|
|||
// x = 1 or -1 (-1 if projection is flipped) |
|||
// y = near plane |
|||
// z = far plane |
|||
// w = 1/far plane |
|||
float4 _ProjectionParams; |
|||
|
|||
// x = width |
|||
// y = height |
|||
// z = 1 + 1.0/width |
|||
// w = 1 + 1.0/height |
|||
float4 _ScreenParams; |
|||
|
|||
// Values used to linearize the Z buffer (http://www.humus.name/temp/Linearize%20depth.txt) |
|||
// x = 1-far/near |
|||
// y = far/near |
|||
// z = x/far |
|||
// w = y/far |
|||
// or in case of a reversed depth buffer (UNITY_REVERSED_Z is 1) |
|||
// x = -1+far/near |
|||
// y = 1 |
|||
// z = x/far |
|||
// w = 1/far |
|||
float4 _ZBufferParams; |
|||
|
|||
// x = orthographic camera's width |
|||
// y = orthographic camera's height |
|||
// z = unused |
|||
// w = 1.0 if camera is ortho, 0.0 if perspective |
|||
float4 unity_OrthoParams; |
|||
CBUFFER_END |
|||
|
|||
|
|||
CBUFFER_START(UnityPerCameraRare) |
|||
float4 unity_CameraWorldClipPlanes[6]; |
|||
|
|||
#if !defined(USING_STEREO_MATRICES) |
|||
// Projection matrices of the camera. Note that this might be different from projection matrix |
|||
// that is set right now, e.g. while rendering shadows the matrices below are still the projection |
|||
// of original camera. |
|||
float4x4 unity_CameraProjection; |
|||
float4x4 unity_CameraInvProjection; |
|||
float4x4 unity_WorldToCamera; |
|||
float4x4 unity_CameraToWorld; |
|||
#endif |
|||
CBUFFER_END |
|||
|
|||
// ---------------------------------------------------------------------------- |
|||
|
|||
CBUFFER_START(UnityPerDraw : register(b0)) |
|||
#ifdef UNITY_USE_PREMULTIPLIED_MATRICES |
|||
float4x4 glstate_matrix_mvp; |
|||
float4x4 glstate_matrix_modelview0; |
|||
float4x4 glstate_matrix_invtrans_modelview0; |
|||
#endif |
|||
|
|||
float4x4 unity_ObjectToWorld; |
|||
float4x4 unity_WorldToObject; |
|||
float4 unity_LODFade; // x is the fade value ranging within [0,1]. y is x quantized into 16 levels |
|||
float4 unity_WorldTransformParams; // w is usually 1.0, or -1.0 for odd-negative scale transforms |
|||
|
|||
float4 unity_LightmapST; |
|||
float4 unity_DynamicLightmapST; |
|||
|
|||
// SH lighting environment |
|||
float4 unity_SHAr; |
|||
float4 unity_SHAg; |
|||
float4 unity_SHAb; |
|||
float4 unity_SHBr; |
|||
float4 unity_SHBg; |
|||
float4 unity_SHBb; |
|||
float4 unity_SHC; |
|||
|
|||
// x = Disabled(0)/Enabled(1) |
|||
// y = Computation are done in global space(0) or local space(1) |
|||
// z = Texel size on U texture coordinate |
|||
float4 unity_ProbeVolumeParams; |
|||
float4x4 unity_ProbeVolumeWorldToObject; |
|||
float3 unity_ProbeVolumeSizeInv; |
|||
float3 unity_ProbeVolumeMin; |
|||
|
|||
// This contain occlusion factor from 0 to 1 for dynamic objects (no SH here) |
|||
float4 unity_ProbesOcclusion; |
|||
|
|||
CBUFFER_END |
|||
|
|||
#if defined(USING_STEREO_MATRICES) |
|||
CBUFFER_START(UnityStereoGlobals) |
|||
float4x4 unity_StereoMatrixP[2]; |
|||
float4x4 unity_StereoMatrixV[2]; |
|||
float4x4 unity_StereoMatrixInvV[2]; |
|||
float4x4 unity_StereoMatrixVP[2]; |
|||
|
|||
float4x4 unity_StereoCameraProjection[2]; |
|||
float4x4 unity_StereoCameraInvProjection[2]; |
|||
float4x4 unity_StereoWorldToCamera[2]; |
|||
float4x4 unity_StereoCameraToWorld[2]; |
|||
|
|||
float3 unity_StereoWorldSpaceCameraPos[2]; |
|||
float4 unity_StereoScaleOffset[2]; |
|||
CBUFFER_END |
|||
#endif |
|||
|
|||
#if defined(USING_STEREO_MATRICES) && defined(UNITY_STEREO_MULTIVIEW_ENABLED) |
|||
CBUFFER_START(UnityStereoEyeIndices) |
|||
float4 unity_StereoEyeIndices[2]; |
|||
CBUFFER_END |
|||
#endif |
|||
|
|||
#if defined(UNITY_STEREO_MULTIVIEW_ENABLED) && defined(SHADER_STAGE_VERTEX) |
|||
#define unity_StereoEyeIndex UNITY_VIEWID |
|||
UNITY_DECLARE_MULTIVIEW(2); |
|||
#elif defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED) |
|||
static uint unity_StereoEyeIndex; |
|||
#elif defined(UNITY_SINGLE_PASS_STEREO) |
|||
CBUFFER_START(UnityStereoEyeIndex) |
|||
int unity_StereoEyeIndex; |
|||
CBUFFER_END |
|||
#endif |
|||
|
|||
CBUFFER_START(UnityPerDrawRare) |
|||
float4x4 glstate_matrix_transpose_modelview0; |
|||
CBUFFER_END |
|||
|
|||
// ---------------------------------------------------------------------------- |
|||
|
|||
CBUFFER_START(UnityPerFrame) |
|||
float4 glstate_lightmodel_ambient; |
|||
float4 unity_AmbientSky; |
|||
float4 unity_AmbientEquator; |
|||
float4 unity_AmbientGround; |
|||
float4 unity_IndirectSpecColor; |
|||
|
|||
#if !defined(USING_STEREO_MATRICES) |
|||
float4x4 glstate_matrix_projection; |
|||
float4x4 unity_MatrixV; |
|||
float4x4 unity_MatrixInvV; |
|||
float4x4 unity_MatrixVP; |
|||
float4 unity_StereoScaleOffset; |
|||
int unity_StereoEyeIndex; |
|||
#endif |
|||
|
|||
float4 unity_ShadowColor; |
|||
CBUFFER_END |
|||
|
|||
// ---------------------------------------------------------------------------- |
|||
|
|||
TEXTURE2D_FLOAT(_MainDepthTexture); |
|||
SAMPLER2D(sampler_MainDepthTexture); |
|||
|
|||
// Main lightmap |
|||
TEXTURE2D(unity_Lightmap); |
|||
SAMPLER2D(samplerunity_Lightmap); |
|||
// Dual or directional lightmap (always used with unity_Lightmap, so can share sampler) |
|||
TEXTURE2D(unity_LightmapInd); |
|||
|
|||
// Dynamic GI lightmap |
|||
TEXTURE2D(unity_DynamicLightmap); |
|||
SAMPLER2D(samplerunity_DynamicLightmap); |
|||
|
|||
TEXTURE2D(unity_DynamicDirectionality); |
|||
|
|||
// We can have shadowMask only if we have lightmap, so no sampler |
|||
TEXTURE2D(unity_ShadowMask); |
|||
|
|||
// TODO: Change code here so probe volume use only one transform instead of all this parameters! |
|||
TEXTURE3D_FLOAT(unity_ProbeVolumeSH); |
|||
SAMPLER3D(samplerunity_ProbeVolumeSH); |
|||
|
|||
CBUFFER_START(UnityVelocityPass) |
|||
float4x4 unity_MatrixNonJitteredVP; |
|||
float4x4 unity_MatrixPreviousVP; |
|||
float4x4 unity_MatrixPreviousM; |
|||
float4 unity_MotionVectorsParams; |
|||
CBUFFER_END |
|||
|
|||
// ---------------------------------------------------------------------------- |
|||
|
|||
// TODO: all affine matrices should be 3x4. |
|||
// TODO: sort these vars by the frequency of use (descending), and put commonly used vars together. |
|||
// Note: please use UNITY_MATRIX_X macros instead of referencing matrix variables directly. |
|||
CBUFFER_START(UnityPerPass) |
|||
float4x4 _PrevViewProjMatrix; |
|||
float4x4 _ViewProjMatrix; |
|||
float4x4 _NonJitteredViewProjMatrix; |
|||
float4x4 _ViewMatrix; |
|||
float4x4 _ProjMatrix; |
|||
float4x4 _InvViewProjMatrix; |
|||
float4x4 _InvViewMatrix; |
|||
float4x4 _InvProjMatrix; |
|||
float4 _InvProjParam; |
|||
float4 _ScreenSize; // {w, h, 1/w, 1/h} |
|||
float4 _FrustumPlanes[6]; // {(a, b, c) = N, d = -dot(N, P)} [L, R, T, B, N, F] |
|||
CBUFFER_END |
|||
|
|||
float4x4 OptimizeProjectionMatrix(float4x4 M) |
|||
{ |
|||
// Matrix format (x = non-constant value). |
|||
// Orthographic Perspective Combined(OR) |
|||
// | x 0 0 x | | x 0 x 0 | | x 0 x x | |
|||
// | 0 x 0 x | | 0 x x 0 | | 0 x x x | |
|||
// | x x x x | | x x x x | | x x x x | <- oblique projection row |
|||
// | 0 0 0 1 | | 0 0 x 0 | | 0 0 x x | |
|||
// Notice that some values are always 0. |
|||
// We can avoid loading and doing math with constants. |
|||
M._21_41 = 0; |
|||
M._12_42 = 0; |
|||
return M; |
|||
} |
|||
|
|||
#ifdef USE_LEGACY_UNITY_MATRIX_VARIABLES |
|||
#include "ShaderVariablesMatrixDefsLegacyUnity.hlsl" |
|||
#else |
|||
#include "ShaderVariablesMatrixDefsHDCamera.hlsl" |
|||
#endif |
|||
|
|||
#include "ShaderVariablesFunctions.hlsl" |
|||
|
|||
#endif // UNITY_SHADER_VARIABLES_INCLUDED |
|
|||
fileFormatVersion: 2 |
|||
guid: 2bc64066748469e48861ed835a8b806d |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: [] |
|||
nonModifiableTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#ifndef UNITY_SHADER_VARIABLES_FUNCTIONS_INCLUDED |
|||
#define UNITY_SHADER_VARIABLES_FUNCTIONS_INCLUDED |
|||
|
|||
float4x4 GetWorldToViewMatrix() |
|||
{ |
|||
return UNITY_MATRIX_V; |
|||
} |
|||
|
|||
float4x4 GetObjectToWorldMatrix() |
|||
{ |
|||
return UNITY_MATRIX_M; |
|||
} |
|||
|
|||
float4x4 GetWorldToObjectMatrix() |
|||
{ |
|||
return UNITY_MATRIX_I_M; |
|||
} |
|||
|
|||
// Transform to homogenous clip space |
|||
float4x4 GetWorldToHClipMatrix() |
|||
{ |
|||
return UNITY_MATRIX_VP; |
|||
} |
|||
|
|||
float GetOddNegativeScale() |
|||
{ |
|||
return unity_WorldTransformParams.w; |
|||
} |
|||
|
|||
float3 TransformWorldToView(float3 positionWS) |
|||
{ |
|||
return mul(GetWorldToViewMatrix(), float4(positionWS, 1.0)).xyz; |
|||
} |
|||
|
|||
float3 TransformObjectToWorld(float3 positionOS) |
|||
{ |
|||
return mul(GetObjectToWorldMatrix(), float4(positionOS, 1.0)).xyz; |
|||
} |
|||
|
|||
float3 TransformWorldToObject(float3 positionWS) |
|||
{ |
|||
return mul(GetWorldToObjectMatrix(), float4(positionWS, 1.0)).xyz; |
|||
} |
|||
|
|||
float3 TransformObjectToWorldDir(float3 dirOS) |
|||
{ |
|||
// Normalize to support uniform scaling |
|||
return normalize(mul((float3x3)GetObjectToWorldMatrix(), dirOS)); |
|||
} |
|||
|
|||
float3 TransformWorldToObjectDir(float3 dirWS) |
|||
{ |
|||
// Normalize to support uniform scaling |
|||
return normalize(mul((float3x3)GetWorldToObjectMatrix(), dirWS)); |
|||
} |
|||
|
|||
// Transforms normal from object to world space |
|||
float3 TransformObjectToWorldNormal(float3 normalOS) |
|||
{ |
|||
#ifdef UNITY_ASSUME_UNIFORM_SCALING |
|||
return UnityObjectToWorldDir(normalOS); |
|||
#else |
|||
// Normal need to be multiply by inverse transpose |
|||
// mul(IT_M, norm) => mul(norm, I_M) => {dot(norm, I_M.col0), dot(norm, I_M.col1), dot(norm, I_M.col2)} |
|||
return normalize(mul(normalOS, (float3x3)GetWorldToObjectMatrix())); |
|||
#endif |
|||
} |
|||
|
|||
// Tranforms position from world space to homogenous space |
|||
float4 TransformWorldToHClip(float3 positionWS) |
|||
{ |
|||
return mul(GetWorldToHClipMatrix(), float4(positionWS, 1.0)); |
|||
} |
|||
|
|||
float3 GetAbsolutePositionWS(float3 positionWS) |
|||
{ |
|||
#if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0) |
|||
positionWS += _WorldSpaceCameraPos; |
|||
#endif |
|||
return positionWS; |
|||
} |
|||
|
|||
float3 GetCameraRelativePositionWS(float3 positionWS) |
|||
{ |
|||
#if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0) |
|||
positionWS -= _WorldSpaceCameraPos; |
|||
#endif |
|||
return positionWS; |
|||
} |
|||
|
|||
// Note: '_WorldSpaceCameraPos' is set by the legacy Unity code. |
|||
float3 GetPrimaryCameraPosition() |
|||
{ |
|||
#if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0) |
|||
return float3(0, 0, 0); |
|||
#else |
|||
return _WorldSpaceCameraPos; |
|||
#endif |
|||
} |
|||
|
|||
// Could be e.g. the position of a primary camera or a shadow-casting light. |
|||
float3 GetCurrentViewPosition() |
|||
{ |
|||
#if defined(SHADERPASS) && (SHADERPASS != SHADERPASS_SHADOWS) |
|||
return GetPrimaryCameraPosition(); |
|||
#else |
|||
// This is a generic solution. |
|||
// However, for the primary camera, using '_WorldSpaceCameraPos' is better for cache locality, |
|||
// and in case we enable camera-relative rendering, we can statically set the position is 0. |
|||
return UNITY_MATRIX_I_V._14_24_34; |
|||
#endif |
|||
} |
|||
|
|||
// Returns the forward (central) direction of the current view in the world space. |
|||
float3 GetViewForwardDir() |
|||
{ |
|||
float4x4 viewMat = GetWorldToViewMatrix(); |
|||
return -viewMat[2].xyz; |
|||
} |
|||
|
|||
// Returns 'true' if the current view performs a perspective projection. |
|||
bool IsPerspectiveProjection() |
|||
{ |
|||
#if defined(SHADERPASS) && (SHADERPASS != SHADERPASS_SHADOWS) |
|||
return (unity_OrthoParams.w == 0); |
|||
#else |
|||
// TODO: set 'unity_OrthoParams' during the shadow pass. |
|||
return UNITY_MATRIX_P[3][3] == 0; |
|||
#endif |
|||
} |
|||
|
|||
// Computes the world space view direction (pointing towards the viewer). |
|||
float3 GetWorldSpaceNormalizeViewDir(float3 positionWS) |
|||
{ |
|||
if (IsPerspectiveProjection()) |
|||
{ |
|||
// Perspective |
|||
float3 V = GetCurrentViewPosition() - positionWS; |
|||
return normalize(V); |
|||
} |
|||
else |
|||
{ |
|||
// Orthographic |
|||
return -GetViewForwardDir(); |
|||
} |
|||
} |
|||
|
|||
float3x3 CreateWorldToTangent(float3 normal, float3 tangent, float flipSign) |
|||
{ |
|||
// For odd-negative scale transforms we need to flip the sign |
|||
float sgn = flipSign * GetOddNegativeScale(); |
|||
float3 bitangent = cross(normal, tangent) * sgn; |
|||
|
|||
return float3x3(tangent, bitangent, normal); |
|||
} |
|||
|
|||
float3 TransformTangentToWorld(float3 dirTS, float3x3 worldToTangent) |
|||
{ |
|||
// Use transpose transformation to go from tangent to world as the matrix is orthogonal |
|||
return mul(dirTS, worldToTangent); |
|||
} |
|||
|
|||
float3 TransformWorldToTangent(float3 dirWS, float3x3 worldToTangent) |
|||
{ |
|||
return mul(worldToTangent, dirWS); |
|||
} |
|||
|
|||
float3 TransformTangentToObject(float3 dirTS, float3x3 worldToTangent) |
|||
{ |
|||
// Use transpose transformation to go from tangent to world as the matrix is orthogonal |
|||
float3 normalWS = mul(dirTS, worldToTangent); |
|||
return mul((float3x3)GetWorldToObjectMatrix(), normalWS); |
|||
} |
|||
|
|||
float3 TransformObjectToTangent(float3 dirOS, float3x3 worldToTangent) |
|||
{ |
|||
return mul(worldToTangent, TransformObjectToWorldDir(dirOS)); |
|||
} |
|||
|
|||
// UNITY_MATRIX_V defines a right-handed view space with the Z axis pointing towards the viewer. |
|||
// This function reverses the direction of the Z axis (so that it points forward), |
|||
// making the view space coordinate system left-handed. |
|||
void GetLeftHandedViewSpaceMatrices(out float4x4 viewMatrix, out float4x4 projMatrix) |
|||
{ |
|||
viewMatrix = UNITY_MATRIX_V; |
|||
viewMatrix._31_32_33_34 = -viewMatrix._31_32_33_34; |
|||
|
|||
projMatrix = UNITY_MATRIX_P; |
|||
projMatrix._13_23_33_43 = -projMatrix._13_23_33_43; |
|||
} |
|||
|
|||
#endif // UNITY_SHADER_VARIABLES_FUNCTIONS_INCLUDED |
|
|||
fileFormatVersion: 2 |
|||
guid: 919263f29f66aed49a283fe1f971c094 |
|||
timeCreated: 1498227267 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
#ifdef UNITY_SHADER_VARIABLES_MATRIX_DEFS_HDCAMERA_INCLUDED |
|||
#error Mixing HDCamera and legacy Unity matrix definitions |
|||
#endif |
|||
|
|||
#ifndef UNITY_SHADER_VARIABLES_MATRIX_DEFS_LEGACY_UNITY_INCLUDED |
|||
#define UNITY_SHADER_VARIABLES_MATRIX_DEFS_LEGACY_UNITY_INCLUDED |
|||
|
|||
#define UNITY_MATRIX_M unity_ObjectToWorld |
|||
#define UNITY_MATRIX_I_M unity_WorldToObject |
|||
#define UNITY_MATRIX_V unity_MatrixV |
|||
#define UNITY_MATRIX_I_V unity_MatrixInvV |
|||
#define UNITY_MATRIX_P OptimizeProjectionMatrix(glstate_matrix_projection) |
|||
#define UNITY_MATRIX_I_P ERROR_UNITY_MATRIX_I_P_IS_NOT_DEFINED |
|||
#define UNITY_MATRIX_VP unity_MatrixVP |
|||
#define UNITY_MATRIX_I_VP ERROR_UNITY_MATRIX_I_VP_IS_NOT_DEFINED |
|||
#define UNITY_MATRIX_MV mul(UNITY_MATRIX_V, UNITY_MATRIX_M) |
|||
#define UNITY_MATRIX_T_MV transpose(UNITY_MATRIX_MV) |
|||
#define UNITY_MATRIX_IT_MV transpose(mul(UNITY_MATRIX_I_M, UNITY_MATRIX_I_V)) |
|||
#define UNITY_MATRIX_MVP mul(UNITY_MATRIX_VP, UNITY_MATRIX_M) |
|||
|
|||
#endif // UNITY_SHADER_VARIABLES_MATRIX_DEFS_LEGACY_UNITY_INCLUDED |
|
|||
fileFormatVersion: 2 |
|||
guid: 77ec57a2ba7588b4b96bc4c87934003f |
|||
timeCreated: 1498228363 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
externalObjects: {} |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 562bd27a5e73fc64d80a1d9d936ffbd5 |
|||
timeCreated: 1464601236 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
#if UNITY_EDITOR
|
|||
using System.Reflection; |
|||
using UnityEditor; |
|||
#endif
|
|||
using UnityEditor.Graphing; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
public class MaterialGraphAsset |
|||
{ |
|||
public static bool ShaderHasError(Shader shader) |
|||
{ |
|||
var hasErrorsCall = typeof(ShaderUtil).GetMethod("GetShaderErrorCount", BindingFlags.Static | BindingFlags.NonPublic); |
|||
var result = hasErrorsCall.Invoke(null, new object[] { shader }); |
|||
return (int)result != 0; |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue