netpoet coop and 64kode
This commit is contained in:
23
64kode/src/Math/Add.h
Normal file
23
64kode/src/Math/Add.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
namespace kode64
|
||||
{
|
||||
|
||||
BEGIN_NODE_BASE(Math, Add, MathNode)
|
||||
|
||||
double Op(double first) override
|
||||
{
|
||||
double result = first;
|
||||
#ifdef AUTHORING
|
||||
auto count = inputPins->Count;
|
||||
for (int i = 1; i < count; ++i) result += Read<double>(inputPins[i]);
|
||||
#else
|
||||
auto count = inputPins.size();
|
||||
for (int i = 1; i < count; ++i) result += Read<double>(i);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
END_NODE
|
||||
|
||||
}
|
||||
78
64kode/src/Math/Bool.h
Normal file
78
64kode/src/Math/Bool.h
Normal file
@@ -0,0 +1,78 @@
|
||||
#pragma once
|
||||
|
||||
namespace kode64
|
||||
{
|
||||
|
||||
BEGIN_NODE(Math, Less)
|
||||
|
||||
BEGIN_EXEC
|
||||
Write(Result, Read<double>(Left) < Read<double>(Right));
|
||||
END_EXEC
|
||||
|
||||
PIN_INPUT(Left, 0.0);
|
||||
PIN_INPUT(Right, 0.0);
|
||||
PIN_OUTPUT(Result);
|
||||
|
||||
END_NODE
|
||||
|
||||
BEGIN_NODE(Math, LessEquals)
|
||||
|
||||
BEGIN_EXEC
|
||||
Write(Result, Read<double>(Left) <= Read<double>(Right));
|
||||
END_EXEC
|
||||
|
||||
PIN_INPUT(Left, 0.0);
|
||||
PIN_INPUT(Right, 0.0);
|
||||
PIN_OUTPUT(Result);
|
||||
|
||||
END_NODE
|
||||
|
||||
BEGIN_NODE(Math, Greater)
|
||||
|
||||
BEGIN_EXEC
|
||||
Write(Result, Read<double>(Left) > Read<double>(Right));
|
||||
END_EXEC
|
||||
|
||||
PIN_INPUT(Left, 0.0);
|
||||
PIN_INPUT(Right, 0.0);
|
||||
PIN_OUTPUT(Result);
|
||||
|
||||
END_NODE
|
||||
|
||||
BEGIN_NODE(Math, GreaterEquals)
|
||||
|
||||
BEGIN_EXEC
|
||||
Write(Result, Read<double>(Left) >= Read<double>(Right));
|
||||
END_EXEC
|
||||
|
||||
PIN_INPUT(Left, 0.0);
|
||||
PIN_INPUT(Right, 0.0);
|
||||
PIN_OUTPUT(Result);
|
||||
|
||||
END_NODE
|
||||
|
||||
BEGIN_NODE(Math, Equals)
|
||||
|
||||
BEGIN_EXEC
|
||||
Write(Result, Read<double>(Left) == Read<double>(Right));
|
||||
END_EXEC
|
||||
|
||||
PIN_INPUT(Left, 0.0);
|
||||
PIN_INPUT(Right, 0.0);
|
||||
PIN_OUTPUT(Result);
|
||||
|
||||
END_NODE
|
||||
|
||||
BEGIN_NODE(Math, NotEquals)
|
||||
|
||||
BEGIN_EXEC
|
||||
Write(Result, Read<double>(Left) != Read<double>(Right));
|
||||
END_EXEC
|
||||
|
||||
PIN_INPUT(Left, 0.0);
|
||||
PIN_INPUT(Right, 0.0);
|
||||
PIN_OUTPUT(Result);
|
||||
|
||||
END_NODE
|
||||
|
||||
}
|
||||
1
64kode/src/Math/Math.cpp
Normal file
1
64kode/src/Math/Math.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "Math.h"
|
||||
6
64kode/src/Math/Math.h
Normal file
6
64kode/src/Math/Math.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <NodeSystem/NodeSystem.h>
|
||||
#include "MathNode.h"
|
||||
#include "Add.h"
|
||||
#include "Bool.h"
|
||||
8
64kode/src/Math/Math.i
Normal file
8
64kode/src/Math/Math.i
Normal file
@@ -0,0 +1,8 @@
|
||||
#line 1 "Math.cpp"
|
||||
#using <mscorlib.dll>
|
||||
#line 1 "Math.cpp"
|
||||
#using <C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll>
|
||||
#line 1 "Math.cpp"
|
||||
#line 1 "c:\\code\\64kode\\src\\math\\Math.h"
|
||||
#pragma once
|
||||
|
||||
133
64kode/src/Math/Math.vcxproj
Normal file
133
64kode/src/Math/Math.vcxproj
Normal file
@@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Authoring|Win32">
|
||||
<Configuration>Authoring</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{618E98D1-BDE7-49A2-8CDD-FB2E660CD590}</ProjectGuid>
|
||||
<RootNamespace>Math</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<CLRSupport>false</CLRSupport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<CLRSupport>false</CLRSupport>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(SolutionDir)src;$(IncludePath)</IncludePath>
|
||||
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)obj\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">
|
||||
<IncludePath>$(SolutionDir)src;$(IncludePath)</IncludePath>
|
||||
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)obj\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(SolutionDir)src;$(IncludePath)</IncludePath>
|
||||
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)obj\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>AUTHORING;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
</ClCompile>
|
||||
<ProjectReference>
|
||||
<UseLibraryDependencyInputs>true</UseLibraryDependencyInputs>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\NodeSystem\NodeSystem.vcxproj">
|
||||
<Project>{3f0d4f6b-03be-4d66-a2ef-47ec5d961bca}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Math.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Add.h" />
|
||||
<ClInclude Include="Bool.h" />
|
||||
<ClInclude Include="Math.h" />
|
||||
<ClInclude Include="MathNode.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="mscorlib" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
4
64kode/src/Math/Math.vcxproj.user
Normal file
4
64kode/src/Math/Math.vcxproj.user
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
||||
33
64kode/src/Math/MathNode.h
Normal file
33
64kode/src/Math/MathNode.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
namespace kode64
|
||||
{
|
||||
|
||||
#ifdef AUTHORING
|
||||
public ref class MathNode abstract : public MultiInputNode
|
||||
#else
|
||||
struct MathNode : MultiInputNode
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
virtual double Op(double first) = 0;
|
||||
|
||||
BEGIN_EXEC
|
||||
#ifdef AUTHORING
|
||||
if (inputPins->Count > 0)
|
||||
{
|
||||
auto first = Read(inputPins[0]);
|
||||
if (first->GetType() == double::typeid) Write(Result, Op(safe_cast<double>(first)));
|
||||
}
|
||||
#else
|
||||
if (inputPins.size() > 0)
|
||||
{
|
||||
auto first = Read(0);
|
||||
if (first.is<double>()) Write(Result, Op(first.as<double>()));
|
||||
}
|
||||
#endif
|
||||
END_EXEC
|
||||
|
||||
PIN_OUTPUT(Result);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user