public override void ReadFromString(ref string[] nodeParams) { base.ReadFromString(ref nodeParams); string from = GetCurrentParam(ref nodeParams); if (UIUtils.CurrentShaderVersion() < 17500 && from.Equals("Clip")) { UIUtils.ShowMessage(UniqueId, "Clip Space no longer supported on From field over Transform Position node"); } else { m_from = (TransformSpaceFrom)Enum.Parse(typeof(TransformSpaceFrom), from); } m_to = (TransformSpaceTo)Enum.Parse(typeof(TransformSpaceTo), GetCurrentParam(ref nodeParams)); if (UIUtils.CurrentShaderVersion() > 15701) { m_perspectiveDivide = Convert.ToBoolean(GetCurrentParam(ref nodeParams)); } if (UIUtils.CurrentShaderVersion() > 15800) { m_inverseTangentType = (InverseTangentType)Enum.Parse(typeof(InverseTangentType), GetCurrentParam(ref nodeParams)); } if (UIUtils.CurrentShaderVersion() > 16103) { m_absoluteWorldPos = Convert.ToBoolean(GetCurrentParam(ref nodeParams)); } UpdateSubtitle(); }
public override void DrawProperties() { base.DrawProperties(); EditorGUI.BeginChangeCheck(); m_from = (TransformSpaceFrom)EditorGUILayoutPopup(FromStr, (int)m_from, m_spaceOptionsFrom); m_to = (TransformSpaceTo)EditorGUILayoutPopup(ToStr, (int)m_to, m_spaceOptionsTo); if (m_from == TransformSpaceFrom.Tangent) { m_inverseTangentType = (InverseTangentType)EditorGUILayoutEnumPopup(InverseTBNStr, m_inverseTangentType); } if (EditorGUI.EndChangeCheck()) { UpdateSubtitle(); } if (m_to == TransformSpaceTo.Clip) { m_perspectiveDivide = EditorGUILayoutToggle(PerpectiveDivideStr, m_perspectiveDivide); } //if( m_containerGraph.IsHDRP && ( m_from == TransformSpace.Object && m_to == TransformSpace.World ) || // ( m_from == TransformSpace.World && m_to == TransformSpace.Object ) ) //{ // m_absoluteWorldPos = EditorGUILayoutToggle( AbsoluteWorldPosStr, m_absoluteWorldPos ); //} }
public override void DrawProperties() { base.DrawProperties(); EditorGUI.BeginChangeCheck(); m_from = (TransformSpaceFrom)EditorGUILayoutPopup(FromStr, (int)m_from, m_spaceOptionsFrom); m_to = (TransformSpaceTo)EditorGUILayoutPopup(ToStr, (int)m_to, m_spaceOptionsTo); if (m_from == TransformSpaceFrom.Tangent) { m_inverseTangentType = (InverseTangentType)EditorGUILayoutEnumPopup(InverseTBNStr, m_inverseTangentType); } m_normalize = EditorGUILayoutToggle(NormalizeOptionStr, m_normalize); if (EditorGUI.EndChangeCheck()) { UpdateSubtitle(); } if (m_normalize) { EditorGUI.indentLevel++; m_safeNormalize = EditorGUILayoutToggle(SafeNormalizeOptionStr, m_safeNormalize); EditorGUILayout.HelpBox(Constants.SafeNormalizeInfoStr, MessageType.Info); EditorGUI.indentLevel--; } }
public override void DrawProperties() { base.DrawProperties(); EditorGUI.BeginChangeCheck(); m_from = (TransformSpaceFrom)EditorGUILayoutPopup(FromStr, (int)m_from, m_spaceOptionsFrom); m_to = (TransformSpaceTo)EditorGUILayoutPopup(ToStr, (int)m_to, m_spaceOptionsTo); if (m_from == TransformSpaceFrom.Tangent) { m_inverseTangentType = (InverseTangentType)EditorGUILayoutEnumPopup(InverseTBNStr, m_inverseTangentType); } m_normalize = EditorGUILayoutToggle(NormalizeOptionStr, m_normalize); if (EditorGUI.EndChangeCheck()) { UpdateSubtitle(); } }
void CalculateTransform(TransformSpaceFrom from, TransformSpaceTo to, ref MasterNodeDataCollector dataCollector, ref string varName, ref string result) { switch (from) { case TransformSpaceFrom.Object: { switch (to) { default: case TransformSpaceTo.Object: break; case TransformSpaceTo.World: { if (dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BuiltIn) { result = string.Format(AseSRPObjectToWorldDirFormat, result); } else { result = string.Format(AseObjectToWorldDirFormat, result); } varName = AseObjectToWorldDirVarName + OutputId; } break; case TransformSpaceTo.View: { if (dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD) { result = string.Format(AseHDObjectToViewDirFormat, result); } else { result = string.Format(AseObjectToViewDirFormat, result); } varName = AseObjectToViewDirVarName + OutputId; } break; case TransformSpaceTo.Clip: { if (dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BuiltIn) { result = string.Format(AseSRPObjectToClipDirFormat, result); } else { result = string.Format(AseObjectToClipDirFormat, result); } varName = AseObjectToClipDirVarName + OutputId; } break; } } break; case TransformSpaceFrom.World: { switch (to) { case TransformSpaceTo.Object: { if (dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BuiltIn) { result = string.Format(AseSRPWorldToObjectDirFormat, result); } else { result = string.Format(AseWorldToObjectDirFormat, result); } varName = AseWorldToObjectDirVarName + OutputId; } break; default: case TransformSpaceTo.World: break; case TransformSpaceTo.View: { result = string.Format(AseWorldToViewDirFormat, result); varName = AseWorldToViewDirVarName + OutputId; } break; case TransformSpaceTo.Clip: { if (dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BuiltIn) { result = string.Format(AseSRPWorldToClipDirFormat, result); } else { result = string.Format(AseWorldToClipDirFormat, result); } varName = AseWorldToClipDirVarName + OutputId; } break; } } break; case TransformSpaceFrom.View: { switch (to) { case TransformSpaceTo.Object: { result = string.Format(AseViewToObjectDirFormat, result); varName = AseViewToObjectDirVarName + OutputId; } break; case TransformSpaceTo.World: { result = string.Format(AseViewToWorldDirFormat, result); varName = AseViewToWorldDirVarName + OutputId; } break; default: case TransformSpaceTo.View: break; case TransformSpaceTo.Clip: { if (dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BuiltIn) { result = string.Format(AseSRPViewToClipDirFormat, result); } else { result = string.Format(AseViewToClipDirFormat, result); } varName = AseViewToClipDirVarName + OutputId; } break; } } break; //case TransformSpace.Clip: //{ // switch( to ) // { // case TransformSpace.Object: // { // if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD ) // { // result = string.Format( AseHDClipToObjectDirFormat, result ); // } // else // { // result = string.Format( AseClipToObjectDirFormat, result ); // } // varName = AseClipToObjectDirVarName + OutputId; // } // break; // case TransformSpace.World: // { // if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD ) // { // result = string.Format( AseHDClipToWorldDirFormat, result ); // } // else // { // result = string.Format( AseClipToWorldDirFormat, result ); // } // varName = AseClipToWorldDirVarName + OutputId; // } // break; // case TransformSpace.View: // { // if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD ) // { // result = string.Format( AseHDClipToViewDirFormat, result ); // } // else // { // result = string.Format( AseClipToViewDirFormat, result ); // } // varName = AseClipToViewDirVarName + OutputId; // } // break; // case TransformSpace.Clip: break; // default: // break; // } //} //break; default: break; } }
void CalculateTransform(TransformSpaceFrom from, TransformSpaceTo to, ref MasterNodeDataCollector dataCollector, ref string varName, ref string result) { switch (from) { case TransformSpaceFrom.Object: { switch (to) { default: case TransformSpaceTo.Object: break; case TransformSpaceTo.World: { if (dataCollector.IsTemplate && dataCollector.IsSRP) { if (dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD) { result = string.Format(AseHDObjectToWorldPosFormat, result); if (m_absoluteWorldPos) { result = string.Format(ASEHDAbsoluteWordPos, result); } } else if (dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.Lightweight) { result = string.Format(AseHDObjectToWorldPosFormat, result); } } else { result = string.Format(AseObjectToWorldPosFormat, result); } varName = AseObjectToWorldPosVarName + OutputId; } break; case TransformSpaceTo.View: { if (dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD) { result = string.Format(AseHDObjectToViewPosFormat, result); } else { result = string.Format(AseObjectToViewPosFormat, result); } varName = AseObjectToViewPosVarName + OutputId; } break; case TransformSpaceTo.Clip: { if (dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BuiltIn) { result = string.Format(AseSRPObjectToClipPosFormat, result); } else { result = string.Format(AseObjectToClipPosFormat, result); } varName = AseObjectToClipPosVarName + OutputId; } break; } } break; case TransformSpaceFrom.World: { switch (to) { case TransformSpaceTo.Object: { if (dataCollector.IsTemplate && dataCollector.IsSRP) { if (dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD) { if (m_absoluteWorldPos) { result = string.Format(ASEHDRelaviveCameraPos, result); } result = string.Format(AseSRPWorldToObjectPosFormat, result); } else if (dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.Lightweight) { result = string.Format(AseSRPWorldToObjectPosFormat, result); } } else { result = string.Format(AseWorldToObjectPosFormat, result); } varName = AseWorldToObjectPosVarName + OutputId; } break; default: case TransformSpaceTo.World: break; case TransformSpaceTo.View: { result = string.Format(AseWorldToViewPosFormat, result); varName = AseWorldToViewPosVarName + OutputId; } break; case TransformSpaceTo.Clip: { if (dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BuiltIn) { result = string.Format(AseSRPWorldToClipPosFormat, result); } else { result = string.Format(AseWorldToClipPosFormat, result); } varName = AseWorldToClipPosVarName + OutputId; } break; } } break; case TransformSpaceFrom.View: { switch (to) { case TransformSpaceTo.Object: { if (dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD) { result = string.Format(AseHDViewToObjectPosFormat, result); } else { result = string.Format(AseViewToObjectPosFormat, result); } varName = AseViewToObjectPosVarName + OutputId; } break; case TransformSpaceTo.World: { result = string.Format(AseViewToWorldPosFormat, result); if (dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD && m_absoluteWorldPos) { result = string.Format(ASEHDAbsoluteWordPos, result); } varName = AseViewToWorldPosVarName + OutputId; } break; default: case TransformSpaceTo.View: break; case TransformSpaceTo.Clip: { if (dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BuiltIn) { result = string.Format(AseSRPViewToClipPosFormat, result); } else { result = string.Format(AseViewToClipPosFormat, result); } varName = AseViewToClipPosVarName + OutputId; } break; } } break; //case TransformSpace.Clip: //{ // switch( to ) // { // case TransformSpace.Object: // { // if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD ) // { // result = string.Format( AseHDClipToObjectPosFormat, result ); // } // else // { // result = string.Format( AseClipToObjectPosFormat, result ); // } // varName = AseClipToObjectPosVarName + OutputId; // } // break; // case TransformSpace.World: // { // if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD ) // { // result = string.Format( AseHDClipToWorldPosFormat, result ); // } // else // { // result = string.Format( AseClipToWorldPosFormat, result ); // } // varName = AseClipToWorldPosVarName + OutputId; // } // break; // case TransformSpace.View: // { // if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD ) // { // result = string.Format( AseHDClipToViewPosFormat, result ); // } // else // { // result = string.Format( AseClipToViewPosFormat, result ); // } // varName = AseClipToViewPosVarName + OutputId; // } // break; // case TransformSpace.Clip: break; // default: // break; // } //} //break; default: break; } }