Added Robmaister's Matrix3 implementations

This commit is contained in:
Andy Korth 2013-01-03 10:41:56 -06:00
parent 1939bc789d
commit 4230c6b4f0
15 changed files with 1490 additions and 882 deletions

View file

@ -22,7 +22,36 @@
<HtmlPath>$(OutputPath)\html</HtmlPath>
<ProjectGuid>{650C6F3D-33B5-4216-9536-956AB42C0624}</ProjectGuid>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkProfile />
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<OutputType>Exe</OutputType>
<AssemblyName>Build.Docs</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Documentation|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>False</Optimize>
<OutputPath>Source</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>False</Optimize>
<OutputPath>Source</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>False</Optimize>
<OutputPath>Source</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Nsis|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>False</Optimize>
<OutputPath>Source</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<None Include="Doxyfile" />

View file

@ -17,7 +17,32 @@
<PropertyGroup>
<ProjectGuid>{ADC34399-7613-44D2-90B2-19250F06FE7A}</ProjectGuid>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkProfile />
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<OutputType>Exe</OutputType>
<AssemblyName>Build.Installer.Nsis</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Documentation|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>False</Optimize>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>False</Optimize>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>False</Optimize>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Nsis|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>False</Optimize>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<None Include="opentk.nsi" />
@ -25,9 +50,9 @@
<Target Name="Build">
<Exec Command="makensis opentk.nsi" />
<ReadLinesFromFile File="../../Version.txt">
<Output TaskParameter="Lines" ItemName="Version"/>
<Output TaskParameter="Lines" ItemName="Version" />
</ReadLinesFromFile>
<Copy SourceFiles=".\opentk.exe" DestinationFiles="@(Version->'../../opentk-%(Identity).exe')" />
<Copy SourceFiles=".\opentk.exe" DestinationFiles="@(Version-&gt;'../../opentk-%(Identity).exe')" />
</Target>
<Target Name="Clean">
<CreateItem Include=".\opentk.exe;..\..\opentk-*.exe">

View file

@ -15,39 +15,53 @@
<PropertyGroup>
<ProjectGuid>{ADC34399-7613-44D2-90B2-19250F06FE7B}</ProjectGuid>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkProfile />
<InputPath>..\..\</InputPath>
<OutputPath>.\opentk\</OutputPath>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<OutputType>Exe</OutputType>
<AssemblyName>Build.Installer.Zip</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Documentation|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>False</Optimize>
<OutputPath>opentk\</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>False</Optimize>
<OutputPath>opentk\</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>False</Optimize>
<OutputPath>opentk\</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Nsis|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>False</Optimize>
<OutputPath>opentk\</OutputPath>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<Target Name="Build">
<CallTarget Targets="CleanTreeCopy" />
<!-- Make a clean copy of the source tree -->
<CreateItem
Include="$(InputPath)**\*.*"
Exclude="$(InputPath)**\.svn\**\*.*;
$(InputPath)**\obj\**\*.*;
$(InputPath)Installers\Zip\opentk\**\*.*;
$(InputPath)Documentation\Source\**\*.*;
$(InputPath)Automation\**\*.*;
$(InputPath)Old\**\*.*;
$(InputPath)**\OpenTK*.xml;
$(InputPath)**\*.suo;
$(InputPath)**\*.pidb;
$(InputPath)**\*.userprefs;
$(InputPath)**\opentk*.zip;
$(InputPath)**\opentk*.exe;
$(InputPath)**\vshost*.exe;
">
<Output TaskParameter="Include" ItemName="FileList" />
<CreateItem Include="$(InputPath)**\*.*" Exclude="$(InputPath)**\.svn\**\*.*;&#xD;&#xA; $(InputPath)**\obj\**\*.*;&#xD;&#xA; $(InputPath)Installers\Zip\opentk\**\*.*;&#xD;&#xA; $(InputPath)Documentation\Source\**\*.*;&#xD;&#xA; $(InputPath)Automation\**\*.*;&#xD;&#xA; $(InputPath)Old\**\*.*;&#xD;&#xA; $(InputPath)**\OpenTK*.xml;&#xD;&#xA; $(InputPath)**\*.suo;&#xD;&#xA; $(InputPath)**\*.pidb;&#xD;&#xA; $(InputPath)**\*.userprefs;&#xD;&#xA; $(InputPath)**\opentk*.zip;&#xD;&#xA; $(InputPath)**\opentk*.exe;&#xD;&#xA; $(InputPath)**\vshost*.exe;&#xD;&#xA; ">
<Output TaskParameter="Include" ItemName="FileList" />
</CreateItem>
<Copy SourceFiles="@(FileList)" DestinationFiles="@(FileList->'$(OutputPath)%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(FileList)" DestinationFiles="@(FileList-&gt;'$(OutputPath)%(RecursiveDir)%(Filename)%(Extension)')" />
<!-- Zip the copy of the source tree -->
<Exec Command="7z a -tzip opentk.zip $(OutputPath)" />
<!-- Copy the zip file to the root directory and add a date stamp -->
<ReadLinesFromFile File="../../Version.txt">
<Output TaskParameter="Lines" ItemName="Version"/>
<Output TaskParameter="Lines" ItemName="Version" />
</ReadLinesFromFile>
<Copy SourceFiles=".\opentk.zip" DestinationFiles="@(Version->'..\..\opentk-%(Identity).zip')" />
<Copy SourceFiles=".\opentk.zip" DestinationFiles="@(Version-&gt;'..\..\opentk-%(Identity).zip')" />
</Target>
<Target Name="Clean">
<CreateItem Include=".\opentk.zip;..\..\opentk-*.zip">

