blob: 698e3701516333ada1b611a726d4f1fefdf5f229 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// Amplify Shader Editor - Visual Shader Editing Tool
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
using System;
namespace AmplifyShaderEditor
{
[Serializable]
[NodeAttributes( "Fmod", "Math Operators", "Floating point remainder of x/y with the same sign as x" )]
public sealed class FmodOpNode : DynamicTypeNode
{
protected override void CommonInit( int uniqueId )
{
base.CommonInit( uniqueId );
m_previewShaderGUID = "65083930f9d7812479fd6ff203ad2992";
}
public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
{
if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) )
return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory );
base.BuildResults( outputId, ref dataCollector, ignoreLocalvar );
if( m_inputPorts[ 0 ].DataType == WirePortDataType.INT )
m_inputA = "(float)" + m_inputA;
if( m_inputPorts[ 1 ].DataType == WirePortDataType.INT )
m_inputB = "(float)" + m_inputB;
string result = "fmod( " + m_inputA + " , " + m_inputB + " )";
return CreateOutputLocalVariable( 0, result, ref dataCollector );
}
}
}
|