View file

@ -1,3 +1,4 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK", "Source\OpenTK\OpenTK.csproj", "{A37A7E14-0000-0000-0000-000000000000}"
@ -66,20 +67,38 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A37A7E14-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A37A7E14-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A37A7E14-0000-0000-0000-000000000000}.Documentation|Any CPU.ActiveCfg = Documentation|Any CPU
{A37A7E14-0000-0000-0000-000000000000}.Nsis|Any CPU.ActiveCfg = Nsis|Any CPU
{A37A7E14-0000-0000-0000-000000000000}.Nsis|Any CPU.Build.0 = Nsis|Any CPU
{A37A7E14-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A37A7E14-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
{31D19132-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{31D19132-0000-0000-0000-000000000000}.Documentation|Any CPU.ActiveCfg = Documentation|Any CPU
{31D19132-0000-0000-0000-000000000000}.Nsis|Any CPU.ActiveCfg = Nsis|Any CPU
{31D19132-0000-0000-0000-000000000000}.Nsis|Any CPU.Build.0 = Nsis|Any CPU
{31D19132-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
{31D19132-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
{5FDFF4B6-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5FDFF4B6-0000-0000-0000-000000000000}.Documentation|Any CPU.ActiveCfg = Documentation|Any CPU
{5FDFF4B6-0000-0000-0000-000000000000}.Nsis|Any CPU.ActiveCfg = Nsis|Any CPU
{5FDFF4B6-0000-0000-0000-000000000000}.Nsis|Any CPU.Build.0 = Nsis|Any CPU
{5FDFF4B6-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5FDFF4B6-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
{62C0DB35-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{62C0DB35-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
{62C0DB35-0000-0000-0000-000000000000}.Documentation|Any CPU.ActiveCfg = Documentation|Any CPU
{62C0DB35-0000-0000-0000-000000000000}.Nsis|Any CPU.ActiveCfg = Nsis|Any CPU
{62C0DB35-0000-0000-0000-000000000000}.Nsis|Any CPU.Build.0 = Nsis|Any CPU
{62C0DB35-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
{62C0DB35-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
{650C6F3D-33B5-4216-9536-956AB42C0624}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{650C6F3D-33B5-4216-9536-956AB42C0624}.Documentation|Any CPU.ActiveCfg = Documentation|Any CPU
{650C6F3D-33B5-4216-9536-956AB42C0624}.Documentation|Any CPU.Build.0 = Documentation|Any CPU
{650C6F3D-33B5-4216-9536-956AB42C0624}.Nsis|Any CPU.ActiveCfg = Nsis|Any CPU
{650C6F3D-33B5-4216-9536-956AB42C0624}.Nsis|Any CPU.Build.0 = Nsis|Any CPU
{650C6F3D-33B5-4216-9536-956AB42C0624}.Release|Any CPU.ActiveCfg = Release|Any CPU
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Documentation|Any CPU.ActiveCfg = Documentation|Any CPU
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Documentation|Any CPU.Build.0 = Documentation|Any CPU
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Nsis|Any CPU.ActiveCfg = Nsis|Any CPU
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Nsis|Any CPU.Build.0 = Nsis|Any CPU
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Release|Any CPU.Build.0 = Release|Any CPU
{868E37B3-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{868E37B3-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
{868E37B3-0000-0000-0000-000000000000}.Documentation|Any CPU.ActiveCfg = Documentation|Any CPU
@ -87,6 +106,13 @@ Global
{868E37B3-0000-0000-0000-000000000000}.Nsis|Any CPU.Build.0 = Nsis|Any CPU
{868E37B3-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
{868E37B3-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
{A37A7E14-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A37A7E14-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A37A7E14-0000-0000-0000-000000000000}.Documentation|Any CPU.ActiveCfg = Documentation|Any CPU
{A37A7E14-0000-0000-0000-000000000000}.Nsis|Any CPU.ActiveCfg = Nsis|Any CPU
{A37A7E14-0000-0000-0000-000000000000}.Nsis|Any CPU.Build.0 = Nsis|Any CPU
{A37A7E14-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A37A7E14-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
{A625BE88-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A625BE88-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A625BE88-0000-0000-0000-000000000000}.Documentation|Any CPU.ActiveCfg = Documentation|Any CPU
@ -99,44 +125,16 @@ Global
{ADC34399-7613-44D2-90B2-19250F06FE7A}.Nsis|Any CPU.ActiveCfg = Nsis|Any CPU
{ADC34399-7613-44D2-90B2-19250F06FE7A}.Nsis|Any CPU.Build.0 = Nsis|Any CPU
{ADC34399-7613-44D2-90B2-19250F06FE7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{650C6F3D-33B5-4216-9536-956AB42C0624}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{650C6F3D-33B5-4216-9536-956AB42C0624}.Documentation|Any CPU.ActiveCfg = Documentation|Any CPU
{650C6F3D-33B5-4216-9536-956AB42C0624}.Documentation|Any CPU.Build.0 = Documentation|Any CPU
{650C6F3D-33B5-4216-9536-956AB42C0624}.Nsis|Any CPU.ActiveCfg = Nsis|Any CPU
{650C6F3D-33B5-4216-9536-956AB42C0624}.Nsis|Any CPU.Build.0 = Nsis|Any CPU
{650C6F3D-33B5-4216-9536-956AB42C0624}.Release|Any CPU.ActiveCfg = Release|Any CPU
{31D19132-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{31D19132-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
{31D19132-0000-0000-0000-000000000000}.Documentation|Any CPU.ActiveCfg = Documentation|Any CPU
{31D19132-0000-0000-0000-000000000000}.Nsis|Any CPU.ActiveCfg = Nsis|Any CPU
{31D19132-0000-0000-0000-000000000000}.Nsis|Any CPU.Build.0 = Nsis|Any CPU
{31D19132-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
{31D19132-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
{5FDFF4B6-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5FDFF4B6-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5FDFF4B6-0000-0000-0000-000000000000}.Documentation|Any CPU.ActiveCfg = Documentation|Any CPU
{5FDFF4B6-0000-0000-0000-000000000000}.Nsis|Any CPU.ActiveCfg = Nsis|Any CPU
{5FDFF4B6-0000-0000-0000-000000000000}.Nsis|Any CPU.Build.0 = Nsis|Any CPU
{5FDFF4B6-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5FDFF4B6-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Documentation|Any CPU.ActiveCfg = Documentation|Any CPU
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Documentation|Any CPU.Build.0 = Documentation|Any CPU
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Nsis|Any CPU.ActiveCfg = Nsis|Any CPU
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Nsis|Any CPU.Build.0 = Nsis|Any CPU
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{75DC22B1-113F-4A66-96B9-2FF8208C10E8}.Release|Any CPU.Build.0 = Release|Any CPU
{ADC34399-7613-44D2-90B2-19250F06FE7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ADC34399-7613-44D2-90B2-19250F06FE7B}.Documentation|Any CPU.ActiveCfg = Documentation|Any CPU
{ADC34399-7613-44D2-90B2-19250F06FE7B}.Nsis|Any CPU.ActiveCfg = Nsis|Any CPU
{ADC34399-7613-44D2-90B2-19250F06FE7B}.Nsis|Any CPU.Build.0 = Nsis|Any CPU
{ADC34399-7613-44D2-90B2-19250F06FE7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Source\Examples\OpenTK.Examples.csproj
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -25,7 +25,6 @@
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
<UpgradeBackupLocation />
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
@ -49,9 +48,9 @@
<DefineConstants>DEBUG;TRACE;</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>true</DebugSymbols>
<DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>false</Optimize>
<Optimize>False</Optimize>
<OutputPath>..\..\Binaries\OpenTK\Debug\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
@ -67,7 +66,7 @@
<DocumentationFile>
</DocumentationFile>
<FileAlignment>4096</FileAlignment>
<Optimize>true</Optimize>
<Optimize>True</Optimize>
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
@ -83,7 +82,7 @@
<DocumentationFile>
</DocumentationFile>
<FileAlignment>4096</FileAlignment>
<Optimize>true</Optimize>
<Optimize>True</Optimize>
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
@ -95,11 +94,11 @@
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
<DebugType>none</DebugType>
<WarningLevel>4</WarningLevel>
<Optimize>true</Optimize>
<Optimize>True</Optimize>
<DefineConstants>TRACE;</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<SignAssembly>True</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\..\OpenTK.snk</AssemblyOriginatorKeyFile>
@ -107,15 +106,12 @@
<ItemGroup>
<Reference Include="System">
<Name>System</Name>
<Private>False</Private>
</Reference>
<Reference Include="System.Core">
<Name>System.Core</Name>
<Private>False</Private>
</Reference>
<Reference Include="System.Xml">
<Name>System.Xml</Name>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>

View file

@ -51,7 +51,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<WarningLevel>4</WarningLevel>
</PropertyGroup>

View file

@ -42,16 +42,16 @@
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>DEBUG;TRACE;</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>true</DebugSymbols>
<DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>false</Optimize>
<Optimize>False</Optimize>
<OutputPath>..\..\Binaries\OpenTK\Debug\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
@ -61,7 +61,7 @@
<DebugType>full</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
@ -69,7 +69,7 @@
<DocumentationFile>
</DocumentationFile>
<FileAlignment>4096</FileAlignment>
<Optimize>true</Optimize>
<Optimize>True</Optimize>
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
@ -83,11 +83,11 @@
<DebugType>none</DebugType>
<WarningLevel>4</WarningLevel>
<NoWarn>0219, 0414, 0612, 0618, 1591, 3005, 3006</NoWarn>
<Optimize>true</Optimize>
<Optimize>True</Optimize>
<DefineConstants>TRACE;</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Nsis|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
@ -95,7 +95,7 @@
<DocumentationFile>
</DocumentationFile>
<FileAlignment>4096</FileAlignment>
<Optimize>true</Optimize>
<Optimize>True</Optimize>
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
@ -105,7 +105,7 @@
<DebugType>none</DebugType>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<SignAssembly>True</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\..\OpenTK.snk</AssemblyOriginatorKeyFile>
@ -113,23 +113,18 @@
<ItemGroup>
<Reference Include="System">
<Name>System</Name>
<Private>False</Private>
</Reference>
<Reference Include="System.Data">
<Name>System.Data</Name>
<Private>False</Private>
</Reference>
<Reference Include="System.Drawing">
<Name>System.Drawing</Name>
<Private>False</Private>
</Reference>
<Reference Include="System.Windows.Forms">
<Name>System.Windows.Forms</Name>
<Private>False</Private>
</Reference>
<Reference Include="System.Xml">
<Name>System.Xml</Name>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>

View file

@ -47,9 +47,9 @@
<DefineConstants>DEBUG;TRACE;</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>true</DebugSymbols>
<DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>false</Optimize>
<Optimize>False</Optimize>
<OutputPath>..\..\Binaries\OpenTK\Debug\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
@ -65,7 +65,7 @@
<DocumentationFile>
</DocumentationFile>
<FileAlignment>4096</FileAlignment>
<Optimize>true</Optimize>
<Optimize>True</Optimize>
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
@ -77,7 +77,7 @@
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
<DebugType>none</DebugType>
<WarningLevel>4</WarningLevel>
<Optimize>true</Optimize>
<Optimize>True</Optimize>
<DefineConstants>TRACE;</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Nsis|AnyCPU'">
@ -88,7 +88,7 @@
<DocumentationFile>
</DocumentationFile>
<FileAlignment>4096</FileAlignment>
<Optimize>true</Optimize>
<Optimize>True</Optimize>
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
@ -97,7 +97,7 @@
<DebugType>none</DebugType>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<SignAssembly>True</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\..\OpenTK.snk</AssemblyOriginatorKeyFile>
@ -105,19 +105,15 @@
<ItemGroup>
<Reference Include="System">
<Name>System</Name>
<Private>False</Private>
</Reference>
<Reference Include="System.Core">
<Name>System.Core</Name>
<Private>False</Private>
</Reference>
<Reference Include="System.Xml">
<Name>System.Xml</Name>
<Private>False</Private>
</Reference>
<Reference Include="System.Xml.Linq">
<Name>System.Xml.Linq</Name>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>

View file

@ -49,7 +49,7 @@ namespace Examples
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
// Examples.Tests.BasicMouseInput.Main ();
Examples.Tests.MatrixTest.Main ();
using (Form browser = new ExampleBrowser())
{

View file

@ -558,6 +558,7 @@
<Compile Include="OpenTK\Test\BasicMouseInput.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="OpenTK\Test\MatrixTest.cs" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">

View file

@ -0,0 +1,34 @@
// This code was written for the OpenTK library and has been released
// to the Public Domain.
// It is provided "as is" without express or implied warranty of any kind.
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using OpenTK;
namespace Examples.Tests
{
[Example("Matrix math test", ExampleCategory.OpenTK, "Test", Visible = false)]
public class MatrixTest
{
public static void Main()
{
float x = 1.0f;
float y = 1.0f;
float z = 1.0f;
Matrix4 createdTranslation = Matrix4.CreateTranslation(new Vector3(2, 3, -1));
Matrix4 translation = new Matrix4(new Vector4(1, 0, 0, 2), new Vector4(0, 1, 0, 3), new Vector4(0, 0, 1, -1), new Vector4(0, 0, 0, 1));
Vector4 point = new Vector4(x, y, z, 1);
Vector4 result = Vector4.Transform(point, createdTranslation);
Trace.WriteLine("Result should be: (3, 4, 0, 1) : " + result);
}
}
}

View file

@ -42,15 +42,15 @@
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>DEBUG;TRACE;</DefineConstants>
<DocumentationFile>OpenTK.GLControl.xml</DocumentationFile>
<DebugSymbols>true</DebugSymbols>
<DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>false</Optimize>
<Optimize>False</Optimize>
<OutputPath>..\..\Binaries\OpenTK\Debug\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
@ -59,14 +59,14 @@
<DebugType>full</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE;</DefineConstants>
<DocumentationFile>OpenTK.GLControl.xml</DocumentationFile>
<FileAlignment>4096</FileAlignment>
<Optimize>true</Optimize>
<Optimize>True</Optimize>
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
@ -78,18 +78,18 @@
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
<DebugType>none</DebugType>
<WarningLevel>4</WarningLevel>
<Optimize>true</Optimize>
<Optimize>True</Optimize>
<DefineConstants>TRACE;</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Nsis|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE;</DefineConstants>
<DocumentationFile>OpenTK.GLControl.xml</DocumentationFile>
<FileAlignment>4096</FileAlignment>
<Optimize>true</Optimize>
<Optimize>True</Optimize>
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
@ -98,7 +98,7 @@
<DebugType>none</DebugType>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<SignAssembly>True</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\..\OpenTK.snk</AssemblyOriginatorKeyFile>
@ -106,23 +106,18 @@
<ItemGroup>
<Reference Include="System">
<Name>System</Name>
<Private>False</Private>
</Reference>
<Reference Include="System.Data">
<Name>System.Data</Name>
<Private>False</Private>
</Reference>
<Reference Include="System.Drawing">
<Name>System.Drawing</Name>
<Private>False</Private>
</Reference>
<Reference Include="System.Windows.Forms">
<Name>System.Windows.Forms</Name>
<Private>False</Private>
</Reference>
<Reference Include="System.Xml">
<Name>System.Xml</Name>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>

View file

@ -0,0 +1,678 @@
#region --- License ---
/*
Copyright (c) 2006 - 2008 The Open Toolkit library.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion
using System;
using System.Runtime.InteropServices;
namespace OpenTK
{
/// <summary>
/// Represents a 3x3 Matrix
/// </summary>
[Serializable]
[StructLayout(LayoutKind.Sequential)]
public struct Matrix3 : IEquatable<Matrix3>
{
#region Fields
/// <summary>
/// First row of the matrix.
/// </summary>
public Vector3 Row0;
/// <summary>
/// Second row of the matrix.
/// </summary>
public Vector3 Row1;
/// <summary>
/// Third row of the matrix.
/// </summary>
public Vector3 Row2;
/// <summary>
/// The identity matrix.
/// </summary>
public static Matrix3 Identity = new Matrix3(Vector3.UnitX, Vector3.UnitY, Vector3.UnitZ);
#endregion
#region Constructors
/// <summary>
/// Constructs a new instance.
/// </summary>
/// <param name="row0">Top row of the matrix</param>
/// <param name="row1">Second row of the matrix</param>
/// <param name="row2">Bottom row of the matrix</param>
public Matrix3(Vector3 row0, Vector3 row1, Vector3 row2)
{
Row0 = row0;
Row1 = row1;
Row2 = row2;
}
/// <summary>
/// Constructs a new instance.
/// </summary>
/// <param name="m00">First item of the first row of the matrix.</param>
/// <param name="m01">Second item of the first row of the matrix.</param>
/// <param name="m02">Third item of the first row of the matrix.</param>
/// <param name="m10">First item of the second row of the matrix.</param>
/// <param name="m11">Second item of the second row of the matrix.</param>
/// <param name="m12">Third item of the second row of the matrix.</param>
/// <param name="m20">First item of the third row of the matrix.</param>
/// <param name="m21">Second item of the third row of the matrix.</param>
/// <param name="m22">Third item of the third row of the matrix.</param>
public Matrix3(
float m00, float m01, float m02,
float m10, float m11, float m12,
float m20, float m21, float m22)
{
Row0 = new Vector3(m00, m01, m02);
Row1 = new Vector3(m10, m11, m12);
Row2 = new Vector3(m20, m21, m22);
}
#endregion
#region Public Members
#region Properties
/// <summary>
/// Gets the determinant of this matrix.
/// </summary>
public float Determinant
{
get
{
float m11 = Row0.X, m12 = Row0.Y, m13 = Row0.Z,
m21 = Row1.X, m22 = Row1.Y, m23 = Row1.Z,
m31 = Row2.X, m32 = Row2.Y, m33 = Row2.Z;
return
m11 * m22 * m33 + m12 * m23 * m31 + m13 * m21 * m32
- m13 * m22 * m31 - m11 * m23 * m32 - m12 * m21 * m33;
}
}
/// <summary>
/// Gets the first column of this matrix.
/// </summary>
public Vector3 Column0
{
get { return new Vector3(Row0.X, Row1.X, Row2.X); }
}
/// <summary>
/// Gets the second column of this matrix.
/// </summary>
public Vector3 Column1
{
get { return new Vector3(Row0.Y, Row1.Y, Row2.Y); }
}
/// <summary>
/// Gets the third column of this matrix.
/// </summary>
public Vector3 Column2
{
get { return new Vector3(Row0.Z, Row1.Z, Row2.Z); }
}
/// <summary>
/// Gets or sets the value at row 1, column 1 of this instance.
/// </summary>
public float M11 { get { return Row0.X; } set { Row0.X = value; } }
/// <summary>
/// Gets or sets the value at row 1, column 2 of this instance.
/// </summary>
public float M12 { get { return Row0.Y; } set { Row0.Y = value; } }
/// <summary>
/// Gets or sets the value at row 1, column 3 of this instance.
/// </summary>
public float M13 { get { return Row0.Z; } set { Row0.Z = value; } }
/// <summary>
/// Gets or sets the value at row 2, column 1 of this instance.
/// </summary>
public float M21 { get { return Row1.X; } set { Row1.X = value; } }
/// <summary>
/// Gets or sets the value at row 2, column 2 of this instance.
/// </summary>
public float M22 { get { return Row1.Y; } set { Row1.Y = value; } }
/// <summary>
/// Gets or sets the value at row 2, column 3 of this instance.
/// </summary>
public float M23 { get { return Row1.Z; } set { Row1.Z = value; } }
/// <summary>
/// Gets or sets the value at row 3, column 1 of this instance.
/// </summary>
public float M31 { get { return Row2.X; } set { Row2.X = value; } }
/// <summary>
/// Gets or sets the value at row 3, column 2 of this instance.
/// </summary>
public float M32 { get { return Row2.Y; } set { Row2.Y = value; } }
/// <summary>
/// Gets or sets the value at row 3, column 3 of this instance.
/// </summary>
public float M33 { get { return Row2.Z; } set { Row2.Z = value; } }
#endregion
#region Instance
#region public void Invert()
public void Invert()
{
this = Matrix3.Invert(this);
}
#endregion
#region public void Transpose()
public void Transpose()
{
this = Matrix3.Transpose(this);
}
#endregion
#endregion
#region Static
#region CreateFromAxisAngle
public static void CreateFromAxisAngle(Vector3 axis, float angle, out Matrix3 result)
{
//normalize and create a local copy of the vector.
axis.Normalize();
float axisX = axis.X, axisY = axis.Y, axisZ = axis.Z;
//calculate angles
float cos = (float)System.Math.Cos(-angle);
float sin = (float)System.Math.Sin(-angle);
float t = 1.0f - cos;
//do the conversion math once
float tXX = t * axisX * axisX,
tXY = t * axisX * axisY,
tXZ = t * axisX * axisZ,
tYY = t * axisY * axisY,
tYZ = t * axisY * axisZ,
tZZ = t * axisZ * axisZ;
float sinX = sin * axisX,
sinY = sin * axisY,
sinZ = sin * axisZ;
result.Row0.X = tXX + cos;
result.Row0.Y = tXY - sinZ;
result.Row0.Z = tXZ + sinY;
result.Row1.X = tXY + sinZ;
result.Row1.Y = tYY + cos;
result.Row1.Z = tYZ - sinX;
result.Row2.X = tXZ - sinY;
result.Row2.Y = tYZ + sinX;
result.Row2.Z = tZZ + cos;
}
public static Matrix3 CreateFromAxisAngle(Vector3 axis, float angle)
{
Matrix3 result;
CreateFromAxisAngle(axis, angle, out result);
return result;
}
#endregion
#region CreateFromQuaternion
public static void CreateFromQuaternion(ref Quaternion q, out Matrix3 result)
{
Vector3 axis;
float angle;
q.ToAxisAngle(out axis, out angle);
CreateFromAxisAngle(axis, angle, out result);
}
public static Matrix3 CreateFromQuaternion(Quaternion q)
{
Matrix3 result;
CreateFromQuaternion(ref q, out result);
return result;
}
#endregion
#region CreateRotation[XYZ]
public static void CreateRotationX(float angle, out Matrix3 result)
{
float cos = (float)System.Math.Cos(angle);
float sin = (float)System.Math.Sin(angle);
result = Identity;
result.Row1.Y = cos;
result.Row1.Z = sin;
result.Row2.Y = -sin;
result.Row2.Z = cos;
}
public static Matrix3 CreateRotationX(float angle)
{
Matrix3 result;
CreateRotationX(angle, out result);
return result;
}
public static void CreateRotationY(float angle, out Matrix3 result)
{
float cos = (float)System.Math.Cos(angle);
float sin = (float)System.Math.Sin(angle);
result = Identity;
result.Row0.X = cos;
result.Row0.Z = -sin;
result.Row2.X = sin;
result.Row2.Z = cos;
}
public static Matrix3 CreateRotationY(float angle)
{
Matrix3 result;
CreateRotationY(angle, out result);
return result;
}
public static void CreateRotationZ(float angle, out Matrix3 result)
{
float cos = (float)System.Math.Cos(angle);
float sin = (float)System.Math.Sin(angle);
result = Identity;
result.Row0.X = cos;
result.Row0.Y = sin;
result.Row1.X = -sin;
result.Row1.Y = cos;
}
public static Matrix3 CreateRotationZ(float angle)
{
Matrix3 result;
CreateRotationZ(angle, out result);
return result;
}
#endregion
#region CreateScale
/// <summary>
/// Creates a scale matrix.
/// </summary>
/// <param name="scale">Single scale factor for the x, y, and z axes.</param>
/// <returns>A scale matrix.</returns>
public static Matrix3 CreateScale(float scale)
{
Matrix3 result;
CreateScale(scale, out result);
return result;
}
/// <summary>
/// Creates a scale matrix.
/// </summary>
/// <param name="scale">Scale factors for the x, y, and z axes.</param>
/// <returns>A scale matrix.</returns>
public static Matrix3 CreateScale(Vector3 scale)
{
Matrix3 result;
CreateScale(ref scale, out result);
return result;
}
/// <summary>
/// Creates a scale matrix.
/// </summary>
/// <param name="x">Scale factor for the x axis.</param>
/// <param name="y">Scale factor for the y axis.</param>
/// <param name="z">Scale factor for the z axis.</param>
/// <returns>A scale matrix.</returns>
public static Matrix3 CreateScale(float x, float y, float z)
{
Matrix3 result;
CreateScale(x, y, z, out result);
return result;
}
/// <summary>
/// Creates a scale matrix.
/// </summary>
/// <param name="scale">Single scale factor for the x, y, and z axes.</param>
/// <param name="result">A scale matrix.</param>
public static void CreateScale(float scale, out Matrix3 result)
{
result = Identity;
result.Row0.X = scale;
result.Row1.Y = scale;
result.Row2.Z = scale;
}
/// <summary>
/// Creates a scale matrix.
/// </summary>
/// <param name="scale">Scale factors for the x, y, and z axes.</param>
/// <param name="result">A scale matrix.</param>
public static void CreateScale(ref Vector3 scale, out Matrix3 result)
{
result = Identity;
result.Row0.X = scale.X;
result.Row1.Y = scale.Y;
result.Row2.Z = scale.Z;
}
/// <summary>
/// Creates a scale matrix.
/// </summary>
/// <param name="x">Scale factor for the x axis.</param>
/// <param name="y">Scale factor for the y axis.</param>
/// <param name="z">Scale factor for the z axis.</param>
/// <param name="result">A scale matrix.</returns>
public static void CreateScale(float x, float y, float z, out Matrix3 result)
{
result = Identity;
result.Row0.X = x;
result.Row1.Y = y;
result.Row2.Z = z;
}
#endregion
#region Multiply Functions
public static Matrix3 Mult(Matrix3 left, Matrix3 right)
{
Matrix3 result;
Mult(ref left, ref right, out result);
return result;
}
public static void Mult(ref Matrix3 left, ref Matrix3 right, out Matrix3 result)
{
float lM11 = left.Row0.X, lM12 = left.Row0.Y, lM13 = left.Row0.Z,
lM21 = left.Row1.X, lM22 = left.Row1.Y, lM23 = left.Row1.Z,
lM31 = left.Row2.X, lM32 = left.Row2.Y, lM33 = left.Row2.Z,
rM11 = right.Row0.X, rM12 = right.Row0.Y, rM13 = right.Row0.Z,
rM21 = right.Row1.X, rM22 = right.Row1.Y, rM23 = right.Row1.Z,
rM31 = right.Row2.X, rM32 = right.Row2.Y, rM33 = right.Row2.Z;
result.Row0.X = ((lM11 * rM11) + (lM12 * rM21)) + (lM13 * rM31);
result.Row0.Y = ((lM11 * rM12) + (lM12 * rM22)) + (lM13 * rM32);
result.Row0.Z = ((lM11 * rM13) + (lM12 * rM23)) + (lM13 * rM33);
result.Row1.X = ((lM21 * rM11) + (lM22 * rM21)) + (lM23 * rM31);
result.Row1.Y = ((lM21 * rM12) + (lM22 * rM22)) + (lM23 * rM32);
result.Row1.Z = ((lM21 * rM13) + (lM22 * rM23)) + (lM23 * rM33);
result.Row2.X = ((lM31 * rM11) + (lM32 * rM21)) + (lM33 * rM31);
result.Row2.Y = ((lM31 * rM12) + (lM32 * rM22)) + (lM33 * rM32);
result.Row2.Z = ((lM31 * rM13) + (lM32 * rM23)) + (lM33 * rM33);
}
#endregion
#region Invert Functions
/// <summary>
/// Calculate the inverse of the given matrix
/// </summary>
/// <param name="mat">The matrix to invert</param>
/// <param name="result">The inverse of the given matrix if it has one, or the input if it is singular</param>
/// <exception cref="InvalidOperationException">Thrown if the Matrix3 is singular.</exception>
public static void Invert(ref Matrix3 mat, out Matrix3 result)
{
int[] colIdx = { 0, 0, 0 };
int[] rowIdx = { 0, 0, 0 };
int[] pivotIdx = { -1, -1, -1 };
float[,] inverse = {{mat.Row0.X, mat.Row0.Y, mat.Row0.Z},
{mat.Row1.X, mat.Row1.Y, mat.Row1.Z},
{mat.Row2.X, mat.Row2.Y, mat.Row2.Z}};
int icol = 0;
int irow = 0;
for (int i = 0; i < 3; i++)
{
float maxPivot = 0.0f;
for (int j = 0; j < 3; j++)
{
if (pivotIdx[j] != 0)
{
for (int k = 0; k < 3; ++k)
{
if (pivotIdx[k] == -1)
{
float absVal = System.Math.Abs(inverse[j, k]);
if (absVal > maxPivot)
{
maxPivot = absVal;
irow = j;
icol = k;
}
}
else if (pivotIdx[k] > 0)
{
result = mat;
return;
}
}
}
}
++(pivotIdx[icol]);
if (irow != icol)
{
for (int k = 0; k < 3; ++k)
{
float f = inverse[irow, k];
inverse[irow, k] = inverse[icol, k];
inverse[icol, k] = f;
}
}
rowIdx[i] = irow;
colIdx[i] = icol;
float pivot = inverse[icol, icol];
if (pivot == 0.0f)
{
throw new InvalidOperationException("Matrix is singular and cannot be inverted.");
}
float oneOverPivot = 1.0f / pivot;
inverse[icol, icol] = 1.0f;
for (int k = 0; k < 3; ++k)
inverse[icol, k] *= oneOverPivot;
for (int j = 0; j < 3; ++j)
{
if (icol != j)
{
float f = inverse[j, icol];
inverse[j, icol] = 0.0f;
for (int k = 0; k < 3; ++k)
inverse[j, k] -= inverse[icol, k] * f;
}
}
}
for (int j = 2; j >= 0; --j)
{
int ir = rowIdx[j];
int ic = colIdx[j];
for (int k = 0; k < 3; ++k)
{
float f = inverse[k, ir];
inverse[k, ir] = inverse[k, ic];
inverse[k, ic] = f;
}
}
result.Row0.X = inverse[0, 0];
result.Row0.Y = inverse[0, 1];
result.Row0.Z = inverse[0, 2];
result.Row1.X = inverse[1, 0];
result.Row1.Y = inverse[1, 1];
result.Row1.Z = inverse[1, 2];
result.Row2.X = inverse[2, 0];
result.Row2.Y = inverse[2, 1];
result.Row2.Z = inverse[2, 2];
}
/// <summary>
/// Calculate the inverse of the given matrix
/// </summary>
/// <param name="mat">The matrix to invert</param>
/// <returns>The inverse of the given matrix if it has one, or the input if it is singular</returns>
/// <exception cref="InvalidOperationException">Thrown if the Matrix4 is singular.</exception>
public static Matrix3 Invert(Matrix3 mat)
{
Matrix3 result;
Invert(ref mat, out result);
return result;
}
#endregion
#region Transpose
public static Matrix3 Transpose(Matrix3 mat)
{
return new Matrix3(mat.Column0, mat.Column1, mat.Column2);
}
public static void Transpose(ref Matrix3 mat, out Matrix3 result)
{
result.Row0 = mat.Column0;
result.Row1 = mat.Column1;
result.Row2 = mat.Column2;
}
#endregion
#endregion
#region Operators
public static Matrix3 operator *(Matrix3 left, Matrix3 right)
{
return Matrix3.Mult(left, right);
}
public static bool operator ==(Matrix3 left, Matrix3 right)
{
return left.Equals(right);
}
public static bool operator !=(Matrix3 left, Matrix3 right)
{
return !left.Equals(right);
}
#endregion
#region Overrides
#region public override string ToString()
/// <summary>
/// Returns a System.String that represents the current Matrix3d.
/// </summary>
/// <returns>The string representation of the matrix.</returns>
public override string ToString()
{
return String.Format("{0}\n{1}\n{2}", Row0, Row1, Row2);
}
#endregion
#region public override int GetHashCode()
/// <summary>
/// Returns the hashcode for this instance.
/// </summary>
/// <returns>A System.Int32 containing the unique hashcode for this instance.</returns>
public override int GetHashCode()
{
return Row0.GetHashCode() ^ Row1.GetHashCode() ^ Row2.GetHashCode();
}
#endregion
#region public override bool Equals(object obj)
/// <summary>
/// Indicates whether this instance and a specified object are equal.
/// </summary>
/// <param name="obj">The object to compare to.</param>
/// <returns>True if the instances are equal; false otherwise.</returns>
public override bool Equals(object obj)
{
if (!(obj is Matrix3))
return false;
return this.Equals((Matrix3)obj);
}
#endregion
#endregion
#endregion
#region IEquatable<Matrix3> Members
public bool Equals(Matrix3 other)
{
return
Row0 == other.Row0 &&
Row1 == other.Row1 &&
Row2 == other.Row2;
}
#endregion
}
}

File diff suppressed because it is too large Load diff

View file

@ -42,32 +42,32 @@
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>DEBUG;TRACE;</DefineConstants>
<DocumentationFile>OpenTK.xml</DocumentationFile>
<DebugSymbols>true</DebugSymbols>
<DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>false</Optimize>
<Optimize>False</Optimize>
<OutputPath>..\..\Binaries\OpenTK\Debug\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<DebugType>full</DebugType>
<GenerateDocumentation>true</GenerateDocumentation>
<GenerateDocumentation>True</GenerateDocumentation>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE;</DefineConstants>
<DocumentationFile>OpenTK.xml</DocumentationFile>
<FileAlignment>4096</FileAlignment>
<Optimize>true</Optimize>
<Optimize>True</Optimize>
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
@ -79,19 +79,19 @@
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
<DebugType>none</DebugType>
<WarningLevel>4</WarningLevel>
<Optimize>true</Optimize>
<Optimize>True</Optimize>
<DefineConstants>TRACE;</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Nsis|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE;</DefineConstants>
<DocumentationFile>OpenTK.xml</DocumentationFile>
<FileAlignment>4096</FileAlignment>
<Optimize>true</Optimize>
<Optimize>True</Optimize>
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
@ -100,7 +100,7 @@
<DebugType>none</DebugType>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<SignAssembly>True</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\..\OpenTK.snk</AssemblyOriginatorKeyFile>
@ -108,19 +108,15 @@
<ItemGroup>
<Reference Include="System">
<Name>System</Name>
<Private>False</Private>
</Reference>
<Reference Include="System.Data">
<Name>System.Data</Name>
<Private>False</Private>
</Reference>
<Reference Include="System.Drawing">
<Name>System.Drawing</Name>
<Private>False</Private>
</Reference>
<Reference Include="System.Xml">
<Name>System.Xml</Name>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
@ -769,6 +765,7 @@
</EmbeddedResource>
<Compile Include="Platform\MacOS\HIDInput.cs" />
<Compile Include="IntPtrEqualityComparer.cs" />
<Compile Include="Math\Matrix3.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>