remove old Warp3d files not in use

This commit is contained in:
UbitUmarov
2023-08-14 21:51:47 +01:00
parent 2570f322e1
commit 64398cfa3d
170 changed files with 0 additions and 21288 deletions
@@ -1,130 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{D9F00283-9C34-4208-8C72-AD394AD4C22F}</ProjectGuid>
<OutputType>WinExe</OutputType>
<StartupObject>BasicWarp3D.My.MyApplication</StartupObject>
<RootNamespace>BasicWarp3D</RootNamespace>
<AssemblyName>BasicWarp3D</AssemblyName>
<MyType>WindowsForms</MyType>
<OptionStrict>On</OptionStrict>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>BasicWarp3D.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>BasicWarp3D.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Slixel Tester|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Slixel Tester\</OutputPath>
<DocumentationFile>BasicWarp3D.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisRuleAssemblies>\rules</CodeAnalysisRuleAssemblies>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.vb</CodeAnalysisModuleSuppressionsFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Drawing" />
<Import Include="System.Diagnostics" />
<Import Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.vb">
<DependentUpon>Form1.vb</DependentUpon>
<SubType>Form</SubType>
</Compile>
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Form1.resx">
<SubType>Designer</SubType>
<DependentUpon>Form1.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
</None>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<CustomToolNamespace>My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Warp3D\Warp3D.csproj">
<Project>{6E48530B-16AB-4861-9CED-97334739D675}</Project>
<Name>Warp3D %28Warp3D\Warp3D%29</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -1,10 +0,0 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}
-46
View File
@@ -1,46 +0,0 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.W3D = New Warp3D.Warp3D
Me.SuspendLayout()
'
'W3D
'
Me.W3D.Dock = System.Windows.Forms.DockStyle.Fill
Me.W3D.Location = New System.Drawing.Point(0, 0)
Me.W3D.Name = "W3D"
Me.W3D.Size = New System.Drawing.Size(427, 379)
Me.W3D.TabIndex = 0
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(427, 379)
Me.Controls.Add(Me.W3D)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
Friend WithEvents W3D As Warp3D.Warp3D
End Class
-120
View File
@@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
-40
View File
@@ -1,40 +0,0 @@
Public Class Form1
Protected Friend WithEvents RenderTimer As Timers.Timer
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
RenderTimer.Stop()
RenderTimer = Nothing
End Sub
Private Sub CreateScene()
'W3D.DisplayDefaultScene()
W3D.CreateScene(Me.ClientSize.Width, Me.ClientSize.Height)
W3D.AddBox("box", 5, 5, 5)
W3D.AddMaterial("red")
W3D.Scene.material("red").color = Color.Red.ToArgb
W3D.SetObjectMaterial("box", "red")
W3D.AddLight("light1", 0, 5, 20, Color.White.ToArgb, 100, 40)
W3D.ShiftDefaultCamera(0, 0, -20)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Control.CheckForIllegalCrossThreadCalls = False
CreateScene()
RenderTimer = New Timers.Timer(33)
RenderTimer.AutoReset = False
RenderTimer.Start()
End Sub
Private Sub RenderTimer_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles RenderTimer.Elapsed
W3D.Render()
' W3D.Refresh()
If Me.Created AndAlso RenderTimer IsNot Nothing Then RenderTimer.Start()
End Sub
End Class
@@ -1,38 +0,0 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:2.0.50727.42
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
'NOTE: This file is auto-generated; do not modify it directly. To make changes,
' or if you encounter build errors in this file, go to the Project Designer
' (go to Project Properties or double-click the My Project node in
' Solution Explorer), and make changes on the Application tab.
'
Partial Friend Class MyApplication
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Public Sub New()
MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
Me.IsSingleInstance = false
Me.EnableVisualStyles = true
Me.SaveMySettingsOnExit = true
Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
End Sub
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.BasicWarp3D.Form1
End Sub
End Class
End Namespace
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>true</MySubMain>
<MainForm>Form1</MainForm>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<ApplicationType>0</ApplicationType>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
</MyApplicationData>
@@ -1,35 +0,0 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("BasicWarp3D")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("Created by: X")>
<Assembly: AssemblyProduct("BasicWarp3D")>
<Assembly: AssemblyCopyright("Copyright © Created by: X 2006")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("6047c436-19a9-4974-af2e-7c071be453a6")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
@@ -1,62 +0,0 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:2.0.50727.42
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'<summary>
' A strongly-typed resource class, for looking up localized strings, etc.
'</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'<summary>
' Returns the cached ResourceManager instance used by this class.
'</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("BasicWarp3D.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'<summary>
' Overrides the current thread's CurrentUICulture property for all
' resource lookups using this strongly typed resource class.
'</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set(ByVal value As Global.System.Globalization.CultureInfo)
resourceCulture = value
End Set
End Property
End Module
End Namespace
@@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -1,73 +0,0 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:2.0.50727.42
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.BasicWarp3D.My.MySettings
Get
Return Global.BasicWarp3D.My.MySettings.Default
End Get
End Property
End Module
End Namespace
@@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
-250
View File
@@ -1,250 +0,0 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.IO;
namespace MCI
{
public delegate void PositionEventHandler(object sender, PositionChangedEventArgs e);
public class Media
{
private System.Windows.Forms.Timer timer1;
public bool FileIsOpen = false;
public event PositionEventHandler PositionChanged;
[DllImport("winmm.dll")]
private static extern long mciSendString(string strCommand,StringBuilder strReturn,int iReturnLength, IntPtr hwndCallback);
[DllImport("Winmm.dll")]
private static extern long PlaySound(byte[] data, IntPtr hMod, UInt32 dwFlags);
private string sCommand;
private StringBuilder sBuffer = new StringBuilder(128);
private bool m_Repeat = false;
private bool m_Pause = false;
private int seconds;
public Media()
{
timer1 = new System.Windows.Forms.Timer();
timer1.Enabled = false;
timer1.Interval = 100;
timer1.Tick += new System.EventHandler(this.timer1_Tick);
}
private void timer1_Tick(object sender, System.EventArgs e)
{
PositionChangedEventArgs pArgs = new PositionChangedEventArgs(this.Position);
if(PositionChanged != null)
PositionChanged(this,pArgs);
}
public void Close()
{
sCommand = "close MediaFile";
mciSendString(sCommand, null, 0, IntPtr.Zero);
timer1.Enabled = false;
FileIsOpen = false;
}
public void Stop()
{
this.Position = 0;
sCommand = "stop MediaFile";
mciSendString(sCommand, null, 0, IntPtr.Zero);
timer1.Enabled = false;
}
public bool Pause
{
get
{
return m_Pause;
}
set
{
m_Pause = value;
if(m_Pause)
sCommand = "pause MediaFile";
else
sCommand = "resume MediaFile";
mciSendString(sCommand, null, 0, IntPtr.Zero);
}
}
public void Open(string sFileName)
{
if(this.Status() == "playing")
this.Close();
sCommand = "open \"" + sFileName + "\" type mpegvideo alias MediaFile";
mciSendString(sCommand, null, 0, IntPtr.Zero);
FileIsOpen = true;
}
public void Open(string sFileName,System.Windows.Forms.PictureBox videobox)
{
if(this.Status() == "playing")
this.Close();
sCommand = "open \"" + sFileName + "\" type mpegvideo alias MediaFile style child parent " + videobox.Handle.ToInt32();
mciSendString(sCommand, null, 0, IntPtr.Zero);
sCommand = "put MediaFile window at 0 0 " + videobox.Width + " " +videobox.Height;
mciSendString(sCommand, null, 0, IntPtr.Zero);
FileIsOpen = true;
}
public void Play()
{
if(FileIsOpen)
{
sCommand = "play MediaFile";
if (Repeat)
sCommand += " REPEAT";
mciSendString(sCommand, null, 0, IntPtr.Zero);
timer1.Enabled = true;
}
}
public void FullScreen()
{
sCommand = "play MediaFile FullScreen";
mciSendString(sCommand, null, 0, IntPtr.Zero);
}
public int Position
{
set
{
seconds = value;
seconds = seconds * 1000;
sCommand = "play MediaFile from " + seconds.ToString();
mciSendString(sCommand, null, 0, IntPtr.Zero);
}
get
{
sCommand = "status MediaFile position";
mciSendString(sCommand, sBuffer, sBuffer.Capacity, IntPtr.Zero);
seconds = int.Parse(sBuffer.ToString());
seconds = seconds /1000;
return seconds;
}
}
public int Duration()
{
int ReturnSeconds;
sCommand = "status MediaFile length";
mciSendString(sCommand, sBuffer, 128, IntPtr.Zero);
ReturnSeconds = int.Parse(sBuffer.ToString());
ReturnSeconds = ReturnSeconds /1000;
return ReturnSeconds;
}
public string Status()
{
mciSendString("status MediaFile mode", sBuffer, sBuffer.Capacity, IntPtr.Zero);
return sBuffer.ToString();
}
public int Volume
{
get
{
if(Status() != "")
{
mciSendString("status MediaFile volume", sBuffer, sBuffer.Capacity, IntPtr.Zero);
return int.Parse(sBuffer.ToString());
}
else
{
return 0;
}
}
set
{
if(value <= 1000)
{
mciSendString("setaudio MediaFile volume to " + value.ToString(), null, 0, IntPtr.Zero);
}
else
{
System.Windows.Forms.MessageBox.Show("Volume value must be smaller than 1000");
}
}
}
public bool Repeat
{
get
{
return m_Repeat;
}
set
{
m_Repeat = value;
}
}
public string SecondsToTime(int seconds)
{
int hours,minutes;
hours = seconds / 3600;
minutes = seconds / 60;
minutes = minutes % 60;
seconds = seconds % 60;
return hours.ToString("00") + ":" + minutes.ToString("00") + ":" + seconds.ToString("00");
}
public void PlayWavResource(string wav)
{
// get the namespace
string strNameSpace = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name.ToString();
// get the resource into a stream
Stream str = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream( strNameSpace +"."+ wav );
if ( str == null )
return;
// bring stream into a byte array
byte[] bStr = new Byte[str.Length];
str.Read(bStr, 0, (int)str.Length);
// play the resource
PlaySound(bStr, IntPtr.Zero, 1 | 4 | 8);
}
}
public class PositionChangedEventArgs : EventArgs
{
private int _position;
public PositionChangedEventArgs(int num)
{
this._position = num;
}
public int newPosition
{
get
{
return _position;
}
}
}
}
@@ -1,84 +0,0 @@
using System;
using Rednettle.Warp3D;
namespace Ode
{
/// <summary>
/// Summary description for OdeDxHelpers.
/// </summary>
public sealed class OdeWarpHelpers
{
private OdeWarpHelpers() { }
public static warp_Matrix Ode2WarpMatrix( Ode.Matrix3 m )
{
warp_Matrix result = new warp_Matrix();
result.m11 = ( float )m.m11;
result.m12 = ( float )m.m12;
result.m13 = ( float )m.m13;
result.m21 = ( float )m.m21;
result.m22 = ( float )m.m22;
result.m23 = ( float )m.m23;
result.m31 = ( float )m.m31;
result.m32 = ( float )m.m32;
result.m33 = ( float )m.m33;
return result;
}
public static Ode.Matrix3 Warp2OdeMatrix3( warp_Matrix m )
{
Ode.Matrix3 odeM = new Ode.Matrix3();
odeM.m11 = m.m11;
odeM.m12 = m.m12;
odeM.m13 = m.m13;
odeM.m21 = m.m21;
odeM.m22 = m.m22;
odeM.m23 = m.m23;
odeM.m31 = m.m31;
odeM.m32 = m.m32;
odeM.m33 = m.m33;
return odeM;
}
public static warp_Quaternion Ode2WarpQuaternion( Ode.Quaternion odeQ )
{
warp_Quaternion q = new warp_Quaternion(
( float )odeQ.X,
( float )odeQ.Y,
( float )odeQ.Z,
( float )odeQ.W );
return q;
}
public static Ode.Quaternion Warp2OdeQuaternion( warp_Quaternion q )
{
Ode.Quaternion odeQ = new Ode.Quaternion();
odeQ.W = q.W;
odeQ.X = q.X;
odeQ.Y = q.Y;
odeQ.Z = q.Z;
return odeQ;
}
public static warp_Vector Ode2DxVector3( Ode.Vector3 odeV )
{
return new warp_Vector( ( float )odeV.X, ( float )odeV.Y, ( float )odeV.Z );
}
public static Ode.Vector3 Dx2OdeVector3( warp_Vector dxV )
{
return new Ode.Vector3( dxV.x, dxV.y, dxV.z );
}
}
}
-19
View File
@@ -1,19 +0,0 @@
using System;
using System.Collections;
using System.Windows.Forms;
namespace TestWarp
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new Warp());
}
}
}
@@ -1,33 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TestWarp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TestWarp")]
[assembly: AssemblyCopyright("Copyright © 2005")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM componenets. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("600296e6-e905-4892-a624-8ae680586e33")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -1,74 +0,0 @@
//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Runtime Version:2.0.50215.44
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------
[assembly: global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "TestWarp.Properties.Resources.get_ResourceManager():System.Resources.ResourceManager")]
[assembly: global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "TestWarp.Properties.Resources.get_Culture():System.Globalization.CultureInfo")]
[assembly: global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "TestWarp.Properties.Resources.set_Culture(System.Globalization.CultureInfo):Void")]
namespace TestWarp.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TestWarp.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
@@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -1,31 +0,0 @@
//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Runtime Version:2.0.50215.44
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------
[assembly: global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "TestWarp.Properties.Settings.get_Default():TestWarp.Properties.Settings")]
namespace TestWarp.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = new Settings();
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
@@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
@@ -1,149 +0,0 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{0F882E9B-E9A2-4273-BA14-93E5CBB82489}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TestWarp</RootNamespace>
<AssemblyName>TestWarp</AssemblyName>
<StartupObject>
</StartupObject>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>true</UseVSHostingProcess>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>true</UseVSHostingProcess>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Original|AnyCPU' ">
<OutputPath>bin\Original\</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == '64Bit CPU%27s|AnyCPU' ">
<OutputPath>bin\64Bit CPU%27s\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Original|x64' ">
<OutputPath>bin\x64\Original\</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == '64Bit CPU%27s|x64' ">
<OutputPath>bin\x64\64Bit CPU%27s\</OutputPath>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Slixel Tester|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Slixel Tester\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisRuleAssemblies>\rules</CodeAnalysisRuleAssemblies>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Slixel Tester|x64' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Slixel Tester\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleAssemblies>\rules</CodeAnalysisRuleAssemblies>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="ode, Version=1.0.2074.26253, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\debug\ode.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="OdeWarpHelpers.cs" />
<Compile Include="Warp.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Warp.Designer.cs">
<DependentUpon>Warp.cs</DependentUpon>
</Compile>
<Compile Include="MCI.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Warp.resx">
<DependentUpon>Warp.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Warp3D\Warp3D.csproj">
<Project>{6E48530B-16AB-4861-9CED-97334739D675}</Project>
<Name>Warp3D %28Warp3D\Warp3D%29</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
@@ -1,10 +0,0 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}
-184
View File
@@ -1,184 +0,0 @@
namespace TestWarp
{
partial class Warp
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load_Scene = new System.Windows.Forms.Button();
this.button_Flare1 = new System.Windows.Forms.Button();
this.button_Stones = new System.Windows.Forms.Button();
this.button_Bounce = new System.Windows.Forms.Button();
this.button_Studio = new System.Windows.Forms.Button();
this.button_Physics = new System.Windows.Forms.Button();
this.button_Body = new System.Windows.Forms.Button();
this.button_Sphere = new System.Windows.Forms.Button();
this.warp3D1 = new Warp3D.Warp3D();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// Load_Scene
//
this.Load_Scene.Anchor = ( ( System.Windows.Forms.AnchorStyles )( ( System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left ) ) );
this.Load_Scene.Location = new System.Drawing.Point( 12, 503 );
this.Load_Scene.Name = "Load_Scene";
this.Load_Scene.Size = new System.Drawing.Size( 75, 23 );
this.Load_Scene.TabIndex = 1;
this.Load_Scene.Text = "Chair";
this.Load_Scene.Click += new System.EventHandler( this.Load_Scene_Click );
//
// button_Flare1
//
this.button_Flare1.Anchor = ( ( System.Windows.Forms.AnchorStyles )( ( System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left ) ) );
this.button_Flare1.Location = new System.Drawing.Point( 93, 503 );
this.button_Flare1.Name = "button_Flare1";
this.button_Flare1.Size = new System.Drawing.Size( 75, 23 );
this.button_Flare1.TabIndex = 2;
this.button_Flare1.Text = "Flare";
this.button_Flare1.Click += new System.EventHandler( this.button_Flare1_Click );
//
// button_Stones
//
this.button_Stones.Anchor = ( ( System.Windows.Forms.AnchorStyles )( ( System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left ) ) );
this.button_Stones.Location = new System.Drawing.Point( 174, 503 );
this.button_Stones.Name = "button_Stones";
this.button_Stones.Size = new System.Drawing.Size( 75, 23 );
this.button_Stones.TabIndex = 3;
this.button_Stones.Text = "Stones";
this.button_Stones.Click += new System.EventHandler( this.button_Stones_Click );
//
// button_Bounce
//
this.button_Bounce.Anchor = ( ( System.Windows.Forms.AnchorStyles )( ( System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left ) ) );
this.button_Bounce.Location = new System.Drawing.Point( 255, 503 );
this.button_Bounce.Name = "button_Bounce";
this.button_Bounce.Size = new System.Drawing.Size( 75, 23 );
this.button_Bounce.TabIndex = 4;
this.button_Bounce.Text = "Objects";
this.button_Bounce.Click += new System.EventHandler( this.button_Bounce_Click );
//
// button_Studio
//
this.button_Studio.Anchor = ( ( System.Windows.Forms.AnchorStyles )( ( System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left ) ) );
this.button_Studio.Location = new System.Drawing.Point( 336, 503 );
this.button_Studio.Name = "button_Studio";
this.button_Studio.Size = new System.Drawing.Size( 75, 23 );
this.button_Studio.TabIndex = 5;
this.button_Studio.Text = "3Ds";
this.button_Studio.Click += new System.EventHandler( this.button_Studio_Click );
//
// button_Physics
//
this.button_Physics.Anchor = ( ( System.Windows.Forms.AnchorStyles )( ( System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left ) ) );
this.button_Physics.Location = new System.Drawing.Point( 417, 503 );
this.button_Physics.Name = "button_Physics";
this.button_Physics.Size = new System.Drawing.Size( 75, 23 );
this.button_Physics.TabIndex = 6;
this.button_Physics.Text = "Physics";
this.button_Physics.Click += new System.EventHandler( this.button_Physics_Click );
//
// button_Body
//
this.button_Body.Anchor = ( ( System.Windows.Forms.AnchorStyles )( ( System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right ) ) );
this.button_Body.Enabled = false;
this.button_Body.Location = new System.Drawing.Point( 450, 12 );
this.button_Body.Name = "button_Body";
this.button_Body.Size = new System.Drawing.Size( 42, 23 );
this.button_Body.TabIndex = 10;
this.button_Body.Text = "cube";
this.button_Body.Click += new System.EventHandler( this.button_Body_Click );
//
// button_Sphere
//
this.button_Sphere.Anchor = ( ( System.Windows.Forms.AnchorStyles )( ( System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right ) ) );
this.button_Sphere.Enabled = false;
this.button_Sphere.Location = new System.Drawing.Point( 450, 41 );
this.button_Sphere.Name = "button_Sphere";
this.button_Sphere.Size = new System.Drawing.Size( 42, 23 );
this.button_Sphere.TabIndex = 11;
this.button_Sphere.Text = "sphere";
this.button_Sphere.Click += new System.EventHandler( this.button_Sphere_Click );
//
// warp3D1
//
this.warp3D1.Anchor = ( ( System.Windows.Forms.AnchorStyles )( ( ( ( System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom )
| System.Windows.Forms.AnchorStyles.Left )
| System.Windows.Forms.AnchorStyles.Right ) ) );
this.warp3D1.Location = new System.Drawing.Point( 12, 12 );
this.warp3D1.Name = "warp3D1";
this.warp3D1.Size = new System.Drawing.Size( 429, 462 );
this.warp3D1.TabIndex = 0;
//
// label1
//
this.label1.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point( 12, 542 );
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size( 351, 13 );
this.label1.TabIndex = 12;
this.label1.Text = "Use the mouse to rotate the scene. Hold down control to zoom in and out.";
//
// Warp
//
this.AutoScaleDimensions = new System.Drawing.SizeF( 6F, 13F );
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size( 503, 564 );
this.Controls.Add( this.label1 );
this.Controls.Add( this.button_Sphere );
this.Controls.Add( this.button_Body );
this.Controls.Add( this.button_Physics );
this.Controls.Add( this.button_Studio );
this.Controls.Add( this.button_Bounce );
this.Controls.Add( this.button_Stones );
this.Controls.Add( this.button_Flare1 );
this.Controls.Add( this.Load_Scene );
this.Controls.Add( this.warp3D1 );
this.Name = "Warp";
this.Text = "Warp Demos";
this.Load += new System.EventHandler( this.Form1_Load );
this.ResumeLayout( false );
this.PerformLayout();
}
#endregion
private Warp3D.Warp3D warp3D1;
private System.Windows.Forms.Button Load_Scene;
private System.Windows.Forms.Button button_Flare1;
private System.Windows.Forms.Button button_Stones;
private System.Windows.Forms.Button button_Bounce;
private System.Windows.Forms.Button button_Studio;
private System.Windows.Forms.Button button_Physics;
private System.Windows.Forms.Button button_Body;
private System.Windows.Forms.Button button_Sphere;
private System.Windows.Forms.Label label1;
}
}
-476
View File
@@ -1,476 +0,0 @@
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using MCI;
using Ode;
namespace TestWarp
{
public partial class Warp : Form
{
/*
* ODE stuff
*/
protected Ode.World _world= new Ode.World();
protected Ode.Space _space = new Ode.HashSpace();
protected Ode.JointGroup _contactGroup = new Ode.JointGroup();
private Ode.CollideHandler collideCallback;
protected Ode.Geom _floor;
protected PlaneGeom[] _walls;
private const int HALF_WIDTH = 256;
private const int HALF_LENGTH = 256;
protected bool _useStepFast = false;
private const float MAX_STEP_SIZE = 0.1f;
private DateTime lastframe = DateTime.MinValue;
private double leftOverTime = 0;
protected bool pauseSim;
Ode.Vector3 _prevpos = new Vector3();
int _bodyIndex = 0;
Body[] _body = new Body[ 500 ];
Geom _geom;
/*
* End
*/
private Media media = new Media();
Timer Clock;
enum State
{
demo1, demo2, demo3, demo4, demo5, demo6
}
State _state = State.demo1;
public Warp()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
warp3D1.DisplayDefaultScene();
//media.PlayWavResource( "tunes.Bass_Is_Extra_90bpm.wav" );
Clock = new Timer();
Clock.Interval = 50;
Clock.Tick += new EventHandler( Timer_Tick );
Clock.Start();
}
public void Timer_Tick( object sender, EventArgs eArgs )
{
if ( sender == Clock )
{
switch (_state)
{
case State.demo1:
warp3D1.RotateObject( "LensFlare1", -.05f, -.15f, -.05f );
warp3D1.RotateScene( .05f, .05f, .05f );
break;
case State.demo6:
UpdateWorld();
for ( int q = 0; q < _body.Length; q++ )
{
if ( _body[ q ] != null )
{
Ode.Vector3 pos = _body[ q ].Position;
warp3D1.RotateSelf( "cube"+q, OdeWarpHelpers.Ode2WarpQuaternion( _body[ q ].Quaternion ) );
warp3D1.SetPos( "cube" + q, pos.X, pos.Y, pos.Z );
}
}
break;
case State.demo4:
warp3D1.RotateModelSelf( "satellite", -.15f, -.15f, -.15f );
warp3D1.RotateModel( "satellite", -.02f, -.02f, -.02f );
break;
case State.demo3:
case State.demo2:
warp3D1.RotateScene( .05f, .05f, .05f );
break;
}
warp3D1.Render();
warp3D1.Refresh();
}
}
private void Load_Scene_Click(object sender, EventArgs e)
{
_state = State.demo1;
warp3D1.CreateScene(512, 512);
warp3D1.SetBackgroundColor( 0xECE9D8 );
Hashtable objects = warp3D1.Import3Ds( "chair", "DesignerChair3.3ds", true );
warp3D1.AddLight("Light1", -1f, -1f, -1f, 0xffffff, 320, 200);
warp3D1.AddLight("Light2", .2f, .2f, 1f, 0xffffff, 320, 200);
warp3D1.AddMaterial("seat");
warp3D1.SetTexture("seat", "glass.jpg");
warp3D1.SetReflectivity("seat", 80);
warp3D1.SetTransparency("seat", 180);
warp3D1.SetWireframe( "seat", true );
warp3D1.AddMaterial("wood");
warp3D1.SetTexture("wood", "cream.jpg");
warp3D1.SetReflectivity("wood", 100);
warp3D1.AddMaterial("strut");
warp3D1.SetTexture("strut", "chrome.jpg");
warp3D1.SetReflectivity("strut", 255);
warp3D1.SetEnvMap("strut", "skymap.jpg");
warp3D1.SetObjectMaterial("chair_Object", "seat");
warp3D1.SetObjectMaterial( "chair_Object", "seat" );
warp3D1.SetObjectMaterial( "chair_Object01", "wood" );
warp3D1.SetObjectMaterial( "chair_Object02", "wood" );
warp3D1.SetObjectMaterial( "chair_Object03", "strut" );
warp3D1.SetObjectMaterial( "chair_Object04", "strut" );
warp3D1.SetObjectMaterial( "chair_Object05", "strut" );
warp3D1.SetObjectMaterial( "chair_Object06", "strut" );
warp3D1.SetObjectMaterial( "chair_Object07", "strut" );
warp3D1.SetObjectMaterial( "chair_Object08", "strut" );
warp3D1.SetObjectMaterial( "chair_Object09", "strut" );
warp3D1.NormaliseScene();
warp3D1.Render();
warp3D1.Refresh();
}
private void button_Flare1_Click( object sender, EventArgs e )
{
_state = State.demo2;
warp3D1.CreateScene( 512, 512 );
warp3D1.SetBackgroundMaterial( "stardust.material" );
warp3D1.AddMaterial( "metal" );
warp3D1.SetEnvMap( "metal", "chrome.jpg" );
warp3D1.SetReflectivity( "metal", 255 );
warp3D1.AddLight( "Light1", 0.2f, 0.2f, 1f, 0xffffff, 320, 80 );
Hashtable objects = warp3D1.Import3Ds( "wobble", "wobble.3ds", true );
foreach ( DictionaryEntry myDE in objects )
{
string name = (string)myDE.Key;
warp3D1.SetObjectMaterial( name, "metal" );
}
warp3D1.AddLensFlare("LensFlare1");
warp3D1.NormaliseScene();
warp3D1.ScaleObject( "LensFlare1", 60f );
warp3D1.ScaleScene( 0.5f, 0.5f, 0.5f );
warp3D1.Render();
warp3D1.Refresh();
}
private void button_Stones_Click( object sender, EventArgs e )
{
_state = State.demo3;
warp3D1.CreateScene( 512, 512 );
warp3D1.SetBackgroundColor( 0xECE9D8 );
warp3D1.AddMaterial( "Stone1" );
warp3D1.SetTexture( "Stone1", "stone1.jpg" );
warp3D1.AddMaterial( "Stone2" );
warp3D1.SetTexture( "Stone2", "stone2.jpg" );
warp3D1.AddMaterial( "Stone3" );
warp3D1.SetTexture( "Stone3", "stone3.jpg" );
warp3D1.AddMaterial( "Stone4" );
warp3D1.SetTexture( "Stone4", "stone4.jpg" );
warp3D1.AddLight( "Light1", 0.2f, 0.2f, 1f , 0xFFFFFF, 144, 120 );
warp3D1.AddLight( "Light2", -1f, -1f, 1f , 0x332211, 100, 40 );
warp3D1.AddLight( "Light3", -1f, -1f, 1f , 0x666666, 200, 120 );
Hashtable objects = warp3D1.Import3Ds( "wobble", "wobble.3ds", true );
foreach ( DictionaryEntry myDE in objects )
{
string name = ( string )myDE.Key;
warp3D1.ProjectFrontal( name );
}
warp3D1.SetObjectMaterial( "wobble_Sphere1", "Stone1" );
warp3D1.SetObjectMaterial( "wobble_Wobble1", "Stone2" );
warp3D1.SetObjectMaterial( "wobble_Wobble2", "Stone3" );
warp3D1.SetObjectMaterial( "wobble_Wobble3", "Stone4" );
warp3D1.NormaliseScene();
warp3D1.ShiftObject( "Wobble3", 55f, 1f, 1f );
warp3D1.ScaleScene( 0.5f, 0.5f, 0.5f );
warp3D1.Render();
warp3D1.Refresh();
}
private void button_Bounce_Click( object sender, EventArgs e )
{
_state = State.demo4;
warp3D1.CreateScene( 512, 512 );
warp3D1.SetBackgroundMaterial( "stardust.material" );
warp3D1.AddMaterial( "earth" );
warp3D1.SetTexture( "earth", "land_shallow_topo_1024.jpg" );
warp3D1.SetReflectivity( "earth", 200 );
warp3D1.AddMaterial( "panel" );
warp3D1.SetTexture( "panel", "icesolar.JPG" );
warp3D1.SetReflectivity( "panel", 225 );
warp3D1.AddLight( "Light1", 0.2f, 0.2f, 1f, 0xFFFFFF, 144, 120 );
warp3D1.AddLight( "Light2", -1f, -1f, 1f, 0x332211, 100, 40 );
warp3D1.AddLight( "Light3", -1f, -1f, 1f, 0x666666, 200, 120 );
Hashtable objects = warp3D1.Import3Ds( "satellite", "voyager.3ds", true );
foreach ( DictionaryEntry myDE in objects )
{
string name = ( string )myDE.Key;
warp3D1.SetObjectMaterial( name, "panel" );
}
warp3D1.ScaleModel( "satellite", .002f );
warp3D1.TranslateModel( "satellite", .66f,.66f,0f );
warp3D1.AddSphere( "Sphere1", .65f, 32 );
warp3D1.SetObjectMaterial( "Sphere1", "earth" );
warp3D1.Render();
warp3D1.Refresh();
Clock.Start();
}
private void button_Studio_Click( object sender, EventArgs e )
{
_state = State.demo5;
warp3D1.CreateScene( 512, 512 );
warp3D1.SetBackgroundColor( 0xECE9D8 );
warp3D1.AddMaterial( "panel" );
warp3D1.SetTexture( "panel", "voyager.jpg" );
warp3D1.SetReflectivity( "panel", 225 );
warp3D1.AddMaterial( "default" );
warp3D1.SetReflectivity( "default", 225 );
warp3D1.SetTexture( "default", "chrome.jpg" );
warp3D1.AddLight( "Light1", 0f, 0f, 1f, 0xFFFFFF, 320, 120 );
Hashtable objects = warp3D1.Import3Ds( "voyager", "voyager.3ds", true );
foreach ( DictionaryEntry myDE in objects )
{
string name = ( string )myDE.Key;
warp3D1.SetObjectMaterial( name, "default" );
}
warp3D1.SetObjectMaterial( "voyager_Plaque", "panel" );
warp3D1.NormaliseScene();
}
private void button_Physics_Click( object sender, EventArgs e )
{
_state = State.demo6;
warp3D1.CreateScene( 512, 512 );
warp3D1.SetBackgroundColor( 0xECE9D8 );
warp3D1.AddMaterial( "default", 0x00dd00 );
warp3D1.SetReflectivity( "default", 255 );
warp3D1.AddMaterial( "yellow", 0xffff00 );
warp3D1.SetReflectivity( "yellow", 200 );
warp3D1.AddMaterial( "floor", 0xcccccc );
warp3D1.AddPlane("plane1", 10f);
warp3D1.SetObjectMaterial("plane1", "floor");
warp3D1.AddLight( "Light1", 0.2f, 0.2f, 1f, 0xFFFFFF, 144, 120 );
warp3D1.AddLight( "Light2", -1f, 0f, 0f, 0x332211, 100, 40 );
warp3D1.AddLight( "Light3", 1f, 0f, 0f, 0x666666, 200, 120 );
warp3D1.AddCube( "cube0", 2f );
warp3D1.SetObjectMaterial( "cube0", "default" );
_world.SetGravity( 0, -9.81f, 0 );
_world.CFM = 1e-6f;
_floor = new Ode.PlaneGeom( _space, 0, 1, 0, 0 );
collideCallback = new Ode.CollideHandler( this.CollideCallback );
_walls = new PlaneGeom[ 4 ];
_walls[ 0 ] = new PlaneGeom( _space, 1, 0, 0, -10 );
_walls[ 1 ] = new PlaneGeom( _space, -1, 0, 0, -10 );
_walls[ 2 ] = new PlaneGeom( _space, 0, 0, 1, -10 );
_walls[ 3 ] = new PlaneGeom( _space, 0, 0, -1, -10 );
InitialiseWorld();
warp3D1.ShiftDefaultCamera( 0f, 0f, -20f );
button_Body.Enabled = true;
button_Sphere.Enabled = true;
}
protected virtual void CollideCallback( Ode.Geom o1, Ode.Geom o2 )
{
ContactGeom[] cgeoms = o1.Collide( o2, 30 );
if ( cgeoms.Length > 0 )
{
Contact[] contacts = Contact.FromContactGeomArray( cgeoms );
for ( int i = 0; i < contacts.Length; i++ )
{
contacts[ i ].Surface.mode = SurfaceMode.Bounce;
contacts[ i ].Surface.mu = 100; //World.Infinity;
contacts[ i ].Surface.bounce = 0.70f;
contacts[ i ].Surface.bounce_vel = 0.05f;
ContactJoint cj = new ContactJoint( _world, _contactGroup, contacts[ i ] );
cj.Attach( contacts[ i ].Geom.Geom1.Body, contacts[ i ].Geom.Geom2.Body );
}
}
}
private void UpdateWorld()
{
if ( lastframe == DateTime.MinValue || pauseSim )
{
lastframe = DateTime.Now;
return;
}
DateTime thisframe = DateTime.Now;
TimeSpan elapsed = thisframe - lastframe;
float t = ( float )( elapsed.TotalSeconds + leftOverTime );
float st;
if ( t == 0 )
return;
while ( t > 0.02 )
{
if ( t > MAX_STEP_SIZE )
{
st = MAX_STEP_SIZE;
t -= MAX_STEP_SIZE;
}
else
{
st = t;
t = 0;
}
_contactGroup.Empty();
UpdateWorldForces( st );
_space.Collide( collideCallback );
if ( _useStepFast )
_world.StepFast1( st, 5 );
else
_world.Step( st );
}
leftOverTime = t;
lastframe = thisframe;
}
protected void InitialiseWorld()
{
Mass mass;
mass = new Mass();
mass.SetBox( 500.0f, 2f, 2f, 2f );
_body[_bodyIndex] = new Body( _world );
_body[_bodyIndex].Position = new Ode.Vector3( 0, 8, 0 );
_body[ _bodyIndex ].SetMass( mass );
_body[_bodyIndex].Geoms.Add( new BoxGeom( _space, 2f, 2f, 2f ) );
}
protected void RenderWorld()
{
}
protected void UpdateWorldForces( double stepSize )
{
// eg _body[n].AddForce( new Ode.Vector3( 0, 0, 1.0f ) );
}
private void button_Body_Click( object sender, EventArgs e )
{
if ( _state != State.demo6 )
{
return;
}
_bodyIndex++;
warp3D1.AddCube( "cube" + _bodyIndex, 2f );
warp3D1.SetObjectMaterial( "cube" + _bodyIndex, "default" );
_body[ _bodyIndex ] = new Body( _world );
_body[ _bodyIndex ].Position = new Ode.Vector3( 0, 8, 0 );
_body[ _bodyIndex ].Geoms.Add( new BoxGeom( _space, 2f, 2f, 2f ) );
}
private void button_Sphere_Click( object sender, EventArgs e )
{
if ( _state != State.demo6 )
{
return;
}
_bodyIndex++;
warp3D1.AddSphere( "cube" + _bodyIndex, 1f, 24 );
warp3D1.SetObjectMaterial( "cube" + _bodyIndex, "yellow" );
_body[ _bodyIndex ] = new Body( _world );
_body[ _bodyIndex ].Position = new Ode.Vector3( 0, 8, 0 );
_body[ _bodyIndex ].Geoms.Add( new SphereGeom(_space, 1f));
}
private void button_Cancel_Click( object sender, EventArgs e )
{
}
}
}
-117
View File
@@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
-224
View File
@@ -1,224 +0,0 @@
'using System;
'using System.Runtime.InteropServices;
'using System.Text;
'using System.IO;
Imports System.Text
Namespace MCI
Public Delegate Sub PositionEventHandler(ByVal sender As Object, ByVal e As PositionChangedEventArgs)
Public Class Media
Private timer1 As System.Windows.Forms.Timer
Public FileIsOpen As Boolean = False
Public PositionChanged As PositionEventHandler
Private Declare Auto Function PlaySound Lib "winmm.dll" (ByVal data() As Byte, ByVal hMod As IntPtr, ByVal dwFlags As Integer) As Long
Private Declare Auto Function mciSendString Lib "winmm.dll" (ByVal strCommand As String, ByRef strReturn As String, ByRef iReturnLength As Integer, ByVal hwndCallback As IntPtr) As Long
' Private Declare Auto Function mciSendString Lib "winmm.dll" (ByVal strCommand As String, ByVal strReturn As StringBuilder, ByVal iReturnLength As Integer, ByVal hwndCallback As IntPtr) As Long
'<DllImport("winmm.dll")> _
' Private Shared Function mciSendString(ByVal strCommand As String, ByVal strReturn As StringBuilder, ByVal iReturnLength As Integer, ByVal hwndCallback As IntPtr) As Long
' <DllImport("Winmm.dll")> _
' Private Shared Function PlaySound(ByVal data() As Byte, ByVal hMod As IntPtr, ByVal dwFlags As UInt32) As Long
Private sCommand As String
Private sBuffer As String 'New StringBuilder(128)
Private m_Repeat As Boolean = False
Private m_Pause As Boolean = False
Private seconds As Integer
Public Sub New()
timer1 = New System.Windows.Forms.Timer()
timer1.Enabled = False
timer1.Interval = 100
AddHandler timer1.Tick, AddressOf Me.timer1_Tick
End Sub
Private Sub timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs)
Dim pArgs As New PositionChangedEventArgs(Me.Position)
If PositionChanged IsNot Nothing Then PositionChanged(Me, pArgs)
End Sub
Public Sub Close()
sCommand = "close MediaFile"
mciSendString(sCommand, Nothing, 0, IntPtr.Zero)
timer1.Enabled = False
FileIsOpen = False
End Sub
Public Sub [Stop]()
Me.Position = 0
sCommand = "stop MediaFile"
mciSendString(sCommand, Nothing, 0, IntPtr.Zero)
timer1.Enabled = False
End Sub
Public Property Pause() As Boolean
Get
Return m_Pause
End Get
Set(ByVal value As Boolean)
m_Pause = value
If m_Pause Then
sCommand = "pause MediaFile"
Else
sCommand = "resume MediaFile"
End If
mciSendString(sCommand, Nothing, 0, IntPtr.Zero)
End Set
End Property
Public Sub Open(ByVal sFileName As String)
If Me.Status() = "playing" Then Me.Close()
sCommand = "open """ + sFileName + """ type mpegvideo alias MediaFile"
mciSendString(sCommand, Nothing, 0, IntPtr.Zero)
FileIsOpen = True
End Sub
Public Sub Open(ByVal sFileName As String, ByVal videobox As System.Windows.Forms.PictureBox)
If Me.Status = "playing" Then Me.Close()
sCommand = "open """ & sFileName & """ type mpegvideo alias MediaFile style child parent " & videobox.Handle.ToInt32()
mciSendString(sCommand, Nothing, 0, IntPtr.Zero)
sCommand = "put MediaFile window at 0 0 " & videobox.Width & " " & videobox.Height
mciSendString(sCommand, Nothing, 0, IntPtr.Zero)
FileIsOpen = True
End Sub
Public Sub Play()
If FileIsOpen Then
sCommand = "play MediaFile"
If Repeat Then sCommand += " REPEAT"
mciSendString(sCommand, Nothing, 0, IntPtr.Zero)
timer1.Enabled = True
End If
End Sub
Public Sub FullScreen()
sCommand = "play MediaFile FullScreen"
mciSendString(sCommand, Nothing, 0, IntPtr.Zero)
End Sub
Public Property Position() As Integer
Get
sCommand = "status MediaFile position"
mciSendString(sCommand, sBuffer, Nothing, IntPtr.Zero)
' mciSendString(sCommand, sBuffer, sBuffer.Capacity, IntPtr.Zero)
seconds = Integer.Parse(sBuffer.ToString())
seconds = seconds \ 1000
Return seconds
End Get
Set(ByVal value As Integer)
seconds = value
seconds = seconds * 1000
sCommand = "play MediaFile from " & seconds.ToString()
mciSendString(sCommand, Nothing, 0, IntPtr.Zero)
End Set
End Property
Public Function Duration() As Integer
Dim ReturnSeconds As Integer
sCommand = "status MediaFile length"
sBuffer = Space(128)
mciSendString(sCommand, sBuffer, 128, IntPtr.Zero)
ReturnSeconds = Integer.Parse(sBuffer.ToString())
ReturnSeconds = ReturnSeconds \ 1000
Return ReturnSeconds
End Function
Public Function Status() As String
mciSendString("status MediaFile mode", sBuffer, Nothing, IntPtr.Zero)
' mciSendString(sCommand, sBuffer, sBuffer.Capacity, IntPtr.Zero)
Return sBuffer.ToString()
End Function
Public Property Volume() As Integer
Get
If Me.Status() <> String.Empty Then
mciSendString("status MediaFile volume", sBuffer, Nothing, IntPtr.Zero)
' mciSendString(sCommand, sBuffer, sBuffer.Capacity, IntPtr.Zero)
Return Integer.Parse(sBuffer.ToString())
Else
Return 0
End If
End Get
Set(ByVal value As Integer)
If value <= 1000 Then
mciSendString("setaudio MediaFile volume to " & value.ToString(), Nothing, 0, IntPtr.Zero)
Else
System.Windows.Forms.MessageBox.Show("Volume value must be smaller than 1000")
End If
End Set
End Property
Public Property Repeat() As Boolean
Get
Return m_Repeat
End Get
Set(ByVal value As Boolean)
m_Repeat = value
End Set
End Property
Public Function SecondsToTime(ByVal seconds As Integer) As String
Dim hours, minutes As Integer
hours = seconds \ 3600
minutes = seconds \ 60
minutes = minutes Mod 60
seconds = seconds Mod 60
Return hours.ToString("00") & ":" & minutes.ToString("00") & ":" & seconds.ToString("00")
End Function
Public Sub PlayWavResource(ByVal wav As String)
'// get the namespace
Dim strNameSpace As String = System.Reflection.Assembly.GetExecutingAssembly().GetName.Name
'// get the resource into a stream
Dim Str As IO.Stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(strNameSpace & "." & wav)
If Str Is Nothing Then Return
'// bring stream into a byte array
Dim bStr(CInt(Str.Length - 1)) As Byte
Str.Read(bStr, 0, CInt(Str.Length))
'// play the resource
PlaySound(bStr, IntPtr.Zero, 1 Or 4 Or 8)
End Sub
End Class
Public Class PositionChangedEventArgs
Inherits EventArgs
Private _position As Integer
Public Sub New(ByVal num As Integer)
Me._position = num
End Sub
Public ReadOnly Property newPosition() As Integer
Get
Return _position
End Get
End Property
End Class
End Namespace
-160
View File
@@ -1,160 +0,0 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class MainForm
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.label1 = New System.Windows.Forms.Label
Me.button_Sphere = New System.Windows.Forms.Button
Me.button_Body = New System.Windows.Forms.Button
Me.button_Physics = New System.Windows.Forms.Button
Me.button_Studio = New System.Windows.Forms.Button
Me.button_Bounce = New System.Windows.Forms.Button
Me.button_Stones = New System.Windows.Forms.Button
Me.button_Flare1 = New System.Windows.Forms.Button
Me.Load_Scene = New System.Windows.Forms.Button
Me.warp3D1 = New Warp3DVB.Warp3D.Warp3D
Me.SuspendLayout()
'
'label1
'
Me.label1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.label1.AutoSize = True
Me.label1.Location = New System.Drawing.Point(9, 446)
Me.label1.Name = "label1"
Me.label1.Size = New System.Drawing.Size(355, 13)
Me.label1.TabIndex = 22
Me.label1.Text = "Use the mouse to rotate the scene. Hold down control to zoom in and out."
'
'button_Sphere
'
Me.button_Sphere.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.button_Sphere.Enabled = False
Me.button_Sphere.Location = New System.Drawing.Point(488, 41)
Me.button_Sphere.Name = "button_Sphere"
Me.button_Sphere.Size = New System.Drawing.Size(42, 23)
Me.button_Sphere.TabIndex = 21
Me.button_Sphere.Text = "sphere"
'
'button_Body
'
Me.button_Body.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.button_Body.Enabled = False
Me.button_Body.Location = New System.Drawing.Point(488, 12)
Me.button_Body.Name = "button_Body"
Me.button_Body.Size = New System.Drawing.Size(42, 23)
Me.button_Body.TabIndex = 20
Me.button_Body.Text = "cube"
'
'button_Physics
'
Me.button_Physics.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.button_Physics.Location = New System.Drawing.Point(414, 420)
Me.button_Physics.Name = "button_Physics"
Me.button_Physics.Size = New System.Drawing.Size(75, 23)
Me.button_Physics.TabIndex = 19
Me.button_Physics.Text = "Physics"
'
'button_Studio
'
Me.button_Studio.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.button_Studio.Location = New System.Drawing.Point(333, 420)
Me.button_Studio.Name = "button_Studio"
Me.button_Studio.Size = New System.Drawing.Size(75, 23)
Me.button_Studio.TabIndex = 18
Me.button_Studio.Text = "3Ds"
'
'button_Bounce
'
Me.button_Bounce.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.button_Bounce.Location = New System.Drawing.Point(252, 420)
Me.button_Bounce.Name = "button_Bounce"
Me.button_Bounce.Size = New System.Drawing.Size(75, 23)
Me.button_Bounce.TabIndex = 17
Me.button_Bounce.Text = "Objects"
'
'button_Stones
'
Me.button_Stones.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.button_Stones.Location = New System.Drawing.Point(171, 420)
Me.button_Stones.Name = "button_Stones"
Me.button_Stones.Size = New System.Drawing.Size(75, 23)
Me.button_Stones.TabIndex = 16
Me.button_Stones.Text = "Stones"
'
'button_Flare1
'
Me.button_Flare1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.button_Flare1.Location = New System.Drawing.Point(90, 420)
Me.button_Flare1.Name = "button_Flare1"
Me.button_Flare1.Size = New System.Drawing.Size(75, 23)
Me.button_Flare1.TabIndex = 15
Me.button_Flare1.Text = "Flare"
'
'Load_Scene
'
Me.Load_Scene.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.Load_Scene.Location = New System.Drawing.Point(9, 420)
Me.Load_Scene.Name = "Load_Scene"
Me.Load_Scene.Size = New System.Drawing.Size(75, 23)
Me.Load_Scene.TabIndex = 14
Me.Load_Scene.Text = "Chair"
'
'warp3D1
'
Me.warp3D1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.warp3D1.Location = New System.Drawing.Point(12, 12)
Me.warp3D1.Name = "warp3D1"
Me.warp3D1.Size = New System.Drawing.Size(470, 402)
Me.warp3D1.TabIndex = 13
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(542, 468)
Me.Controls.Add(Me.label1)
Me.Controls.Add(Me.button_Sphere)
Me.Controls.Add(Me.button_Body)
Me.Controls.Add(Me.button_Physics)
Me.Controls.Add(Me.button_Studio)
Me.Controls.Add(Me.button_Bounce)
Me.Controls.Add(Me.button_Stones)
Me.Controls.Add(Me.button_Flare1)
Me.Controls.Add(Me.Load_Scene)
Me.Controls.Add(Me.warp3D1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Private WithEvents label1 As System.Windows.Forms.Label
Private WithEvents button_Sphere As System.Windows.Forms.Button
Private WithEvents button_Body As System.Windows.Forms.Button
Private WithEvents button_Physics As System.Windows.Forms.Button
Private WithEvents button_Studio As System.Windows.Forms.Button
Private WithEvents button_Bounce As System.Windows.Forms.Button
Private WithEvents button_Stones As System.Windows.Forms.Button
Private WithEvents button_Flare1 As System.Windows.Forms.Button
Private WithEvents Load_Scene As System.Windows.Forms.Button
Private WithEvents warp3D1 As Warp3DVB.Warp3D.Warp3D
End Class
@@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
-412
View File
@@ -1,412 +0,0 @@
Public Class MainForm
' /*
' * ODE stuff
' */
Protected _world As New Ode.World()
Protected _space As Ode.Space = New Ode.HashSpace()
Protected _contactGroup As New Ode.JointGroup()
Private collideCallback As Ode.CollideHandler
Protected _floor As Ode.Geom
Protected _walls As Ode.PlaneGeom()
Private Const HALF_WIDTH As Integer = 256
Private Const HALF_LENGTH As Integer = 256
Protected _useStepFast As Boolean = False
Private Const MAX_STEP_SIZE As Single = 0.1F
Private lastframe As DateTime = DateTime.MinValue
Private leftOverTime As Single = 0
Protected pauseSim As Boolean
Private _prevpos As New Ode.Vector3
Private _bodyIndex As Integer = 0
Private _body(499) As Ode.Body
Private _geom As Ode.Geom
'/*
' * End
' */
' Private media As New MCI.Media()
Private WithEvents Clock As Timer
Enum State
demo1
demo2
demo3
demo4
demo5
demo6
End Enum
Private _state As State = State.demo1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
warp3D1.DisplayDefaultScene()
'//media.PlayWavResource( "tunes.Bass_Is_Extra_90bpm.wav" );
Clock = New Timer()
Clock.Interval = 50
Clock.Start()
End Sub
Public Sub Timer_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Clock.Tick
If sender Is Clock Then
Select Case _state
Case State.demo1
warp3D1.RotateObject("LensFlare1", -0.05F, -0.15F, -0.05F)
warp3D1.RotateScene(0.05F, 0.05F, 0.05F)
Case State.demo6
UpdateWorld()
For q As Integer = 0 To _body.Length - 1
If _body(q) IsNot Nothing Then
Dim pos As Ode.Vector3 = _body(q).Position
warp3D1.RotateSelf("cube" & q, OdeWarpHelpers.Ode2WarpQuaternion(_body(q).Quaternion))
warp3D1.SetPos("cube" & q, pos.X, pos.Y, pos.Z)
End If
Next
Case State.demo4
warp3D1.RotateModelSelf("satellite", -0.15F, -0.15F, -0.15F)
warp3D1.RotateModel("satellite", -0.02F, -0.02F, -0.02F)
Case State.demo3
Case State.demo2
warp3D1.RotateScene(0.05F, 0.05F, 0.05F)
End Select
warp3D1.Render()
warp3D1.Refresh()
End If
End Sub
Private Sub Load_Scene_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Load_Scene.Click
_state = State.demo1
warp3D1.CreateScene(512, 512)
warp3D1.SetBackgroundColor(&HECE9D8)
Dim objects As Collections.Hashtable = warp3D1.Import3Ds("chair", "DesignerChair3.3ds", True)
warp3D1.AddLight("Light1", -1.0F, -1.0F, -1.0F, &HFFFFFF, 320, 200)
warp3D1.AddLight("Light2", 0.2F, 0.2F, 1.0F, &HFFFFFF, 320, 200)
warp3D1.AddMaterial("seat")
warp3D1.SetTexture("seat", "glass.jpg")
warp3D1.SetReflectivity("seat", 80)
warp3D1.SetTransparency("seat", 180)
warp3D1.SetWireframe("seat", True)
warp3D1.AddMaterial("wood")
warp3D1.SetTexture("wood", "cream.jpg")
warp3D1.SetReflectivity("wood", 100)
warp3D1.AddMaterial("strut")
warp3D1.SetTexture("strut", "chrome.jpg")
warp3D1.SetReflectivity("strut", 255)
warp3D1.SetEnvMap("strut", "skymap.jpg")
warp3D1.SetObjectMaterial("chair_Object", "seat")
warp3D1.SetObjectMaterial("chair_Object", "seat")
warp3D1.SetObjectMaterial("chair_Object01", "wood")
warp3D1.SetObjectMaterial("chair_Object02", "wood")
warp3D1.SetObjectMaterial("chair_Object03", "strut")
warp3D1.SetObjectMaterial("chair_Object04", "strut")
warp3D1.SetObjectMaterial("chair_Object05", "strut")
warp3D1.SetObjectMaterial("chair_Object06", "strut")
warp3D1.SetObjectMaterial("chair_Object07", "strut")
warp3D1.SetObjectMaterial("chair_Object08", "strut")
warp3D1.SetObjectMaterial("chair_Object09", "strut")
warp3D1.NormaliseScene()
warp3D1.Render()
warp3D1.Refresh()
End Sub
Private Sub button_Flare1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button_Flare1.Click
_state = State.demo2
warp3D1.CreateScene(512, 512)
warp3D1.SetBackgroundMaterial("stardust.material")
warp3D1.AddMaterial("metal")
warp3D1.SetEnvMap("metal", "chrome.jpg")
warp3D1.SetReflectivity("metal", 255)
warp3D1.AddLight("Light1", 0.2F, 0.2F, 1.0F, &HFFFFFF, 320, 80)
Dim objects As Collections.Hashtable = warp3D1.Import3Ds("wobble", "wobble.3ds", True)
For Each myDE As DictionaryEntry In objects
Dim name As String = myDE.Key.ToString
warp3D1.SetObjectMaterial(name, "metal")
Next
warp3D1.AddLensFlare("LensFlare1")
warp3D1.NormaliseScene()
warp3D1.ScaleObject("LensFlare1", 60.0F)
warp3D1.ScaleScene(0.5F, 0.5F, 0.5F)
warp3D1.Render()
warp3D1.Refresh()
End Sub
Private Sub button_Stones_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button_Stones.Click
_state = State.demo3
warp3D1.CreateScene(512, 512)
warp3D1.SetBackgroundColor(&HECE9D8)
warp3D1.AddMaterial("Stone1")
warp3D1.SetTexture("Stone1", "stone1.jpg")
warp3D1.AddMaterial("Stone2")
warp3D1.SetTexture("Stone2", "stone2.jpg")
warp3D1.AddMaterial("Stone3")
warp3D1.SetTexture("Stone3", "stone3.jpg")
warp3D1.AddMaterial("Stone4")
warp3D1.SetTexture("Stone4", "stone4.jpg")
warp3D1.AddLight("Light1", 0.2F, 0.2F, 1.0F, &HFFFFFF, 144, 120)
warp3D1.AddLight("Light2", -1.0F, -1.0F, 1.0F, &H332211, 100, 40)
warp3D1.AddLight("Light3", -1.0F, -1.0F, 1.0F, &H666666, 200, 120)
Dim objects As Collections.Hashtable = warp3D1.Import3Ds("wobble", "wobble.3ds", True)
For Each myDE As DictionaryEntry In objects
Dim name As String = myDE.Key.ToString
warp3D1.ProjectFrontal(name)
Next
warp3D1.SetObjectMaterial("wobble_Sphere1", "Stone1")
warp3D1.SetObjectMaterial("wobble_Wobble1", "Stone2")
warp3D1.SetObjectMaterial("wobble_Wobble2", "Stone3")
warp3D1.SetObjectMaterial("wobble_Wobble3", "Stone4")
warp3D1.NormaliseScene()
warp3D1.ShiftObject("Wobble3", 55.0F, 1.0F, 1.0F)
warp3D1.ScaleScene(0.5F, 0.5F, 0.5F)
warp3D1.Render()
warp3D1.Refresh()
End Sub
Private Sub button_Bounce_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button_Bounce.Click
_state = State.demo4
warp3D1.CreateScene(512, 512)
warp3D1.SetBackgroundMaterial("stardust.material")
warp3D1.AddMaterial("earth")
warp3D1.SetTexture("earth", "land_shallow_topo_1024.jpg")
warp3D1.SetReflectivity("earth", 200)
warp3D1.AddMaterial("panel")
warp3D1.SetTexture("panel", "icesolar.JPG")
warp3D1.SetReflectivity("panel", 225)
warp3D1.AddLight("Light1", 0.2F, 0.2F, 1.0F, &HFFFFFF, 144, 120)
warp3D1.AddLight("Light2", -1.0F, -1.0F, 1.0F, &H332211, 100, 40)
warp3D1.AddLight("Light3", -1.0F, -1.0F, 1.0F, &H666666, 200, 120)
Dim objects As Collections.Hashtable = warp3D1.Import3Ds("satellite", "voyager.3ds", True)
For Each myDE As DictionaryEntry In objects
Dim name As String = myDE.Key.ToString
warp3D1.SetObjectMaterial(name, "panel")
Next
warp3D1.ScaleModel("satellite", 0.002F)
warp3D1.TranslateModel("satellite", 0.66F, 0.66F, 0.0F)
warp3D1.AddSphere("Sphere1", 0.65F, 32)
warp3D1.SetObjectMaterial("Sphere1", "earth")
warp3D1.Render()
warp3D1.Refresh()
Clock.Start()
End Sub
Private Sub button_Studio_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button_Studio.Click
_state = State.demo5
warp3D1.CreateScene(512, 512)
warp3D1.SetBackgroundColor(&HECE9D8)
warp3D1.AddMaterial("panel")
warp3D1.SetTexture("panel", "voyager.jpg")
warp3D1.SetReflectivity("panel", 225)
warp3D1.AddMaterial("default")
warp3D1.SetReflectivity("default", 225)
warp3D1.SetTexture("default", "chrome.jpg")
warp3D1.AddLight("Light1", 0.0F, 0.0F, 1.0F, &HFFFFFF, 320, 120)
Dim objects As Collections.Hashtable = warp3D1.Import3Ds("voyager", "voyager.3ds", True)
For Each myDE As DictionaryEntry In objects
Dim name As String = myDE.Key.ToString
warp3D1.SetObjectMaterial(name, "default")
Next
warp3D1.SetObjectMaterial("voyager_Plaque", "panel")
warp3D1.NormaliseScene()
End Sub
Private Sub button_Physics_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button_Physics.Click
_state = State.demo6
warp3D1.CreateScene(512, 512)
warp3D1.SetBackgroundColor(&HECE9D8)
warp3D1.AddMaterial("default", &HDD00)
warp3D1.SetReflectivity("default", 255)
warp3D1.AddMaterial("yellow", &HFFFF00)
warp3D1.SetReflectivity("yellow", 200)
warp3D1.AddMaterial("floor", &HCCCCCC)
warp3D1.AddPlane("plane1", 10.0F)
warp3D1.SetObjectMaterial("plane1", "floor")
warp3D1.AddLight("Light1", 0.2F, 0.2F, 1.0F, &HFFFFFF, 144, 120)
warp3D1.AddLight("Light2", -1.0F, 0.0F, 0.0F, &H332211, 100, 40)
warp3D1.AddLight("Light3", 1.0F, 0.0F, 0.0F, &H666666, 200, 120)
warp3D1.AddCube("cube0", 2.0F)
warp3D1.SetObjectMaterial("cube0", "default")
_world.SetGravity(0, -9.81F, 0)
_world.CFM = 0.000001F
_floor = New Ode.PlaneGeom(_space, 0, 1, 0, 0)
collideCallback = New Ode.CollideHandler(AddressOf Me.CollideCallbackHandler)
ReDim _walls(3)
_walls(0) = New Ode.PlaneGeom(_space, 1, 0, 0, -10)
_walls(1) = New Ode.PlaneGeom(_space, -1, 0, 0, -10)
_walls(2) = New Ode.PlaneGeom(_space, 0, 0, 1, -10)
_walls(3) = New Ode.PlaneGeom(_space, 0, 0, -1, -10)
InitialiseWorld()
warp3D1.ShiftDefaultCamera(0.0F, 0.0F, -20.0F)
button_Body.Enabled = True
button_Sphere.Enabled = True
End Sub
Protected Sub CollideCallbackHandler(ByVal o1 As Ode.Geom, ByVal o2 As Ode.Geom)
Dim cgeoms() As Ode.ContactGeom = o1.Collide(o2, 30)
If cgeoms.Length > 0 Then
Dim contacts() As Ode.Contact = Ode.Contact.FromContactGeomArray(cgeoms)
For i As Integer = 0 To contacts.Length - 1
contacts(i).Surface.mode = Ode.SurfaceMode.Bounce
contacts(i).Surface.mu = 100 '//World.Infinity
contacts(i).Surface.bounce = 0.7F
contacts(i).Surface.bounce_vel = 0.05F
Dim cj As Ode.ContactJoint = New Ode.ContactJoint(_world, _contactGroup, contacts(i))
cj.Attach(contacts(i).Geom.Geom1.Body, contacts(i).Geom.Geom2.Body)
Next
End If
End Sub
Private Sub UpdateWorld()
If lastframe = DateTime.MinValue Or pauseSim Then
lastframe = DateTime.Now
Return
End If
Dim thisframe As DateTime = DateTime.Now
Dim elapsed As TimeSpan = thisframe - lastframe
Dim t As Single = CSng(elapsed.TotalSeconds + leftOverTime)
Dim st As Single
If t = 0 Then Return
While (t > 0.02)
If t > MAX_STEP_SIZE Then
st = MAX_STEP_SIZE
t -= MAX_STEP_SIZE
Else
st = t
t = 0
End If
_contactGroup.Empty()
UpdateWorldForces(st)
_space.Collide(collideCallback)
If _useStepFast Then
_world.StepFast1(st, 5)
Else
_world.Step(st)
End If
End While
leftOverTime = t
lastframe = thisframe
End Sub
Protected Sub InitialiseWorld()
Dim mass As New Ode.Mass
mass.SetBox(500.0F, 2.0F, 2.0F, 2.0F)
_body(_bodyIndex) = New Ode.Body(_world)
_body(_bodyIndex).Position = New Ode.Vector3(0, 8, 0)
_body(_bodyIndex).SetMass(mass)
_body(_bodyIndex).Geoms.Add(New Ode.BoxGeom(_space, 2.0F, 2.0F, 2.0F))
End Sub
Protected Sub RenderWorld()
End Sub
Protected Sub UpdateWorldForces(ByVal stepSize As Single)
'// eg _body[n].AddForce( new Ode.Vector3( 0, 0, 1.0f ) );
End Sub
Private Sub button_Body_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button_Body.Click
If _state <> State.demo6 Then Return
_bodyIndex += 1
warp3D1.AddCube("cube" & _bodyIndex, 2.0F)
warp3D1.SetObjectMaterial("cube" & _bodyIndex, "default")
_body(_bodyIndex) = New Ode.Body(_world)
_body(_bodyIndex).Position = New Ode.Vector3(0, 8, 0)
_body(_bodyIndex).Geoms.Add(New Ode.BoxGeom(_space, 2.0F, 2.0F, 2.0F))
End Sub
Private Sub button_Sphere_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button_Sphere.Click
If _state <> State.demo6 Then Return
_bodyIndex += 1
warp3D1.AddSphere("cube" & _bodyIndex, 1.0F, 24)
warp3D1.SetObjectMaterial("cube" & _bodyIndex, "yellow")
_body(_bodyIndex) = New Ode.Body(_world)
_body(_bodyIndex).Position = New Ode.Vector3(0, 8, 0)
_body(_bodyIndex).Geoms.Add(New Ode.SphereGeom(_space, 1.0F))
End Sub
'Private Sub button_Cancel_Click(ByVal sender As Object, ByVal e As EventArgs)
'End Sub
End Class
@@ -1,38 +0,0 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:2.0.50727.42
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
'NOTE: This file is auto-generated; do not modify it directly. To make changes,
' or if you encounter build errors in this file, go to the Project Designer
' (go to Project Properties or double-click the My Project node in
' Solution Explorer), and make changes on the Application tab.
'
Partial Friend Class MyApplication
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Public Sub New()
MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
Me.IsSingleInstance = false
Me.EnableVisualStyles = true
Me.SaveMySettingsOnExit = true
Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
End Sub
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.TestWarpVB.MainForm
End Sub
End Class
End Namespace
@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>true</MySubMain>
<MainForm>MainForm</MainForm>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
</MyApplicationData>
@@ -1,35 +0,0 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("TestWarpVB")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("TestWarpVB")>
<Assembly: AssemblyCopyright("Copyright © 2006")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("d64bca87-8219-4262-abf7-02b863700961")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
@@ -1,63 +0,0 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:2.0.50727.42
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Imports System
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("TestWarpVB.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set
resourceCulture = value
End Set
End Property
End Module
End Namespace
@@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -1,73 +0,0 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:2.0.50727.42
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings),MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.TestWarpVB.My.MySettings
Get
Return Global.TestWarpVB.My.MySettings.Default
End Get
End Property
End Module
End Namespace
@@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
@@ -1,76 +0,0 @@
Imports System
Imports Warp3DVB.Rednettle.Warp3D ' Rednettle.Warp3D
'Namespace Ode
''' <summary>
''' Summary description for OdeDxHelpers.
''' </summary>
Public NotInheritable Class OdeWarpHelpers
Private Sub New()
End Sub
Public Shared Function Ode2WarpMatrix(ByVal m As Ode.Matrix3) As warp_Matrix
Dim result As New warp_Matrix()
result.m11 = m.m11
result.m12 = m.m12
result.m13 = m.m13
result.m21 = m.m21
result.m22 = m.m22
result.m23 = m.m23
result.m31 = m.m31
result.m32 = m.m32
result.m33 = m.m33
Return result
End Function
Public Shared Function Warp2OdeMatrix3(ByVal m As warp_Matrix) As Ode.Matrix3
Dim odeM As New Ode.Matrix3()
odeM.m11 = m.m11
odeM.m12 = m.m12
odeM.m13 = m.m13
odeM.m21 = m.m21
odeM.m22 = m.m22
odeM.m23 = m.m23
odeM.m31 = m.m31
odeM.m32 = m.m32
odeM.m33 = m.m33
Return odeM
End Function
Public Shared Function Ode2WarpQuaternion(ByVal odeQ As Ode.Quaternion) As warp_Quaternion
Dim q As New warp_Quaternion( _
odeQ.X, _
odeQ.Y, _
odeQ.Z, _
odeQ.W)
Return q
End Function
Public Shared Function Warp2OdeQuaternion(ByVal q As warp_Quaternion) As Ode.Quaternion
Dim odeQ As New Ode.Quaternion()
odeQ.W = q.W
odeQ.X = q.X
odeQ.Y = q.Y
odeQ.Z = q.Z
Return odeQ
End Function
Public Shared Function Ode2DxVector3(ByVal odeV As Ode.Vector3) As warp_Vector
Return New warp_Vector(odeV.X, odeV.Y, odeV.Z)
End Function
Public Shared Function Dx2OdeVector3(ByVal dxV As warp_Vector) As Ode.Vector3
Return New Ode.Vector3(dxV.x, dxV.y, dxV.z)
End Function
End Class
@@ -1,8 +0,0 @@
Public Module Program
<STAThread()> _
Sub Main()
Application.EnableVisualStyles()
Application.Run(New MainForm)
End Sub
End Module
@@ -1,167 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{6D814868-B5C5-4E0D-B798-71B3945CCBC1}</ProjectGuid>
<OutputType>WinExe</OutputType>
<StartupObject>TestWarpVB.My.MyApplication</StartupObject>
<RootNamespace>TestWarpVB</RootNamespace>
<AssemblyName>TestWarpVB</AssemblyName>
<MyType>WindowsForms</MyType>
<OptionStrict>On</OptionStrict>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>TestWarpVB.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>TestWarpVB.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Original|AnyCPU' ">
<OutputPath>bin\Original\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == '64Bit CPU%27s|AnyCPU' ">
<OutputPath>bin\64Bit CPU%27s\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<PlatformTarget>x64</PlatformTarget>
<OutputPath>bin\x64\Debug\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<PlatformTarget>x64</PlatformTarget>
<OutputPath>bin\x64\Release\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Original|x64' ">
<PlatformTarget>x64</PlatformTarget>
<OutputPath>bin\x64\Original\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == '64Bit CPU%27s|x64' ">
<PlatformTarget>x64</PlatformTarget>
<OutputPath>bin\x64\64Bit CPU%27s\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Slixel Tester|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Slixel Tester\</OutputPath>
<DocumentationFile>TestWarpVB.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisRuleAssemblies>\rules</CodeAnalysisRuleAssemblies>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.vb</CodeAnalysisModuleSuppressionsFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Slixel Tester|x64' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Slixel Tester\</OutputPath>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleAssemblies>\rules</CodeAnalysisRuleAssemblies>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.vb</CodeAnalysisModuleSuppressionsFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="ode, Version=1.1.2.33852, Culture=neutral">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\..\RealmForgeGDK-v0.6.2\RealmForgeGDK-v0.6.2\libs\ode.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Drawing" />
<Import Include="System.Diagnostics" />
<Import Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainForm.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.Designer.vb">
<DependentUpon>MainForm.vb</DependentUpon>
<SubType>Form</SubType>
</Compile>
<None Include="MCI.vb" />
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="OdeWarpHelpers.vb" />
<None Include="Program.vb" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="MainForm.resx">
<SubType>Designer</SubType>
<DependentUpon>MainForm.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
</None>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<CustomToolNamespace>My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Warp3DVB\Warp3DVB.vbproj">
<Project>{D6F7F49F-4A6F-41CF-9129-C71B66BFC506}</Project>
<Name>Warp3DVB</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -1,10 +0,0 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}
@@ -1,39 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Warp3D")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Warp3D")]
[assembly: AssemblyCopyright("Copyright © 2005")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AllowPartiallyTrustedCallers]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM componenets. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(true)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("20966a70-7851-4a8c-835c-1e7db2f313f9")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
-48
View File
@@ -1,48 +0,0 @@
namespace Warp3D
{
partial class Warp3D
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// Warp3D
//
this.AutoScaleDimensions = new System.Drawing.SizeF( 6F, 13F );
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Name = "Warp3D";
this.Size = new System.Drawing.Size( 172, 186 );
this.Load += new System.EventHandler( this.Warp3D_Load );
this.KeyUp += new System.Windows.Forms.KeyEventHandler( this.Warp3D_KeyUp );
this.KeyDown += new System.Windows.Forms.KeyEventHandler( this.Warp3D_KeyDown );
this.ResumeLayout( false );
}
#endregion
}
}
File diff suppressed because it is too large Load Diff
-157
View File
@@ -1,157 +0,0 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{6E48530B-16AB-4861-9CED-97334739D675}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Warp3D</RootNamespace>
<AssemblyName>Warp3D</AssemblyName>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RegisterForComInterop>true</RegisterForComInterop>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Original|AnyCPU' ">
<OutputPath>bin\Original\</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<RegisterForComInterop>true</RegisterForComInterop>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == '64Bit CPU%27s|AnyCPU' ">
<OutputPath>bin\64Bit CPU%27s\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RegisterForComInterop>true</RegisterForComInterop>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Original|x64' ">
<OutputPath>bin\x64\Original\</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<RegisterForComInterop>true</RegisterForComInterop>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == '64Bit CPU%27s|x64' ">
<OutputPath>bin\x64\64Bit CPU%27s\</OutputPath>
<PlatformTarget>x64</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Slixel Tester|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Slixel Tester\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RegisterForComInterop>true</RegisterForComInterop>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisRuleAssemblies>\rules</CodeAnalysisRuleAssemblies>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Slixel Tester|x64' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Slixel Tester\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RegisterForComInterop>true</RegisterForComInterop>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleAssemblies>\rules</CodeAnalysisRuleAssemblies>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_3ds_Importer.cs" />
<Compile Include="warp_Camera.cs" />
<Compile Include="warp_Color.cs" />
<Compile Include="warp_CoreObject.cs" />
<Compile Include="warp_Edge.cs" />
<Compile Include="warp_Environment.cs" />
<Compile Include="warp_FXLensFlare .cs" />
<Compile Include="warp_FXPlugin.cs" />
<Compile Include="warp_Light.cs" />
<Compile Include="warp_Lightmap.cs" />
<Compile Include="warp_Material.cs" />
<Compile Include="warp_Math.cs" />
<Compile Include="warp_Matrix.cs" />
<Compile Include="warp_Object.cs" />
<Compile Include="warp_ObjectFactory.cs" />
<Compile Include="warp_Quaternion.cs" />
<Compile Include="warp_Rasterizer.cs" />
<Compile Include="warp_RenderPipeline.cs" />
<Compile Include="warp_Scene.cs" />
<Compile Include="warp_Screen.cs" />
<Compile Include="warp_Texture.cs" />
<Compile Include="warp_TextureFactory.cs" />
<Compile Include="warp_TextureProjector.cs" />
<Compile Include="warp_TextureSettings.cs" />
<Compile Include="warp_Triangle.cs" />
<Compile Include="warp_Vector.cs" />
<Compile Include="warp_Vertex.cs" />
<Compile Include="Warp3D.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Warp3D.Designer.cs">
<DependentUpon>Warp3D.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Warp3D.resx">
<DependentUpon>Warp3D.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
@@ -1,10 +0,0 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}
-117
View File
@@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
-2
View File
@@ -1,2 +0,0 @@
#!/bin/bash
gmcs -unsafe -out:Warp3D.dll -target:library *.cs Properties/AssemblyInfo.cs -r:System.Drawing.dll -r:System.Data.dll -r:System.Windows.Forms.dll
@@ -1,212 +0,0 @@
using System;
using System.IO;
using System.Collections;
using System.Net;
namespace Rednettle.Warp3D
{
/// <summary>
/// Summary description for warp_3ds_Importer.
/// </summary>
public class warp_3ds_Importer
{
private int currentJunkId;
private int nextJunkOffset;
private String currentObjectName = null;
private warp_Object currentObject = null;
private bool endOfStream = false;
private Hashtable _objects = new Hashtable();
public warp_3ds_Importer()
{
}
public Hashtable importFromFile( string name, String path )
{
Stream fs = null;
_objects.Clear();
if ( path.StartsWith( "http" ) )
{
WebRequest webrq = WebRequest.Create( path );
fs = webrq.GetResponse().GetResponseStream() ;
}
else
{
fs = new FileStream( path, FileMode.Open );
}
BinaryReader br = new BinaryReader( fs );
return importFromStream( name, br );
}
public Hashtable importFromStream( string name, BinaryReader inStream )
{
_objects.Clear();
readJunkHeader(inStream);
if (currentJunkId != 0x4D4D)
{
return null;
}
try
{
for (;;)
{
readNextJunk( name, inStream);
}
}
catch(Exception)
{
// ignored
}
inStream.Close();
return _objects;
}
private void readJunkHeader(BinaryReader inStream)
{
currentJunkId = readShort(inStream);
nextJunkOffset = readInt(inStream);
endOfStream = currentJunkId < 0;
}
private int readInt(BinaryReader inStream)
{
return inStream.ReadByte() | (inStream.ReadByte() << 8) | (inStream.ReadByte() << 16) | (inStream.ReadByte() << 24);
}
private int readShort(BinaryReader inStream)
{
return (inStream.ReadByte() | (inStream.ReadByte() << 8));
}
private void readNextJunk(string name, BinaryReader inStream)
{
readJunkHeader(inStream);
if (currentJunkId == 0x3D3D /* mesh block */)
{
return;
}
if (currentJunkId == 0x4000 /* object block */)
{
currentObjectName = readString(inStream);
return;
}
if (currentJunkId == 0x4100 /* triangular polygon object */)
{
currentObject = new warp_Object();
_objects.Add( name+"_"+currentObjectName, currentObject );
return;
}
if (currentJunkId == 0x4110 /* vertex list */)
{
readVertexList(inStream);
return;
}
if (currentJunkId == 0x4120 /* point list */)
{
readPointList(inStream);
return;
}
if (currentJunkId == 0x4140 /* mapping coordinates */)
{
readMappingCoordinates(inStream);
return;
}
skipJunk(inStream);
}
private string readString(BinaryReader inStream)
{
string result = "";
byte inByte;
while ( (inByte = (byte) inStream.ReadByte()) != 0)
{
result += (char) inByte;
}
return result;
}
private float readFloat(BinaryReader inStream)
{
int bits = readInt(inStream);
int s = ((bits >> 31) == 0) ? 1 : -1;
int e = ((bits >> 23) & 0xff);
int m = (e == 0) ? (bits & 0x7fffff) << 1 : (bits & 0x7fffff) | 0x800000;
double v = (double)s*(double)m*(Math.Pow(2, e-150));
return (float)v;
}
private void skipJunk(BinaryReader inStream)
{
try
{
for (int i = 0; (i < nextJunkOffset - 6) && (!endOfStream); i++)
{
endOfStream = inStream.ReadByte() < 0;
}
}
catch(Exception){endOfStream=true;};
}
private void readVertexList(BinaryReader inStream)
{
float x, y, z;
int vertices = readShort(inStream);
for (int i = 0; i < vertices; i++)
{
x = readFloat(inStream);
y = readFloat(inStream);
z = readFloat(inStream);
currentObject.addVertex(x, -y, z);
}
}
private void readPointList(BinaryReader inStream)
{
int v1, v2, v3;
int triangles = readShort(inStream);
for (int i = 0; i < triangles; i++)
{
v1 = readShort(inStream);
v2 = readShort(inStream);
v3 = readShort(inStream);
readShort(inStream);
currentObject.addTriangle(currentObject.vertex(v1),
currentObject.vertex(v2),
currentObject.vertex(v3));
}
}
private void readMappingCoordinates(BinaryReader inStream)
{
int vertices = readShort(inStream);
for (int i = 0; i < vertices; i++)
{
currentObject.vertex(i).u = readFloat(inStream);
currentObject.vertex(i).v = readFloat(inStream);
}
}
}
}
-166
View File
@@ -1,166 +0,0 @@
using System;
namespace Rednettle.Warp3D
{
/// <summary>
/// Summary description for warp_Camera.
/// </summary>
///
public class warp_Camera
{
public warp_Matrix matrix=new warp_Matrix();
public warp_Matrix normalmatrix=new warp_Matrix();
bool needsRebuild=true; // Flag indicating changes on matrix
// Camera settings
public warp_Vector pos=new warp_Vector(0f,0f,0f);
public warp_Vector lookat=new warp_Vector(0f,0f,0f);
public float rollfactor=0f;
public float fovfact; // Field of View factor
public int screenwidth;
public int screenheight;
public int screenscale;
public warp_Camera()
{
setFov(90f);
}
public warp_Camera(float fov)
{
setFov(fov);
}
public warp_Matrix getMatrix()
{
rebuildMatrices();
return matrix;
}
public warp_Matrix getNormalMatrix()
{
rebuildMatrices();
return normalmatrix;
}
void rebuildMatrices()
{
if (!needsRebuild) return;
needsRebuild=false;
warp_Vector forward,up,right;
forward=warp_Vector.sub(lookat,pos);
up=new warp_Vector(0f,1f,0f);
right=warp_Vector.getNormal(up,forward);
up=warp_Vector.getNormal(forward,right);
forward.normalize();
up.normalize();
right.normalize();
normalmatrix=new warp_Matrix(right,up,forward);
normalmatrix.rotate(0,0,rollfactor);
matrix=normalmatrix.getClone();
matrix.shift(pos.x,pos.y,pos.z);
normalmatrix=normalmatrix.inverse();
matrix=matrix.inverse();
}
public void setFov(float fov)
{
fovfact=(float)Math.Tan(warp_Math.deg2rad(fov)/2);
}
public void roll(float angle)
{
rollfactor+=angle;
needsRebuild=true;
}
public void setPos(float px, float py, float pz)
{
pos=new warp_Vector(px,py,pz);
needsRebuild=true;
}
public void setPos(warp_Vector p)
{
pos=p;
needsRebuild=true;
}
public void lookAt(float px, float py, float pz)
{
lookat=new warp_Vector(px,py,pz);
needsRebuild=true;
}
public void lookAt(warp_Vector p)
{
lookat=p;
needsRebuild=true;
}
public void setScreensize(int w, int h)
{
screenwidth=w;
screenheight=h;
screenscale=(w<h)?w:h;
}
public void shift(float dx, float dy, float dz)
{
pos=pos.transform(warp_Matrix.shiftMatrix(dx,dy,dz));
lookat=lookat.transform(warp_Matrix.shiftMatrix(dx,dy,dz));
needsRebuild=true;
}
public void shift(warp_Vector v)
{
shift(v.x,v.y,v.z);
}
public void rotate(float dx, float dy, float dz)
{
pos=pos.transform(warp_Matrix.rotateMatrix(dx,dy,dz));
needsRebuild=true;
}
public void rotate(warp_Vector v)
{
rotate(v.x,v.y,v.z);
}
public static warp_Camera FRONT()
{
warp_Camera cam=new warp_Camera();
cam.setPos(0,0,-2f);
return cam;
}
public static warp_Camera LEFT()
{
warp_Camera cam=new warp_Camera();
cam.setPos(2f,0,0);
return cam;
}
public static warp_Camera RIGHT()
{
warp_Camera cam=new warp_Camera();
cam.setPos(-2f,0,0);
return cam;
}
public static warp_Camera TOP()
{
warp_Camera cam=new warp_Camera();
cam.setPos(0,-2f,0);
return cam;
}
}
}
-233
View File
@@ -1,233 +0,0 @@
using System;
namespace Rednettle.Warp3D
{
/// <summary>
/// Summary description for warp_Color.
/// </summary>
public class warp_Color
{
public static int ALPHA = unchecked((int)0xFF000000); // alpha mask
public static int RED = unchecked((int)0xFF0000); // red mask
public static int GREEN = unchecked((int)0xFF00); // green mask
public static int BLUE = unchecked((int)0xFF); // blue mask
public static int MASK7Bit = unchecked((int)0xFEFEFF); // mask for additive/subtractive shading
public static int MASK6Bit = unchecked((int)0xFCFCFC); // mask for additive/subtractive shading
public static int RGB = unchecked((int)0xFFFFFF); // rgb mask
private static int pixel,color,overflow,colorscale,r,g,b;
private warp_Color()
{
}
public static int random(int color, int delta)
{
Random rnd = new Random();
int r = (color >> 16) & 255;
int g = (color >> 8) & 255;
int b = color & 255;
r += (int) (rnd.NextDouble() * (float) delta);
g += (int) (rnd.NextDouble() * (float) delta);
b += (int) (rnd.NextDouble() * (float) delta);
return getCropColor(r, g, b);
}
public static int random()
{
Random rnd = new Random();
return (int) (rnd.NextDouble() * 16777216);
}
public static int getRed(int c)
{
return (c&RED)>>16;
}
public static int getGreen(int c)
{
return (c&GREEN)>>8;
}
public static int getBlue(int c)
{
return c&BLUE;
}
public static int[] makeGradient(int[] colors, int size)
{
int[] pal = new int[size];
int c1, c2, pos1, pos2, range;
int r, g, b, r1, g1, b1, r2, g2, b2, dr, dg, db;
if (colors.GetLength(0) == 1)
{
c1 = colors[0];
for (int i = 0; i < size; i++)
{
pal[i] = c1;
}
return pal;
}
for (int c = 0; c < colors.GetLength(0) - 1; c++)
{
c1 = colors[c];
c2 = colors[c + 1];
pos1 = size * c / (colors.GetLength(0) - 1);
pos2 = size * (c + 1) / (colors.GetLength(0) - 1);
range = pos2 - pos1;
r1 = warp_Color.getRed(c1) << 16;
g1 = warp_Color.getGreen(c1) << 16;
b1 = warp_Color.getBlue(c1) << 16;
r2 = warp_Color.getRed(c2) << 16;
g2 = warp_Color.getGreen(c2) << 16;
b2 = warp_Color.getBlue(c2) << 16;
dr = (r2 - r1) / range;
dg = (g2 - g1) / range;
db = (b2 - b1) / range;
r = r1;
g = g1;
b = b1;
for (int i = pos1; i < pos2; i++)
{
pal[i] = getColor(r >> 16, g >> 16, b >> 16);
r += dr;
g += dg;
b += db;
}
}
return pal;
}
public static int add(int color1, int color2)
{
pixel = (color1 & MASK7Bit) + (color2 & MASK7Bit);
overflow = pixel & 0x1010100;
overflow = overflow - (overflow >> 8);
return ALPHA | overflow | pixel;
}
public static int sub(int color1, int color2)
// Substracts color2 from color1
{
pixel = (color1 & MASK7Bit) + (~color2 & MASK7Bit);
overflow = ~pixel & 0x1010100;
overflow = overflow - (overflow >> 8);
return ALPHA | (~overflow & pixel);
}
public static int subneg(int color1, int color2)
// Substracts the negative of color2 from color1
{
pixel = (color1 & MASK7Bit) + (color2 & MASK7Bit);
overflow = ~pixel & 0x1010100;
overflow = overflow - (overflow >> 8);
return ALPHA | (~overflow & pixel);
}
public static int inv(int color)
// returns the inverse of the given color
{
return ALPHA | (~color);
}
public static int mix(int color1, int color2)
// Returns the averidge color from 2 colors
{
return ALPHA | ( ( (color1 & MASK7Bit) >> 1) + ( (color2 & MASK7Bit) >> 1));
}
public static int scale(int color, int factor)
{
if (factor == 0)
{
return 0;
}
if (factor == 255)
{
return color;
}
if (factor == 127)
{
return (color & 0xFEFEFE) >> 1;
}
r = ( ( (color >> 16) & 255) * factor) >> 8;
g = ( ( (color >> 8) & 255) * factor) >> 8;
b = ( (color & 255) * factor) >> 8;
return ALPHA | (r << 16) | (g << 8) | b;
}
public static int multiply(int color1, int color2)
{
if ( (color1 & RGB) == 0)
{
return 0;
}
if ( (color2 & RGB) == 0)
{
return 0;
}
r = ( ( (color1 >> 16) & 255) * ( (color2 >> 16) & 255)) >> 8;
g = ( ( (color1 >> 8) & 255) * ( (color2 >> 8) & 255)) >> 8;
b = ( (color1 & 255) * (color2 & 255)) >> 8;
return ALPHA | (r << 16) | (g << 8) | b;
}
public static int transparency(int bkgrd, int color, int alpha)
// alpha=0 : opaque , alpha=255: full transparent
{
if (alpha == 0)
{
return color;
}
if (alpha == 255)
{
return bkgrd;
}
if (alpha == 127)
{
return mix(bkgrd, color);
}
r = (alpha * ( ( (bkgrd >> 16) & 255) - ( (color >> 16) & 255)) >> 8) +
( (color >> 16) & 255);
g = (alpha * ( ( (bkgrd >> 8) & 255) - ( (color >> 8) & 255)) >> 8) +
( (color >> 8) & 255);
b = (alpha * ( (bkgrd & 255) - (color & 255)) >> 8) + (color & 255);
return ALPHA | (r << 16) | (g << 8) | b;
}
public static int getCropColor(int r, int g, int b)
{
return ALPHA | (warp_Math.crop(r, 0, 255) << 16) | (warp_Math.crop(g, 0, 255) << 8) | warp_Math.crop(b, 0, 255);
}
public static int getColor(int r, int g, int b)
{
return ALPHA|(r<<16)|(g<<8)|b;
}
public static int getGray(int color)
{
int r=((color&RED)>>16);
int g=((color&GREEN)>>8);
int b=(color&BLUE);
int Y=(r*3+g*6+b)/10;
return ALPHA|(Y<<16)|(Y<<8)|Y;
}
public static int getAverage(int color)
{
return (((color&RED)>>16)+((color&GREEN)>>8)+(color&BLUE))/3;
}
}
}
@@ -1,115 +0,0 @@
using System;
namespace Rednettle.Warp3D
{
/// <summary>
/// Summary description for warp_CoreObject.
/// </summary>
///
public class warp_CoreObject
{
public warp_Matrix matrix=new warp_Matrix();
public warp_Matrix normalmatrix=new warp_Matrix();
public void transform(warp_Matrix m)
{
matrix.transform(m);
normalmatrix.transform(m);
}
public void shift(float dx, float dy, float dz)
{
matrix.shift(dx,dy,dz);
}
public void shift( warp_Vector v )
{
matrix.shift(v.x,v.y,v.z);
}
public void scale(float d)
{
matrix.scale(d);
}
public void scale(float dx, float dy, float dz)
{
matrix.scale(dx,dy,dz);
}
public void scaleSelf(float d)
{
matrix.scaleSelf(d);
}
public void scaleSelf(float dx, float dy, float dz)
{
matrix.scaleSelf(dx,dy,dz);
}
public void rotate(warp_Vector d)
{
rotateSelf(d.x,d.y,d.z);
}
public void rotateSelf(warp_Vector d)
{
rotateSelf(d.x,d.y,d.z);
}
public void rotate(float dx, float dy, float dz)
{
matrix.rotate(dx,dy,dz);
normalmatrix.rotate(dx,dy,dz);
}
public void rotate( warp_Quaternion quat, float x, float y, float z )
{
matrix.rotate( quat , x, y, z);
normalmatrix.rotate( quat , x, y, z);
}
public void rotate( warp_Matrix m )
{
matrix.rotate( m );
normalmatrix.rotate( m );
}
public void rotateSelf(float dx, float dy, float dz)
{
matrix.rotateSelf(dx,dy,dz);
normalmatrix.rotateSelf(dx,dy,dz);
}
public void rotateSelf( warp_Quaternion quat )
{
matrix.rotateSelf( quat );
normalmatrix.rotateSelf( quat );
}
public void rotateSelf( warp_Matrix m )
{
matrix.rotateSelf( m );
normalmatrix.rotateSelf( m );
}
public void setPos( float x, float y, float z )
{
matrix.m03=x;
matrix.m13=y;
matrix.m23=z;
}
public void setPos(warp_Vector v)
{
setPos(v.x,v.y,v.z);
}
public warp_Vector getPos()
{
return new warp_Vector(matrix.m03,matrix.m13,matrix.m23);
}
}
}
-33
View File
@@ -1,33 +0,0 @@
using System;
namespace Rednettle.Warp3D
{
/// <summary>
/// Summary description for warp_Edge.
/// </summary>
///
public class warp_Edge
{
warp_Vertex a,b;
public warp_Edge()
{
}
public warp_Edge(warp_Vertex v1, warp_Vertex v2)
{
a=v1;
b=v2;
}
public warp_Vertex start()
{
return a;
}
public warp_Vertex end()
{
return b;
}
}
}
@@ -1,22 +0,0 @@
using System;
namespace Rednettle.Warp3D
{
/// <summary>
/// Summary description for warp_Environment.
/// </summary>
public class warp_Environment
{
public int ambient=0;
public int fogcolor=0;
public int fogfact=0;
public int bgcolor=unchecked((int)0xffffffff);
public warp_Texture background=null;
public void setBackground(warp_Texture t)
{
background=t;
}
}
}
@@ -1,352 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Rednettle.Warp3D
{
public class warp_FXLensFlare : warp_FXPlugin
{
public warp_Object flareObject;
private int flares=0;
private bool zBufferSensitive=true;
private warp_Texture[] flare;
private float[] flareDist;
private warp_FXLensFlare(warp_Scene scene) : base( scene )
{
}
public warp_FXLensFlare( String name, warp_Scene scene, bool zBufferSensitive ) : base( scene )
{
this.zBufferSensitive = zBufferSensitive;
flareObject=new warp_Object();
flareObject.addVertex(new warp_Vertex(1f,1f,1f));
flareObject.rebuild();
scene.addObject(name, flareObject);
}
public void preset1()
{
clear();
addGlow(144,0x330099);
addStrike(320,48,0x003366);
addStrike(48,240,0x660033);
addRing(120,0x660000);
addRays(320, 32, 20, 0x111111);
addSecs(12,100,64,0x6633cc,64);
}
public void preset2()
{
clear();
addGlow(144,0x995500);
addStrike(640,64,0xCC0000);
addStrike(32,480,0x0000FF);
addStrike(64,329,0x330099);
addRing(160,0x990000);
addRays(320, 24, 32, 0x332211);
addSecs(12,100,64,0x333333,100);
addSecs(12,60,40,0x336699,80);
}
public void preset3()
{
clear();
addGlow(144,0x993322);
addStrike(400,200,0xCC00FF);
addStrike(480,32,0x0000FF);
addRing(180,0x990000);
addRays(240, 32, 48, 0x332200);
addSecs(12,80,64,0x555555,50);
addSecs(12,60,40,0x336699,80);
}
public void setPos(warp_Vector pos)
{
flareObject.fastvertex[0].pos=pos;
}
public void clear()
{
flares=0;
flare=null;
flareDist=null;
}
public void addGlow(int size, int color)
{
addFlare(createGlow(size,size,color,256),0f);
}
public void addStrike(int width, int height, int color)
{
addFlare(createGlow(width,height,color,48),0f);
}
public void addRing(int size, int color)
{
addFlare(createRing(size,color),0f);
}
public void addRays(int size, int num, int rad, int color)
{
addFlare(createRays(size, num, rad, color),0f);
}
public void addSecs( int count, int averidgeSize, int sizeDelta, int averidgeColor, int colorDelta )
{
for ( int i = 0; i < count; i++ )
{
addFlare( createSec( averidgeSize, sizeDelta, averidgeColor, colorDelta ), warp_Math.random( -0.5f, 3f ) );
}
}
override public void apply()
{
int px = flareObject.fastvertex[ 0 ].x;
int py = flareObject.fastvertex[ 0 ].y;
if ( !flareObject.fastvertex[ 0 ].visible )
{
return;
}
if ( zBufferSensitive && ( flareObject.fastvertex[ 0 ].z > scene.renderPipeline.zBuffer[ px + py * screen.width ] ) )
{
return;
}
int cx=screen.width/2;
int cy=screen.height/2;
float dx=(float)(cx-px);
float dy=(float)(cy-py);
int posx,posy,xsize,ysize;
float zoom;
for (int i=0; i<flares;i++)
{
zoom=warp_Math.pythagoras(dx,dy)/warp_Math.pythagoras(cx,cy);
zoom=(1-zoom)/2+1;
xsize=flare[i].width;
ysize=flare[i].height;
posx=px+(int)(dx*flareDist[i]);
posy=py+(int)(dy*flareDist[i]);
screen.add(flare[i],posx-xsize/2,posy-ysize/2,xsize,ysize);
}
}
private void addFlare(warp_Texture texture, float relPos)
{
flares++;
if (flares == 1)
{
flare=new warp_Texture[1];
flareDist=new float[1];
}
else
{
warp_Texture[] temp1=new warp_Texture[flares];
System.Array.Copy(flare,0,temp1,0,flares-1); // check this
flare=temp1;
float[] temp2=new float[flares];
System.Array.Copy(flareDist, 0, temp2, 0, flares - 1 );
flareDist=temp2;
}
flare[flares-1]=texture;
flareDist[flares-1]=relPos;
}
private warp_Texture createRadialTexture(int w, int h, int[] colormap, int[] alphamap)
{
int offset;
float relX,relY;
warp_Texture newTexture=new warp_Texture(w,h);
int[] palette=getPalette(colormap, alphamap);
for(int y=h-1;y>=0;y--)
{
offset=y*w;
for (int x=w-1;x>=0;x--)
{
relX=(float)(x-(w>>1))/(float)(w>>1);
relY=(float)(y-(h>>1))/(float)(h>>1);
newTexture.pixel[offset+x]=palette[warp_Math.crop((int)(255*Math.Sqrt(relX*relX+relY*relY)),0,255)];
}
}
return newTexture;
}
private int[] getPalette(int[] color, int[] alpha)
{
int r,g,b;
int[] palette=new int[256];
for (int i=255;i>=0;i--)
{
r=(((color[i]>>16)&255)*alpha[i])>>8;
g=(((color[i]>>8)&255)*alpha[i])>>8;
b=((color[i]&255)*alpha[i])>>8;
palette[i]=warp_Color.getColor(r,g,b);
}
return palette;
}
private warp_Texture createGlow(int w, int h, int color, int alpha)
{
return createRadialTexture(w,h,getGlowPalette(color),getConstantAlpha(alpha));
}
private warp_Texture createRing(int size, int color)
{
return createRadialTexture(size,size,getColorPalette(color,color),getRingAlpha(40));
}
private warp_Texture createSec(int size, int sizedelta, int color, int colordelta)
{
int s=(int)warp_Math.randomWithDelta(size,sizedelta);
int c1=warp_Color.random(color,colordelta);
int c2=warp_Color.random(color,colordelta);
return createRadialTexture(s,s,getColorPalette(c1,c2),getSecAlpha());
}
private warp_Texture createRays(int size, int rays, int rad, int color)
{
int pos;
float relPos;
warp_Texture texture=new warp_Texture(size,size);
int[] radialMap=new int [1024];
warp_Math.clearBuffer(radialMap, 0);
for (int i=0;i<rays;i++)
{
pos=(int)warp_Math.random(rad,1023-rad);
for (int k=pos-rad; k<=pos+rad; k++)
{
relPos=(float)(k-pos+rad)/(float)(rad*2);
radialMap[k]+=(int)(255*(1+Math.Sin((relPos-0.25)*3.14159*2))/2);
}
}
int angle,offset,reldist;
float xrel,yrel;
for (int y=size-1;y>=0;y--)
{
offset=y*size;
for (int x=size-1;x>=0;x--)
{
xrel=(float)(2*x-size)/(float)size;
yrel=(float)(2*y-size)/(float)size;
angle=(int)(1023*Math.Atan2(xrel,yrel)/3.14159/2)&1023;
reldist=Math.Max((int)(255-255*warp_Math.pythagoras(xrel,yrel)),0);
texture.pixel[x+offset]=warp_Color.scale(color, radialMap[angle]*reldist/255);
}
}
return texture;
}
private int[] getGlowPalette(int color)
{
int r,g,b;
float relDist,diffuse,specular;
int[] palette=new int[256];
int cr=(color>>16)&255;
int cg=(color>>8)&255;
int cb=color&255;
for (int i=255;i>=0;i--)
{
relDist=(float)i/255;
diffuse=(float)Math.Cos(relDist*1.57);
specular=(float)(255/Math.Pow(2.718,relDist*2.718)-(float)i/16);
r=(int)((float)cr*diffuse+specular);
g=(int)((float)cg*diffuse+specular);
b=(int)((float)cb*diffuse+specular);
palette[i]=warp_Color.getCropColor(r,g,b);
}
return palette;
}
private int[] getConstantAlpha(int alpha)
{
int[] alphaPalette=new int[256];
for (int i=255;i>=0;i--) alphaPalette[i]=alpha;
return alphaPalette;
}
private int[] getLinearAlpha()
{
int[] alphaPalette=new int[256];
for ( int i = 255; i >= 0; i-- )
{
alphaPalette[ i ] = 255 - i;
}
return alphaPalette;
}
private int[] getRingAlpha(int ringsize)
{
int[] alphaPalette=new int[256];
float angle;
for ( int i = 0; i < 256; i++ )
{
alphaPalette[ i ] = 0;
}
for (int i=0;i<ringsize;i++)
{
angle=3.14159f/180*(float)(180*i/ringsize);
alphaPalette[255-ringsize+i]=(int)(64*Math.Sin(angle));
}
return alphaPalette;
}
private int[] getSecAlpha()
{
int[] alphaPalette=getRingAlpha((int)warp_Math.random(0,255));
for ( int i = 0; i < 256; i++ )
{
alphaPalette[ i ] = ( alphaPalette[ i ] + 255 - i ) >> 2;
}
return alphaPalette;
}
private int[] getColorPalette(int color1, int color2)
{
int[] palette=new int[256];
int r1=(color1>>16)&255;
int g1=(color1>>8)&255;
int b1=color1&255;
int r2=(color2>>16)&255;
int g2=(color2>>8)&255;
int b2=color2&255;
int dr=r2-r1;
int dg=g2-g1;
int db=b2-b1;
int r=r1<<8;
int g=g1<<8;
int b=b1<<8;
for (int i=0;i<256;i++)
{
palette[i]=warp_Color.getColor(r>>8,g>>8,b>>8);
r+=dr; g+=dg; b+=db;
}
return palette;
}
}
}
@@ -1,20 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Rednettle.Warp3D
{
public abstract class warp_FXPlugin
{
public warp_Scene scene = null;
public warp_Screen screen = null;
public warp_FXPlugin( warp_Scene scene )
{
this.scene = scene;
screen = scene.renderPipeline.screen;
}
public abstract void apply();
}
}
-66
View File
@@ -1,66 +0,0 @@
using System;
namespace Rednettle.Warp3D
{
/// <summary>
/// Summary description for warp_Light.
/// </summary>
public class warp_Light
{
// F I E L D S
public warp_Vector v; //Light direction
public warp_Vector v2; //projected Light direction
public int diffuse = 0;
public int specular = 0;
public int highlightSheen = 0;
public int highlightSpread = 0;
warp_Matrix matrix2;
private warp_Light()
// Default constructor not accessible
{
}
public warp_Light(warp_Vector direction)
{
v = direction.getClone();
v.normalize();
}
public warp_Light(warp_Vector direction, int diffuse)
{
v = direction.getClone();
v.normalize();
this.diffuse = diffuse;
}
public warp_Light(warp_Vector direction, int color, int highlightSheen, int highlightSpread)
{
v = direction.getClone();
v.normalize();
this.diffuse = color;
this.specular = color;
this.highlightSheen = highlightSheen;
this.highlightSpread = highlightSpread;
}
public warp_Light(warp_Vector direction, int diffuse, int specular,int highlightSheen, int highlightSpread)
{
v = direction.getClone();
v.normalize();
this.diffuse = diffuse;
this.specular = specular;
this.highlightSheen = highlightSheen;
this.highlightSpread = highlightSpread;
}
public void project(warp_Matrix m)
{
matrix2 = m.getClone();
matrix2.transform(m);
v2 = v.transform(matrix2);
}
}
}
@@ -1,90 +0,0 @@
using System;
namespace Rednettle.Warp3D
{
/// <summary>
/// Summary description for warp_Lightmap.
/// </summary>
public class warp_Lightmap
{
public int[] diffuse = new int[65536];
public int[] specular = new int[65536];
private float[] sphere = new float[65536];
private warp_Light[] light;
private int lights;
private int ambient;
private int temp, overflow, color, pos, r, g, b;
public warp_Lightmap(warp_Scene scene)
{
scene.rebuild();
light = scene.light;
lights = scene.lights;
ambient = scene.environment.ambient;
buildSphereMap();
rebuildLightmap();
}
private void buildSphereMap()
{
float fnx, fny, fnz;
int pos;
for (int ny = -128; ny < 128; ny++)
{
fny = (float) ny / 128;
for (int nx = -128; nx < 128; nx++)
{
pos = nx + 128 + ( (ny + 128) << 8);
fnx = (float) nx / 128;
fnz = (float) (1 - Math.Sqrt(fnx * fnx + fny * fny));
sphere[pos] = (fnz > 0) ? fnz : 0;
}
}
}
public void rebuildLightmap()
{
System.Console.WriteLine(">> Rebuilding Light Map ... [" + lights + " light sources]");
warp_Vector l;
float fnx, fny, phongfact, sheen, spread;
int diffuse, specular, cos, dr, dg, db, sr, sg, sb;
for (int ny = -128; ny < 128; ny++)
{
fny = (float) ny / 128;
for (int nx = -128; nx < 128; nx++)
{
pos = nx + 128 + ( (ny + 128) << 8);
fnx = (float) nx / 128;
sr = sg = sb = 0;
dr = warp_Color.getRed(ambient);
dg = warp_Color.getGreen(ambient);
db = warp_Color.getBlue(ambient);
for (int i = 0; i < lights; i++)
{
l = light[i].v;
diffuse = light[i].diffuse;
specular = light[i].specular;
sheen = (float) light[i].highlightSheen / 255f;
spread = (float) light[i].highlightSpread / 4096;
spread = (spread < 0.01f) ? 0.01f : spread;
cos = (int) (255 * warp_Vector.angle(light[i].v,new warp_Vector(fnx, fny, sphere[pos])));
cos = (cos > 0) ? cos : 0;
dr += (warp_Color.getRed(diffuse) * cos) >> 8;
dg += (warp_Color.getGreen(diffuse) * cos) >> 8;
db += (warp_Color.getBlue(diffuse) * cos) >> 8;
phongfact = sheen * (float) Math.Pow( (float) cos / 255f, 1 / spread);
sr += (int) ( (float) warp_Color.getRed(specular) * phongfact);
sg += (int) ( (float) warp_Color.getGreen(specular) * phongfact);
sb += (int) ( (float) warp_Color.getBlue(specular) * phongfact);
}
this.diffuse[pos] = warp_Color.getCropColor(dr, dg, db);
this.specular[pos] = warp_Color.getCropColor(sr, sg, sb);
}
}
}
}
}
@@ -1,244 +0,0 @@
using System;
using System.Drawing;
using System.IO;
namespace Rednettle.Warp3D
{
/// <summary>
/// Summary description for warp_Material.
/// </summary>
public class warp_Material
{
public int color=0;
public int transparency=0;
public int reflectivity=255;
public int type=0;
public warp_Texture texture=null;
public warp_Texture envmap=null;
public bool flat=false;
public bool wireframe=false;
public bool opaque=true;
public String texturePath=null;
public String envmapPath=null;
public warp_TextureSettings textureSettings=null;
public warp_TextureSettings envmapSettings=null;
public double rwx = 500.00;
public double rwy = 500.00;
public Point pt = new Point(0,0);
public int offset = 0;
public warp_Material()
{
//
// TODO: Add constructor logic here
//
}
public warp_Material(int color)
{
setColor(color);
}
public warp_Material(warp_Texture t)
{
setTexture(t);
reflectivity=255;
}
public warp_Material(String path)
{
FileStream fs = new FileStream(path,FileMode.Open);
BinaryReader br = new BinaryReader(fs);
importFromStream(br);
}
private void importFromStream(BinaryReader inStream)
{
readSettings(inStream);
readTexture(inStream, true);
readTexture(inStream, false);
}
private void readSettings(BinaryReader inStream)
{
setColor(readInt(inStream));
setTransparency(inStream.ReadByte());
setReflectivity(inStream.ReadByte());
setFlat(inStream.ReadBoolean());
}
private int readInt(BinaryReader inStream)
{
return (inStream.ReadByte() << 24) | (inStream.ReadByte() << 16) | (inStream.ReadByte() << 8) | inStream.ReadByte();
}
private string readString(BinaryReader inStream)
{
string result = "";
byte inByte;
while ( (inByte = (byte) inStream.ReadByte()) != 60)
{
result += (char) inByte;
}
return result;
}
private void readTexture(BinaryReader inStream, bool textureId)
{
warp_Texture t = null;
int id = inStream.ReadSByte();
if (id == 1)
{
t = new warp_Texture( "c:/source/warp3d/materials/skymap.jpg" );
if (t != null && textureId)
{
texturePath = t.path;
textureSettings = null;
setTexture(t);
}
if (t != null && !textureId)
{
envmapPath = t.path;
envmapSettings = null;
setEnvmap(t);
}
}
if (id == 2)
{
int w = readInt(inStream);
int h = readInt(inStream);
int type = inStream.ReadSByte();
float persistency = readInt(inStream);
float density = readInt(inStream);
persistency = .5f;
density = .5f;
int samples = inStream.ReadByte();
int numColors = inStream.ReadByte();
int[] colors = new int[numColors];
for (int i = 0; i < numColors; i++)
{
colors[i] = readInt(inStream);
}
if (type == 1)
{
t = warp_TextureFactory.PERLIN(w, h, persistency, density, samples, 1024).colorize(warp_Color.makeGradient(colors, 1024));
}
if (type == 2)
{
t = warp_TextureFactory.WAVE(w, h, persistency, density, samples, 1024).colorize(warp_Color.makeGradient(colors, 1024));
}
if (type == 3)
{
t = warp_TextureFactory.GRAIN(w, h, persistency, density, samples, 20, 1024).colorize(warp_Color.makeGradient(colors, 1024));
}
if (textureId)
{
texturePath = null;
textureSettings = new warp_TextureSettings(t, w, h, type, persistency, density, samples, colors);
setTexture(t);
}
else
{
envmapPath = null;
envmapSettings = new warp_TextureSettings(t, w, h, type, persistency, density, samples, colors);
setEnvmap(t);
}
}
}
public void setTexture(warp_Texture t)
{
texture=t;
if (texture!=null) texture.resize();
}
public void setEnvmap(warp_Texture env)
{
envmap=env;
env.resize(256,256);
}
public void setColor(int c)
{
color=c;
}
public void setTransparency(int factor)
{
transparency=warp_Math.crop(factor,0,255);
opaque=(transparency==0);
}
public void setReflectivity(int factor)
{
reflectivity=warp_Math.crop(factor,0,255);
}
public void setFlat(bool flat)
{
this.flat=flat;
}
public void setWireframe(bool wireframe)
{
this.wireframe=wireframe;
}
public void setType(int type)
{
this.type = type;
}
public warp_Texture getTexture()
{
return texture;
}
public warp_Texture getEnvmap()
{
return envmap;
}
public int getColor()
{
return color;
}
public int getTransparency()
{
return transparency;
}
public int getReflectivity()
{
return reflectivity;
}
public int getType()
{
return type;
}
public bool isFlat()
{
return flat;
}
public bool isWireframe()
{
return wireframe;
}
}
}
-215
View File
@@ -1,215 +0,0 @@
using System;
namespace Rednettle.Warp3D
{
/// <summary>
/// Summary description for warp_Math.
/// </summary>
public class warp_Math
{
private static float[] sinus;
private static float[] cosinus;
private static bool trig=false;
public static float pi=3.1415926535f;
private static float rad2scale=4096f/3.14159265f/2f;
private static float pad=256*3.14159265f;
private static int[] fastRandoms;
private static int fastRndPointer=0;
private static bool fastRndInit=false;
private static Random _rnd = new Random();
public warp_Math()
{
//
// TODO: Add constructor logic here
//
}
public static float interpolate(float a, float b, float d)
{
float f = (1 - cos(d * pi)) * 0.5f;
return a + f * (b - a);
}
public static float random()
{
Random rnd = new Random();
return (float) (rnd.NextDouble() * 2 - 1);
}
public static float random(float min, float max)
{
//Random rnd = new Random();
return (float) (_rnd.NextDouble() * (max - min) + min);
}
public static float randomWithDelta(float averidge, float delta)
{
return averidge + random() * delta;
}
public static int fastRnd(int bits)
{
if (bits < 1)
{
return 0;
}
fastRndPointer = (fastRndPointer + 1) & 31;
if (!fastRndInit)
{
fastRandoms = new int[32];
for (int i = 0; i < 32; i++)
{
fastRandoms[i] = (int) random(0, 0xFFFFFF);
}
fastRndInit = true;
}
return fastRandoms[fastRndPointer] & (1 << (bits - 1));
}
public static int fastRndBit()
{
return fastRnd(1);
}
public static float deg2rad(float deg)
{
return deg*0.0174532925194f;
}
public static float rad2deg(float rad)
{
return rad*57.295779514719f;
}
public static float sin(float angle)
{
if(!trig) buildTrig();
return sinus[(int)((angle+pad)*rad2scale)&0xFFF];
}
public static float cos(float angle)
{
if(!trig) buildTrig();
return cosinus[(int)((angle+pad)*rad2scale)&0xFFF];
}
private static void buildTrig()
{
System.Console.WriteLine(">> Building warp_Math LUT");
sinus=new float[4096];
cosinus=new float[4096];
for (int i=0;i<4096;i++)
{
sinus[i]=(float)Math.Sin((float)i/rad2scale);
cosinus[i]=(float)Math.Cos((float)i/rad2scale);
}
trig=true;
}
public static float pythagoras(float a, float b)
{
return (float)Math.Sqrt(a*a+b*b);
}
public static int pythagoras(int a, int b)
{
return (int)Math.Sqrt(a*a+b*b);
}
public static int crop(int num, int min, int max)
{
return (num<min)?min:(num>max)?max:num;
}
public static float crop(float num, float min, float max)
{
return (num<min)?min:(num>max)?max:num;
}
public static bool inrange(int num, int min, int max)
{
return ((num>=min)&&(num<max));
}
unsafe public static void clearBuffer(int[] buffer, int c)
{
/*
for (int idx = 0; idx < buffer.Length; idx++)
{
buffer[idx] = c;
}
*/
fixed (int* pC = buffer)
{
int* pClear = pC;
for(int i=0;i<buffer.GetLength(0)/4;i++)
{
*pClear++=c;
*pClear++=c;
*pClear++=c;
*pClear++=c;
}
}
}
unsafe public static void clearBuffer( long[] buffer, int c )
{
/* for (int idx = 0; idx < buffer.Length; idx++)
{
buffer[idx] = c;
}*/
fixed ( long* pC = buffer )
{
long* pClear = pC;
for ( int i = 0; i < buffer.GetLength( 0 ) / 4; i++ )
{
*pClear++ = c;
*pClear++ = c;
*pClear++ = c;
*pClear++ = c;
}
}
}
public static void clearBuffer(byte[] buffer, byte value)
{
System.Array.Clear(buffer, 0, buffer.GetLength(0));
}
public static void cropBuffer(int[] buffer, int min, int max)
{
for (int i=buffer.GetLength(0)-1;i>=0;i--) buffer[i]=crop(buffer[i],min,max);
}
public static void copyBuffer(int[] source, int[] target)
{
System.Array.Copy(source,0,target,0,crop(source.GetLength(0),0,target.GetLength(0)));
}
/*
public static float random()
{
return (float)(Math.r.random()*2-1);
}
public static float random(float min, float max)
{
return (float)(Math.random()*(max-min)+min);
}
public static float randomWithDelta(float averidge, float delta)
{
return averidge+random()*delta;
}
*/
}
}
-362
View File
@@ -1,362 +0,0 @@
using System;
namespace Rednettle.Warp3D
{
public class warp_Matrix
{
public float m00=1, m01=0, m02=0, m03=0;
public float m10=0, m11=1, m12=0, m13=0;
public float m20=0, m21=0, m22=1, m23=0;
public float m30=0, m31=0, m32=0, m33=1;
public warp_Matrix(warp_Vector right, warp_Vector up, warp_Vector forward)
{
m00=right.x;
m10=right.y;
m20=right.z;
m01=up.x;
m11=up.y;
m21=up.z;
m02=forward.x;
m12=forward.y;
m22=forward.z;
}
public float this[ int column, int row ]
{
get
{
switch ( row )
{
case 0:
if ( column == 0 ) return m00;
if ( column == 1 ) return m01;
if ( column == 2 ) return m02;
if ( column == 3 ) return m03;
break;
case 1:
if ( column == 0 ) return m11;
if ( column == 1 ) return m11;
if ( column == 2 ) return m12;
if ( column == 3 ) return m13;
break;
case 2:
if ( column == 0 ) return m20;
if ( column == 1 ) return m21;
if ( column == 2 ) return m22;
if ( column == 3 ) return m23;
break;
case 3:
if ( column == 0 ) return m30;
if ( column == 1 ) return m31;
if ( column == 2 ) return m32;
if ( column == 3 ) return m33;
break;
default:
return 0;
}
return 0;
}
}
public warp_Matrix()
{
//
// TODO: Add constructor logic here
//
}
public static warp_Matrix shiftMatrix(float dx, float dy, float dz)
// matrix for shifting
{
warp_Matrix m=new warp_Matrix();
m.m03=dx;
m.m13=dy;
m.m23=dz;
return m;
}
public static warp_Matrix quaternionMatrix( warp_Quaternion quat )
{
warp_Matrix m = new warp_Matrix();
float xx = quat.X * quat.X;
float xy = quat.X * quat.Y;
float xz = quat.X * quat.Z;
float xw = quat.X * quat.W;
float yy = quat.Y * quat.Y;
float yz = quat.Y * quat.Z;
float yw = quat.Y * quat.W;
float zz = quat.Z * quat.Z;
float zw = quat.Z * quat.W;
m.m00 = 1 - 2 * ( yy + zz );
m.m01 = 2 * ( xy - zw) ;
m.m02 = 2*(xz + yw);
m.m10 = 2*(xy + zw);
m.m11 = 1 - 2* ( xx + zz );
m.m12 = 2*(yz - xw);
m.m20 = 2*(xz - yw);
m.m21 = 2*(yz + xw);
m.m22 = 1 - 2 * ( xx + yy );
m.m03 = m.m13 = m.m23 = m.m30 = m.m31 = m.m32 = 0;
m.m33 = 1;
return m;
}
public warp_Matrix rotateMatrix( warp_Quaternion quat )
{
reset();
warp_Matrix temp = warp_Matrix.quaternionMatrix( quat );
warp_Matrix result = warp_Matrix.multiply( this, temp );
return result;
}
public static warp_Matrix scaleMatrix(float dx, float dy, float dz)
{
warp_Matrix m=new warp_Matrix();
m.m00=dx;
m.m11=dy;
m.m22=dz;
return m;
}
public static warp_Matrix scaleMatrix(float d)
{
return warp_Matrix.scaleMatrix(d,d,d);
}
public static warp_Matrix rotateMatrix(float dx, float dy, float dz)
{
warp_Matrix res=new warp_Matrix();
float SIN;
float COS;
if (dx!=0)
{
warp_Matrix m =new warp_Matrix();
SIN=warp_Math.sin(dx);
COS=warp_Math.cos(dx);
m.m11=COS;
m.m12=SIN;
m.m21=-SIN;
m.m22=COS;
res.transform(m);
}
if (dy!=0)
{
warp_Matrix m =new warp_Matrix();
SIN=warp_Math.sin(dy);
COS=warp_Math.cos(dy);
m.m00=COS;
m.m02=SIN;
m.m20=-SIN;
m.m22=COS;
res.transform(m);
}
if (dz!=0)
{
warp_Matrix m =new warp_Matrix();
SIN=warp_Math.sin(dz);
COS=warp_Math.cos(dz);
m.m00=COS;
m.m01=SIN;
m.m10=-SIN;
m.m11=COS;
res.transform(m);
}
return res;
}
public void shift(float dx, float dy, float dz)
{
transform( shiftMatrix( dx, dy, dz ) );
}
public void scale(float dx, float dy, float dz)
{
transform(scaleMatrix(dx,dy,dz));
}
public void scale(float d)
{
transform(scaleMatrix(d));
}
public void rotate(float dx, float dy, float dz)
{
transform(rotateMatrix(dx,dy,dz));
}
public void rotate( warp_Quaternion quat, float x, float y, float z )
{
transform( rotateMatrix( quat ) );
}
public void rotate( warp_Matrix m )
{
transform( m );
}
public void scaleSelf( float dx, float dy, float dz )
{
preTransform(scaleMatrix(dx,dy,dz));
}
public void scaleSelf(float d)
{
preTransform(scaleMatrix(d));
}
public void shiftSelf( float dx, float dy, float dz )
{
preTransform( shiftMatrix( dx, dy, dz ) );
}
public void rotateSelf( float dx, float dy, float dz )
{
preTransform( rotateMatrix( dx, dy, dz ) );
}
public void rotateSelf( warp_Matrix m )
{
preTransform( m );
}
public void rotateSelf( warp_Quaternion quat )
{
preTransform(rotateMatrix( quat) );
}
public void transform(warp_Matrix n)
{
warp_Matrix m=this.getClone();
m00 = n.m00*m.m00 + n.m01*m.m10 + n.m02*m.m20;
m01 = n.m00*m.m01 + n.m01*m.m11 + n.m02*m.m21;
m02 = n.m00*m.m02 + n.m01*m.m12 + n.m02*m.m22;
m03 = n.m00*m.m03 + n.m01*m.m13 + n.m02*m.m23 + n.m03;
m10 = n.m10*m.m00 + n.m11*m.m10 + n.m12*m.m20;
m11 = n.m10*m.m01 + n.m11*m.m11 + n.m12*m.m21;
m12 = n.m10*m.m02 + n.m11*m.m12 + n.m12*m.m22;
m13 = n.m10*m.m03 + n.m11*m.m13 + n.m12*m.m23 + n.m13;
m20 = n.m20*m.m00 + n.m21*m.m10 + n.m22*m.m20;
m21 = n.m20*m.m01 + n.m21*m.m11 + n.m22*m.m21;
m22 = n.m20*m.m02 + n.m21*m.m12 + n.m22*m.m22;
m23 = n.m20*m.m03 + n.m21*m.m13 + n.m22*m.m23 + n.m23;
}
public void preTransform(warp_Matrix n)
{
warp_Matrix m=this.getClone();
m00 = m.m00*n.m00 + m.m01*n.m10 + m.m02*n.m20;
m01 = m.m00*n.m01 + m.m01*n.m11 + m.m02*n.m21;
m02 = m.m00*n.m02 + m.m01*n.m12 + m.m02*n.m22;
m03 = m.m00*n.m03 + m.m01*n.m13 + m.m02*n.m23 + m.m03;
m10 = m.m10*n.m00 + m.m11*n.m10 + m.m12*n.m20;
m11 = m.m10*n.m01 + m.m11*n.m11 + m.m12*n.m21;
m12 = m.m10*n.m02 + m.m11*n.m12 + m.m12*n.m22;
m13 = m.m10*n.m03 + m.m11*n.m13 + m.m12*n.m23 + m.m13;
m20 = m.m20*n.m00 + m.m21*n.m10 + m.m22*n.m20;
m21 = m.m20*n.m01 + m.m21*n.m11 + m.m22*n.m21;
m22 = m.m20*n.m02 + m.m21*n.m12 + m.m22*n.m22;
m23 = m.m20*n.m03 + m.m21*n.m13 + m.m22*n.m23 + m.m23;
}
public static warp_Matrix multiply(warp_Matrix m1, warp_Matrix m2)
{
warp_Matrix m=new warp_Matrix();
m.m00 = m1.m00*m2.m00 + m1.m01*m2.m10 + m1.m02*m2.m20;
m.m01 = m1.m00*m2.m01 + m1.m01*m2.m11 + m1.m02*m2.m21;
m.m02 = m1.m00*m2.m02 + m1.m01*m2.m12 + m1.m02*m2.m22;
m.m03 = m1.m00*m2.m03 + m1.m01*m2.m13 + m1.m02*m2.m23 + m1.m03;
m.m10 = m1.m10*m2.m00 + m1.m11*m2.m10 + m1.m12*m2.m20;
m.m11 = m1.m10*m2.m01 + m1.m11*m2.m11 + m1.m12*m2.m21;
m.m12 = m1.m10*m2.m02 + m1.m11*m2.m12 + m1.m12*m2.m22;
m.m13 = m1.m10*m2.m03 + m1.m11*m2.m13 + m1.m12*m2.m23 + m1.m13;
m.m20 = m1.m20*m2.m00 + m1.m21*m2.m10 + m1.m22*m2.m20;
m.m21 = m1.m20*m2.m01 + m1.m21*m2.m11 + m1.m22*m2.m21;
m.m22 = m1.m20*m2.m02 + m1.m21*m2.m12 + m1.m22*m2.m22;
m.m23 = m1.m20*m2.m03 + m1.m21*m2.m13 + m1.m22*m2.m23 + m1.m23;
return m;
}
/*
public string toString()
{
// todo
}
*/
public warp_Matrix getClone()
{
warp_Matrix m=new warp_Matrix();
m.m00=m00; m.m01=m01; m.m02=m02; m.m03=m03;
m.m10=m10; m.m11=m11; m.m12=m12; m.m13=m13;
m.m20=m20; m.m21=m21; m.m22=m22; m.m23=m23;
m.m30=m30; m.m31=m31; m.m32=m32; m.m33=m33;
return m;
}
public warp_Matrix inverse()
{
warp_Matrix m=new warp_Matrix();
float q1 = m12; float q6 = m10*m01; float q7 = m10*m21; float q8 = m02;
float q13 = m20*m01; float q14 = m20*m11; float q21 = m02*m21; float q22 = m03*m21;
float q25 = m01*m12; float q26 = m01*m13; float q27 = m02*m11; float q28 = m03*m11;
float q29 = m10*m22; float q30 = m10*m23; float q31 = m20*m12; float q32 = m20*m13;
float q35 = m00*m22; float q36 = m00*m23; float q37 = m20*m02; float q38 = m20*m03;
float q41 = m00*m12; float q42 = m00*m13; float q43 = m10*m02; float q44 = m10*m03;
float q45 = m00*m11; float q48 = m00*m21;
float q49 = q45*m22-q48*q1-q6*m22+q7*q8;
float q50 = q13*q1-q14*q8;
float q51 = 1/(q49+q50);
m.m00 = (m11*m22*m33-m11*m23*m32-m21*m12*m33+m21*m13*m32+m31*m12*m23-m31*m13*m22)*q51;
m.m01 = -(m01*m22*m33-m01*m23*m32-q21*m33+q22*m32)*q51;
m.m02 = (q25*m33-q26*m32-q27*m33+q28*m32)*q51;
m.m03 = -(q25*m23-q26*m22-q27*m23+q28*m22+q21*m13-q22*m12)*q51;
m.m10 = -(q29*m33-q30*m32-q31*m33+q32*m32)*q51;
m.m11 = (q35*m33-q36*m32-q37*m33+q38*m32)*q51;
m.m12 = -(q41*m33-q42*m32-q43*m33+q44*m32)*q51;
m.m13 = (q41*m23-q42*m22-q43*m23+q44*m22+q37*m13-q38*m12)*q51;
m.m20 = (q7*m33-q30*m31-q14*m33+q32*m31)*q51;
m.m21 = -(q48*m33-q36*m31-q13*m33+q38*m31)*q51;
m.m22 = (q45*m33-q42*m31-q6*m33+q44*m31)*q51;
m.m23 = -(q45*m23-q42*m21-q6*m23+q44*m21+q13*m13-q38*m11)*q51;
return m;
}
public void reset()
{
m00=1; m01=0; m02=0; m03=0;
m10=0; m11=1; m12=0; m13=0;
m20=0; m21=0; m22=1; m23=0;
m30=0; m31=0; m32=0; m33=1;
}
}
}
-378
View File
@@ -1,378 +0,0 @@
using System;
using System.Collections;
namespace Rednettle.Warp3D
{
/// <summary>
/// Summary description for warp_Object.
/// </summary>
public class warp_Object : warp_CoreObject
{
public Object userData=null; // Can be freely used
public String user=null; // Can be freely used
public ArrayList vertexData=new ArrayList();
public ArrayList triangleData=new ArrayList();
public int id; // This object's index
public String name=""; // This object's name
public bool visible=true; // Visibility tag
public bool projected=false;
public warp_Scene parent=null;
private bool dirty=true; // Flag for dirty handling
public warp_Vertex[] fastvertex;
public warp_Triangle[] fasttriangle;
public int vertices=0;
public int triangles=0;
public warp_Material material = null;
public int index;
public int offset = 0;
public int split = 0;
public warp_Object()
{
}
public warp_Vertex vertex(int id)
{
return (warp_Vertex) vertexData[id];
}
public warp_Triangle triangle(int id)
{
return (warp_Triangle) triangleData[id];
}
public void addVertex(warp_Vertex newVertex)
{
newVertex.parent=this;
vertexData.Add(newVertex);
dirty=true;
}
public void addTriangle(warp_Triangle newTriangle)
{
newTriangle.parent=this;
triangleData.Add(newTriangle);
dirty=true;
}
public void addTriangle(int v1, int v2, int v3)
{
addTriangle(vertex(v1),vertex(v2),vertex(v3));
}
public void removeVertex(warp_Vertex v)
{
vertexData.Remove(v);
}
public void removeTriangle(warp_Triangle t)
{
triangleData.Remove(t);
}
public void removeVertexAt(int pos)
{
vertexData.Remove(pos);
}
public void removeTriangleAt(int pos)
{
triangleData.Remove(pos);
}
public void setMaterial(warp_Material m)
{
material = m;
}
public void rebuild()
{
if (!dirty) return;
dirty=false;
// Generate faster structure for vertices
vertices=vertexData.Count;
fastvertex=new warp_Vertex[vertices];
IEnumerator enumerator=vertexData.GetEnumerator();
for (int i=vertices-1;i>=0;i--)
{
enumerator.MoveNext();
fastvertex[i]=(warp_Vertex)enumerator.Current;
}
// Generate faster structure for triangles
triangles=triangleData.Count;
fasttriangle=new warp_Triangle[triangles];
enumerator=triangleData.GetEnumerator();
for (int i=triangles-1;i>=0;i--)
{
enumerator.MoveNext();
fasttriangle[i]=(warp_Triangle)enumerator.Current;
fasttriangle[i].id=i;
}
for (int i=vertices-1;i>=0;i--)
{
fastvertex[i].id=i;
fastvertex[i].resetNeighbors();
}
warp_Triangle tri;
for (int i=triangles-1;i>=0;i--)
{
tri=fasttriangle[i];
tri.p1.registerNeighbor(tri);
tri.p2.registerNeighbor(tri);
tri.p3.registerNeighbor(tri);
}
regenerate();
}
/*
public void rebuild()
{
if (!dirty) return;
dirty=false;
Enumeration enum;
// Generate faster structure for vertices
vertices=vertexData.size();
vertex=new warp_Vertex[vertices];
enum=vertexData.elements();
for (int i=vertices-1;i>=0;i--) vertex[i]=(warp_Vertex)enum.nextElement();
// Generate faster structure for triangles
triangles=triangleData.size();
triangle=new warp_Triangle[triangles];
enum=triangleData.elements();
for (int i=triangles-1;i>=0;i--)
{
triangle[i]=(warp_Triangle)enum.nextElement();
triangle[i].id=i;
}
for (int i=vertices-1;i>=0;i--)
{
vertex[i].id=i;
vertex[i].resetNeighbors();
}
warp_Triangle tri;
for (int i=triangles-1;i>=0;i--)
{
tri=triangle[i];
tri.p1.registerNeighbor(tri);
tri.p2.registerNeighbor(tri);
tri.p3.registerNeighbor(tri);
}
regenerate();
}
*/
public void addVertex(float x, float y, float z)
{
addVertex(new warp_Vertex(x,y,z));
}
public void addVertex(float x, float y, float z, float u, float v)
{
warp_Vertex vert=new warp_Vertex(x,y,z);
vert.setUV(u,v);
addVertex(vert);
}
public void addTriangle(warp_Vertex a, warp_Vertex b, warp_Vertex c)
{
addTriangle(new warp_Triangle(a,b,c));
}
public void regenerate()
// Regenerates the vertex normals
{
for (int i=0;i<triangles;i++) fasttriangle[i].regenerateNormal();
for (int i=0;i<vertices;i++) fastvertex[i].regenerateNormal();
}
public void remapUV(int w, int h, float sx, float sy)
{
rebuild();
for(int j=0,p=0;j<h;j++)
{
float v=((float)j/(float)(h-1))*sy;
for(int i=0;i<w;i++)
{
float u=((float)i/(float)(w-1))*sx;
fastvertex[p++].setUV(u,v);
}
}
}
/*
public void tilt(float fact)
{
rebuild();
for (int i=0;i<vertices;i++)
fastvertex[i].pos=warp_Vector.add(fastvertex[i].pos,warp_Vector.random(fact));
regenerate();
}
*/
public warp_Vector minimum()
{
if (vertices==0) return new warp_Vector(0f,0f,0f);
float minX=fastvertex[0].pos.x;
float minY=fastvertex[0].pos.y;
float minZ=fastvertex[0].pos.z;
for (int i=1; i<vertices; i++)
{
if(fastvertex[i].pos.x<minX) minX=fastvertex[i].pos.x;
if(fastvertex[i].pos.y<minY) minY=fastvertex[i].pos.y;
if(fastvertex[i].pos.z<minZ) minZ=fastvertex[i].pos.z;
}
return new warp_Vector(minX,minY,minZ);
}
public warp_Vector maximum()
{
if (vertices==0) return new warp_Vector(0f,0f,0f);
float maxX=fastvertex[0].pos.x;
float maxY=fastvertex[0].pos.y;
float maxZ=fastvertex[0].pos.z;
for (int i=1; i<vertices; i++)
{
if(fastvertex[i].pos.x>maxX) maxX=fastvertex[i].pos.x;
if(fastvertex[i].pos.y>maxY) maxY=fastvertex[i].pos.y;
if(fastvertex[i].pos.z>maxZ) maxZ=fastvertex[i].pos.z;
}
return new warp_Vector(maxX,maxY,maxZ);
}
public void detach()
// Centers the object in its coordinate system
// The offset from origin to object center will be transfered to the matrix,
// so your object actually does not move.
// Usefull if you want prepare objects for self rotation.
{
warp_Vector center=getCenter();
for (int i=0;i<vertices;i++)
{
fastvertex[i].pos.x-=center.x;
fastvertex[i].pos.y-=center.y;
fastvertex[i].pos.z-=center.z;
}
shift(center);
}
public warp_Vector getCenter()
// Returns the center of this object
{
warp_Vector max = maximum();
warp_Vector min = minimum();
return new warp_Vector((max.x+min.x)/2,(max.y+min.y)/2,(max.z+min.z)/2);
}
public warp_Vector getDimension()
// Returns the x,y,z - Dimension of this object
{
warp_Vector max=maximum();
warp_Vector min=minimum();
return new warp_Vector(max.x-min.x,max.y-min.y,max.z-min.z);
}
public void matrixMeltdown()
// Applies the transformations in the matrix to all vertices
// and resets the matrix to untransformed.
{
rebuild();
for (int i=vertices-1;i>=0;i--)
fastvertex[i].pos=fastvertex[i].pos.transform(matrix);
regenerate();
matrix.reset();
normalmatrix.reset();
}
public warp_Object getClone()
{
warp_Object obj=new warp_Object();
rebuild();
for(int i=0;i<vertices;i++) obj.addVertex(fastvertex[i].getClone());
for(int i=0;i<triangles;i++) obj.addTriangle(fasttriangle[i].getClone());
obj.name=name+" [cloned]";
obj.material=material;
obj.matrix=matrix.getClone();
obj.normalmatrix=normalmatrix.getClone();
obj.rebuild();
return obj;
}
/*
public void removeDuplicateVertices()
{
rebuild();
Vector edgesToCollapse=new Vector();
for (int i=0;i<vertices;i++)
for (int j=i+1;j<vertices;j++)
if (vertex[i].equals(vertex[j],0.0001f))
edgesToCollapse.addElement(new warp_Edge(vertex[i],vertex[j]));
Enumeration enum=edgesToCollapse.elements();
while(enum.hasMoreElements())
{
edgeCollapse((warp_Edge)enum.nextElement());
}
removeDegeneratedTriangles();
}
public void removeDegeneratedTriangles()
{
rebuild();
for (int i=0;i<triangles;i++)
if (triangle[i].degenerated()) removeTriangleAt(i);
dirty=true;
rebuild();
}
private void edgeCollapse(warp_Edge edge)
// Collapses the edge [u,v] by replacing v by u
{
warp_Vertex u=edge.start();
warp_Vertex v=edge.end();
if (!vertexData.contains(u)) return;
if (!vertexData.contains(v)) return;
rebuild();
warp_Triangle tri;
for (int i=0; i<triangles; i++)
{
tri=triangle(i);
if (tri.p1==v) tri.p1=u;
if (tri.p2==v) tri.p2=u;
if (tri.p3==v) tri.p3=u;
}
vertexData.removeElement(v);
}
*/
}
}
@@ -1,309 +0,0 @@
using System;
namespace Rednettle.Warp3D
{
/// <summary>
/// Summary description for warp_ObjectFactory.
/// </summary>
public class warp_ObjectFactory
{
public static double pi = 3.1415926535;
public static double deg2rad = pi / 180;
public static warp_Object SIMPLEPLANE(float size, bool doubleSided)
{
warp_Object newObject = new warp_Object();
newObject.addVertex( new warp_Vertex( -size, 0f, size, 0, 0 ) );
newObject.addVertex( new warp_Vertex( size, 0f, size, 4f, 0 ) );
newObject.addVertex( new warp_Vertex( size, 0f, -size, 4f, 4f ) );
newObject.addVertex( new warp_Vertex( -size, 0f, -size, 0, 4f ) );
newObject.addTriangle(0, 3, 2);
newObject.addTriangle(0, 2, 1);
if(doubleSided)
{
newObject.addTriangle(0, 2, 3);
newObject.addTriangle(0, 1, 2);
}
return newObject;
}
public static warp_Object CUBE(float size)
{
return BOX(size, size, size);
}
public static warp_Object BOX(warp_Vector size)
{
return BOX(size.x, size.y, size.z);
}
public static warp_Object BOX(float xsize, float ysize, float zsize)
{
float x = (float) Math.Abs(xsize / 2);
float y = (float) Math.Abs(ysize / 2);
float z = (float) Math.Abs(zsize / 2);
float xx, yy, zz;
warp_Object n = new warp_Object();
int[] xflag = new int[6];
int[] yflag = new int[6];
int[] zflag = new int[6];
xflag[0] = 10;
yflag[0] = 3;
zflag[0] = 0;
xflag[1] = 10;
yflag[1] = 15;
zflag[1] = 3;
xflag[2] = 15;
yflag[2] = 3;
zflag[2] = 10;
xflag[3] = 10;
yflag[3] = 0;
zflag[3] = 12;
xflag[4] = 0;
yflag[4] = 3;
zflag[4] = 5;
xflag[5] = 5;
yflag[5] = 3;
zflag[5] = 15;
for (int side = 0; side < 6; side++)
{
for (int i = 0; i < 4; i++)
{
xx = ( (xflag[side] & (1 << i)) > 0) ? x : -x;
yy = ( (yflag[side] & (1 << i)) > 0) ? y : -y;
zz = ( (zflag[side] & (1 << i)) > 0) ? z : -z;
n.addVertex(xx, yy, zz, i & 1, (i & 2) >> 1);
}
int t = side << 2;
n.addTriangle(t, t + 2, t + 3);
n.addTriangle(t, t + 3, t + 1);
}
return n;
}
public static warp_Object CONE(float height, float radius, int segments)
{
warp_Vector[] path = new warp_Vector[4];
float h = height / 2;
path[0] = new warp_Vector(0, h, 0);
path[1] = new warp_Vector(radius, -h, 0);
path[2] = new warp_Vector(radius, -h, 0);
path[3] = new warp_Vector(0, -h, 0);
return ROTATIONOBJECT(path, segments);
}
public static warp_Object CYLINDER(float height, float radius,int segments)
{
warp_Vector[] path = new warp_Vector[6];
float h = height / 2;
path[0] = new warp_Vector(0, h, 0);
path[1] = new warp_Vector(radius, h, 0);
path[2] = new warp_Vector(radius, h, 0);
path[3] = new warp_Vector(radius, -h, 0);
path[4] = new warp_Vector(radius, -h, 0);
path[5] = new warp_Vector(0, -h, 0);
return ROTATIONOBJECT(path, segments);
}
public static warp_Object SPHERE(float radius, int segments)
{
warp_Vector[] path = new warp_Vector[segments];
float x, y, angle;
path[0] = new warp_Vector(0, radius, 0);
path[segments - 1] = new warp_Vector(0, -radius, 0);
for (int i = 1; i < segments - 1; i++)
{
angle = - ( ( (float) i / (float) (segments - 2)) - 0.5f) *
3.14159265f;
x = (float) Math.Cos(angle) * radius;
y = (float) Math.Sin(angle) * radius;
path[i] = new warp_Vector(x, y, 0);
}
return ROTATIONOBJECT(path, segments);
}
public static warp_Object ROTATIONOBJECT(warp_Vector[] path, int sides)
{
int steps = sides + 1;
warp_Object newObject = new warp_Object();
double alpha = 2 * pi / ( (double) steps - 1);
float qx, qz;
int nodes = path.GetLength(0);
warp_Vertex vertex = null;
float u, v; // Texture coordinates
for (int j = 0; j < steps; j++)
{
u = (float) (steps - j - 1) / (float) (steps - 1);
for (int i = 0; i < nodes; i++)
{
v = (float) i / (float) (nodes - 1);
qx = (float) (path[i].x * Math.Cos(j * alpha) +
path[i].z * Math.Sin(j * alpha));
qz = (float) (path[i].z * Math.Cos(j * alpha) -
path[i].x * Math.Sin(j * alpha));
vertex = new warp_Vertex(qx, path[i].y, qz);
vertex.u = u;
vertex.v = v;
newObject.addVertex(vertex);
}
}
for (int j = 0; j < steps - 1; j++)
{
for (int i = 0; i < nodes - 1; i++)
{
newObject.addTriangle(i + nodes * j, i + nodes * (j + 1),
i + 1 + nodes * j);
newObject.addTriangle(i + nodes * (j + 1),
i + 1 + nodes * (j + 1),
i + 1 + nodes * j);
}
}
for (int i = 0; i < nodes - 1; i++)
{
newObject.addTriangle(i + nodes * (steps - 1), i,
i + 1 + nodes * (steps - 1));
newObject.addTriangle(i, i + 1, i + 1 + nodes * (steps - 1));
}
return newObject;
}
public static warp_Object TORUSKNOT(float p, float q, float r_tube,float r_out, float r_in, float h,int segments, int steps)
{
float x, y, z, r, t, theta;
warp_Vector[] path = new warp_Vector[segments + 1];
for (int i = 0; i < segments + 1; i++)
{
t = 2 * 3.14159265f * i / (float) segments;
r = r_out + r_in * warp_Math.cos(p * t);
z = h * warp_Math.sin(p * t);
theta = q * t;
x = r * warp_Math.cos(theta);
y = r * warp_Math.sin(theta);
path[i] = new warp_Vector(x, y, z);
}
return TUBE(path, r_tube, steps, true);
}
public static warp_Object SPIRAL(float h, float r_out, float r_in,
float r_tube, float w, float f,
int segments, int steps)
{
float x, y, z, r, t, theta;
warp_Vector[] path = new warp_Vector[segments + 1];
for (int i = 0; i < segments + 1; i++)
{
t = (float) i / (float) segments;
r = r_out + r_in * warp_Math.sin(2 * 3.14159265f * f * t);
z = (h / 2) + h * t;
theta = 2 * 3.14159265f * w * t;
x = r * warp_Math.cos(theta);
y = r * warp_Math.sin(theta);
path[i] = new warp_Vector(x, y, z);
}
return TUBE(path, r_tube, steps, false);
}
public static warp_Object TUBE(warp_Vector[] path, float r, int steps, bool closed)
{
warp_Vector[] circle = new warp_Vector[steps];
float angle;
for (int i = 0; i < steps; i++)
{
angle = 2 * 3.14159265f * (float) i / (float) steps;
circle[i] = new warp_Vector(r * warp_Math.cos(angle),
r * warp_Math.sin(angle), 0f);
}
warp_Object newObject = new warp_Object();
int segments = path.GetLength(0);
warp_Vector forward, up, right;
warp_Matrix frenetmatrix;
warp_Vertex tempvertex;
float relx, rely;
int a, b, c, d;
for (int i = 0; i < segments; i++)
{
// Calculate frenet frame matrix
if (i != segments - 1)
{
forward = warp_Vector.sub(path[i + 1], path[i]);
}
else
{
if (!closed)
{
forward = warp_Vector.sub(path[i], path[i - 1]);
}
else
{
forward = warp_Vector.sub(path[1], path[0]);
}
}
forward.normalize();
up = new warp_Vector(0f, 0f, 1f);
right = warp_Vector.getNormal(forward, up);
up = warp_Vector.getNormal(forward, right);
frenetmatrix = new warp_Matrix(right, up, forward);
frenetmatrix.shift(path[i].x, path[i].y, path[i].z);
// Add nodes
relx = (float) i / (float) (segments - 1);
for (int k = 0; k < steps; k++)
{
rely = (float) k / (float) steps;
tempvertex = new warp_Vertex(circle[k].transform(frenetmatrix));
tempvertex.u = relx;
tempvertex.v = rely;
newObject.addVertex(tempvertex);
}
}
for (int i = 0; i < segments - 1; i++)
{
for (int k = 0; k < steps - 1; k++)
{
a = i * steps + k;
b = a + 1;
c = a + steps;
d = b + steps;
newObject.addTriangle(a, c, b);
newObject.addTriangle(b, c, d);
}
a = (i + 1) * steps - 1;
b = a + 1 - steps;
c = a + steps;
d = b + steps;
newObject.addTriangle(a, c, b);
newObject.addTriangle(b, c, d);
}
return newObject;
}
}
}
@@ -1,123 +0,0 @@
using System;
using System.Collections;
using System.Text;
using System.Diagnostics;
namespace Rednettle.Warp3D
{
public class warp_Quaternion
{
public float X;
public float Y;
public float Z;
public float W;
public warp_Quaternion()
{
}
public warp_Quaternion( float x, float y, float z, float w )
{
this.X = x;
this.Y = y;
this.Z = z;
this.W = w;
}
public warp_Quaternion getClone()
{
return new warp_Quaternion( this.X, this.Y, this.Z, this.W );
}
static public warp_Quaternion matrix( warp_Matrix xfrm )
{
warp_Quaternion quat = new warp_Quaternion();
// Check the sum of the diagonal
float tr = xfrm[ 0, 0 ] + xfrm[ 1, 1 ] + xfrm[ 2, 2 ];
if ( tr > 0.0f )
{
// The sum is positive
// 4 muls, 1 div, 6 adds, 1 trig function call
float s = ( float )Math.Sqrt( tr + 1.0f );
quat.W = s * 0.5f;
s = 0.5f / s;
quat.X = ( xfrm[ 1, 2 ] - xfrm[ 2, 1 ] ) * s;
quat.Y = ( xfrm[ 2, 0 ] - xfrm[ 0, 2 ] ) * s;
quat.Z = ( xfrm[ 0, 1 ] - xfrm[ 1, 0 ] ) * s;
}
else
{
// The sum is negative
// 4 muls, 1 div, 8 adds, 1 trig function call
int[] nIndex = { 1, 2, 0 };
int i, j, k;
i = 0;
if ( xfrm[ 1, 1 ] > xfrm[ i, i ] )
i = 1;
if ( xfrm[ 2, 2 ] > xfrm[ i, i ] )
i = 2;
j = nIndex[ i ];
k = nIndex[ j ];
float s = ( float )Math.Sqrt( ( xfrm[ i, i ] - ( xfrm[ j, j ] + xfrm[ k, k ] ) ) + 1.0f );
quat[ i ] = s * 0.5f;
if ( s != 0.0 )
{
s = 0.5f / s;
}
quat[ j ] = ( xfrm[ i, j ] + xfrm[ j, i ] ) * s;
quat[ k ] = ( xfrm[ i, k ] + xfrm[ k, i ] ) * s;
quat[ 3 ] = ( xfrm[ j, k ] - xfrm[ k, j ] ) * s;
}
return quat;
}
public float this[ int index ]
{
get
{
Debug.Assert( 0 <= index && index <= 3 );
if ( index <= 1 )
{
if ( index == 0 )
{
return this.X;
}
return this.Y;
}
if ( index == 2 )
{
return this.Z;
}
return this.W;
}
set
{
Debug.Assert( 0 <= index && index <= 3 );
if ( index <= 1 )
{
if ( index == 0 )
{
this.X = value;
}
else
{
this.Y = value;
}
}
else
{
if ( index == 2 )
{
this.Z = value;
}
else
{
this.W = value;
}
}
}
}
}
}
@@ -1,614 +0,0 @@
using System;
namespace Rednettle.Warp3D
{
/// <summary>
/// Summary description for warp_Rasterizer.
/// </summary>
public class warp_Rasterizer
{
private bool materialLoaded=false;
private bool lightmapLoaded=false;
public bool ready=false;
// Current material settings
private int color=0;
private int currentColor=0;
private int transparency=0;
private int reflectivity=0;
private int refraction=0;
private warp_Texture texture=null;
private int[] envmap=null;
private int[] diffuse=null;
private int[] specular=null;
private short[] refractionMap=null;
private int tw=0;
private int th=0;
private int tbitW=0;
private int tbitH=0;
// Rasterizer hints
private int mode=0;
private int F=0; // FLAT
private int W=1; // WIREFRAME
private int P=2; // PHONG
private int E=4; // ENVMAP
private int T=8; // TEXTURED
private int SHADED = 0;
warp_Vertex p1, p2, p3, tempVertex;
private int
bkgrd, c, s, lutID, r, //lutID is position in LUT (diffuse,envmap,specular)
x1, x2, x3, x4, y1, y2, y3, z1, z2, z3, z4,
x, y, z, k, dx, dy, dz, offset, pos, temp,
xL, xR, xBase, zBase, xMax, yMax, dxL, dxR, dzBase,
nx1, nx2, nx3, nx4, ny1, ny2, ny3, ny4,
nxBase, nyBase,
dnx4, dny4,
dnx, dny, nx, ny,
dnxBase, dnyBase,
dtx4, dty4;
private float
tx1, tx2, tx3, tx4, ty1, ty2, ty3, ty4,
txBase, tyBase,
tx, ty, sw,
dtxBase, dtyBase,
dtx, dty,
sw1, sw2, sw3, sw4, swBase, dsw, dswBase;
warp_Screen screen;
int[] zBuffer;
int[] idBuffer;
int width,height;
bool useIdBuffer;
int zFar=0xffffff;
int currentId=0;
// Constructor
public warp_Rasterizer(warp_RenderPipeline pipeline)
{
SHADED = P | E | T;
rebuildReferences(pipeline);
loadLightmap(pipeline.lightmap);
}
// References
public void rebuildReferences(warp_RenderPipeline pipeline)
{
screen=pipeline.screen;
zBuffer=pipeline.zBuffer;
idBuffer=pipeline.idBuffer;
width=screen.width;
height=screen.height;
useIdBuffer=pipeline.useId;
}
// Lightmap loader
public void loadLightmap(warp_Lightmap lm)
{
if (lm==null) return;
diffuse=lm.diffuse;
specular=lm.specular;
lightmapLoaded=true;
ready=lightmapLoaded&&materialLoaded;
}
// Material loader
public void loadMaterial(warp_Material material)
{
color=material.color;
transparency=material.transparency;
reflectivity=material.reflectivity;
texture=material.texture;
if (material.envmap!=null) envmap=material.envmap.pixel;
else envmap=null;
if (texture!=null)
{
tw=texture.width-1;
th=texture.height-1;
tbitW=texture.bitWidth;
tbitH=texture.bitHeight;
}
mode=0;
if (!material.flat) mode|=P;
if (envmap!=null) mode|=E;
if (texture!=null) mode|=T;
if (material.wireframe) mode|=W;
materialLoaded=true;
ready=lightmapLoaded&&materialLoaded;
}
public void render(warp_Triangle tri)
{
if (!ready) {return;}
if (tri.parent == null){return;}
if ( (mode & W) != 0)
{
drawWireframe(tri, color);
if ( (mode & W) == 0){return;}
}
p1 = tri.p1;
p2 = tri.p2;
p3 = tri.p3;
if (p1.y > p2.y){tempVertex = p1;p1 = p2;p2 = tempVertex;}
if (p2.y > p3.y){tempVertex = p2;p2 = p3;p3 = tempVertex;}
if (p1.y > p2.y){tempVertex = p1;p1 = p2;p2 = tempVertex;}
if (p1.y >= height){return;}
if (p3.y < 0){return;}
if (p1.y == p3.y){return;}
if (mode == F)
{
lutID = (int) (tri.n2.x * 127 + 127) +( (int) (tri.n2.y * 127 + 127) << 8);
c = warp_Color.multiply(color, diffuse[lutID]);
s = warp_Color.scale(specular[lutID], reflectivity);
currentColor = warp_Color.add(c, s);
}
currentId = (tri.parent.id << 16) | tri.id;
x1 = p1.x << 8;
x2 = p2.x << 8;
x3 = p3.x << 8;
y1 = p1.y;
y2 = p2.y;
y3 = p3.y;
x4 = x1 + (x3 - x1) * (y2 - y1) / (y3 - y1);
x1 <<= 8;
x2 <<= 8;
x3 <<= 8;
x4 <<= 8;
z1 = p1.z;
z2 = p2.z;
z3 = p3.z;
nx1 = p1.nx << 16;
nx2 = p2.nx << 16;
nx3 = p3.nx << 16;
ny1 = p1.ny << 16;
ny2 = p2.ny << 16;
ny3 = p3.ny << 16;
sw1 = 1.0f / p1.sw;
sw2 = 1.0f / p2.sw;
sw3 = 1.0f / p3.sw;
tx1 = p1.tx * sw1;
tx2 = p2.tx * sw2;
tx3 = p3.tx * sw3;
ty1 = p1.ty * sw1;
ty2 = p2.ty * sw2;
ty3 = p3.ty * sw3;
dx = (x4 - x2) >> 16;
if (dx == 0)
{
return;
}
temp = 256 * (y2 - y1) / (y3 - y1);
z4 = z1 + ( (z3 - z1) >> 8) * temp;
nx4 = nx1 + ( (nx3 - nx1) >> 8) * temp;
ny4 = ny1 + ( (ny3 - ny1) >> 8) * temp;
float tf = (float)(y2 - y1) / (float)(y3 - y1);
tx4 = tx1 + ( (tx3 - tx1) * tf);
ty4 = ty1 + ( (ty3 - ty1) * tf);
sw4 = sw1 + ( (sw3 - sw1) * tf) ;
dz = (z4 - z2) / dx;
dnx = (nx4 - nx2) / dx;
dny = (ny4 - ny2) / dx;
dtx = (tx4 - tx2) / dx;
dty = (ty4 - ty2) / dx;
dsw = (sw4 - sw2) / dx;
if (dx < 0)
{
temp = x2;
x2 = x4;
x4 = temp;
z2 = z4;
tx2 = tx4;
ty2 = ty4;
sw2 = sw4;
nx2 = nx4;
ny2 = ny4;
}
if (y2 >= 0)
{
dy = y2 - y1;
if (dy != 0)
{
dxL = (x2 - x1) / dy;
dxR = (x4 - x1) / dy;
dzBase = (z2 - z1) / dy;
dnxBase = (nx2 - nx1) / dy;
dnyBase = (ny2 - ny1) / dy;
dtxBase = (tx2 - tx1) / dy;
dtyBase = (ty2 - ty1) / dy;
dswBase = (sw2 - sw1) / dy;
}
xBase = x1;
xMax = x1;
zBase = z1;
nxBase = nx1;
nyBase = ny1;
txBase = tx1;
tyBase = ty1;
swBase = sw1;
if (y1 < 0)
{
xBase -= y1 * dxL;
xMax -= y1 * dxR;
zBase -= y1 * dzBase;
nxBase -= y1 * dnxBase;
nyBase -= y1 * dnyBase;
txBase -= y1 * dtxBase;
tyBase -= y1 * dtyBase;
swBase -= y1 * dswBase;
y1 = 0;
}
y2 = (y2 < height) ? y2 : height;
offset = y1 * width;
for (y = y1; y < y2; y++)
{
renderLine();
}
}
if (y2 < height)
{
dy = y3 - y2;
if (dy != 0)
{
dxL = (x3 - x2) / dy;
dxR = (x3 - x4) / dy;
dzBase = (z3 - z2) / dy;
dnxBase = (nx3 - nx2) / dy;
dnyBase = (ny3 - ny2) / dy;
dtxBase = (tx3 - tx2) / dy;
dtyBase = (ty3 - ty2) / dy;
dswBase = (sw3 - sw2) / dy;
}
xBase = x2;
xMax = x4;
zBase = z2;
nxBase = nx2;
nyBase = ny2;
txBase = tx2;
tyBase = ty2;
swBase = sw2;
if (y2 < 0)
{
xBase -= y2 * dxL;
xMax -= y2 * dxR;
zBase -= y2 * dzBase;
nxBase -= y2 * dnxBase;
nyBase -= y2 * dnyBase;
txBase -= y2 * dtxBase;
tyBase -= y2 * dtyBase;
swBase -= y2 * dswBase;
y2 = 0;
}
y3 = (y3 < height) ? y3 : height;
offset = y2 * width;
for (y = y2; y < y3; y++)
{
renderLine();
}
}
}
private void renderLine()
{
xL=xBase>>16;
xR=xMax>>16;
z=zBase;
nx=nxBase;
ny=nyBase;
tx=txBase;
ty=tyBase;
sw = swBase;
if (xL<0)
{
z-=xL*dz;
nx-=xL*dnx;
ny-=xL*dny;
tx-=xL*dtx;
ty-=xL*dty;
sw -= xL * dsw;
xL=0;
}
xR=(xR<width)?xR:width;
if (mode==F) renderLineF();
else if ((mode&SHADED)==P) renderLineP();
else if ((mode&SHADED)==E) renderLineE();
else if ((mode&SHADED)==T) renderLineT();
else if ((mode&SHADED)==(P|E)) renderLinePE();
else if ((mode&SHADED)==(P|T)) renderLinePT();
else if ((mode&SHADED)==(P|E|T)) renderLinePET();
offset+=width;
xBase+=dxL;
xMax+=dxR;
zBase+=dzBase;
nxBase+=dnxBase;
nyBase+=dnyBase;
txBase+=dtxBase;
tyBase+=dtyBase;
swBase += dswBase;
}
// Fast scanline rendering
private void renderLineF()
{
for ( x = xL; x < xR; x++ )
{
pos = x + offset;
if ( z < zBuffer[ pos ] )
{
bkgrd = screen.pixels[ pos ];
c = warp_Color.transparency( bkgrd, currentColor, transparency );
screen.pixels[ pos ] = c;
zBuffer[pos] = z;
if ( useIdBuffer ) idBuffer[ pos ] = currentId;
}
z += dz;
}
}
private void renderLineP()
{
for ( x = xL; x < xR; x++ )
{
pos = x + offset;
if ( z < zBuffer[ pos ] )
{
lutID = ( ( nx >> 16 ) & 255 ) + ( ( ( ny >> 16 ) & 255 ) << 8 );
bkgrd = screen.pixels[ pos ];
c = warp_Color.multiply( color, diffuse[ lutID ] );
s = specular[ lutID ];
s = warp_Color.scale( s, reflectivity );
c = warp_Color.transparency( bkgrd, c, transparency );
c = warp_Color.add( c, s );
screen.pixels[ pos ] = c;
zBuffer[ pos ] = z;
if ( useIdBuffer ) idBuffer[ pos ] = currentId;
}
z += dz;
nx += dnx;
ny += dny;
}
}
private void renderLineE()
{
for ( x = xL; x < xR; x++ )
{
pos = x + offset;
if ( z < zBuffer[ pos ] )
{
lutID = ( ( nx >> 16 ) & 255 ) + ( ( ( ny >> 16 ) & 255 ) << 8 );
bkgrd = screen.pixels[ pos ];
s = warp_Color.add( specular[ lutID ], envmap[ lutID ] );
s = warp_Color.scale( s, reflectivity );
c = warp_Color.transparency( bkgrd, s, transparency );
screen.pixels[ pos ] = c;
zBuffer[ pos ] = z;
if ( useIdBuffer ) idBuffer[ pos ] = currentId;
}
z += dz;
nx += dnx;
ny += dny;
}
}
private void renderLineT()
{
for ( x = xL; x < xR; x++ )
{
pos = x + offset;
if ( z < zBuffer[ pos ] )
{
bkgrd = screen.pixels[ pos ];
c = texture.pixel[ ( ( ( int )( tx / sw ) ) & tw ) + ( ( ( ( int )( ty / sw ) ) & th ) << tbitW ) ];
c = warp_Color.transparency( bkgrd, c, transparency );
screen.pixels[ pos ] = c;
zBuffer[ pos ] = z;
if ( useIdBuffer ) idBuffer[ pos ] = currentId;
}
z += dz;
tx += dtx;
ty += dty;
sw += dsw;
}
}
private void renderLinePE()
{
for ( x = xL; x < xR; x++ )
{
pos = x + offset;
if ( z < zBuffer[ pos ] )
{
lutID = ( ( nx >> 16 ) & 255 ) + ( ( ( ny >> 16 ) & 255 ) << 8 );
bkgrd = screen.pixels[ pos ];
c = warp_Color.multiply( color, diffuse[ lutID ] );
s = warp_Color.add( specular[ lutID ], envmap[ lutID ] );
s = warp_Color.scale( s, reflectivity );
c = warp_Color.transparency( bkgrd, c, transparency );
c = warp_Color.add( c, s );
screen.pixels[ pos ] = c;
zBuffer[ pos ] = z;
if ( useIdBuffer ) idBuffer[ pos ] = currentId;
}
z += dz;
nx += dnx;
ny += dny;
}
}
private void renderLinePT()
{
for (x=xL;x<xR;x++)
{
pos=x+offset;
if ( z < zBuffer[ pos ] )
{
lutID=((nx>>16)&255)+(((ny>>16)&255)<<8);
bkgrd = screen.pixels[ pos ];
c = texture.pixel[ ( ( (int)(tx / sw) ) & tw) + ( ( ( (int)(ty / sw) ) & th) << tbitW)];
c = warp_Color.multiply(c,diffuse[lutID]);
s = warp_Color.scale(specular[lutID],reflectivity);
c = warp_Color.transparency(bkgrd, c, transparency);
c=warp_Color.add(c,s);
screen.pixels[ pos ] = c;
zBuffer[ pos ] = z;
if (useIdBuffer) idBuffer[pos]=currentId;
}
z+=dz;
nx+=dnx;
ny+=dny;
tx+=dtx;
ty+=dty;
sw += dsw;
}
}
private void renderLinePET()
{
for (x=xL;x<xR;x++)
{
pos=x+offset;
if ( z < zBuffer[ pos ] )
{
lutID=((nx>>16)&255)+(((ny>>16)&255)<<8);
bkgrd = screen.pixels[ pos ];
c = texture.pixel[ ( ( (int)(tx / sw) ) & tw) + ( ( ( (int)(ty / sw) ) & th) << tbitW)];
c=warp_Color.multiply(c,diffuse[lutID]);
s=warp_Color.add(specular[lutID],envmap[lutID]);
s=warp_Color.scale(s,reflectivity);
c=warp_Color.transparency(bkgrd,c,transparency);
c=warp_Color.add(c,s);
screen.pixels[ pos ] = c;
zBuffer[ pos ] = z;
if (useIdBuffer) idBuffer[pos]=currentId;
}
z+=dz;
nx+=dnx;
ny+=dny;
tx+=dtx;
ty+=dty;
sw += dsw;
}
}
private void drawWireframe(warp_Triangle tri, int defaultcolor)
{
drawLine(tri.p1,tri.p2,defaultcolor);
drawLine(tri.p2,tri.p3,defaultcolor);
drawLine(tri.p3,tri.p1,defaultcolor);
}
private void drawLine(warp_Vertex a, warp_Vertex b ,int color)
{
warp_Vertex temp;
if ((a.clipcode&b.clipcode)!=0) return;
dx=(int)Math.Abs(a.x-b.x);
dy=(int)Math.Abs(a.y-b.y);
dz=0;
if (dx>dy)
{
if (a.x>b.x){temp=a; a=b; b=temp;}
if (dx>0)
{
dz=(b.z-a.z)/dx;
dy=((b.y-a.y)<<16)/dx;
}
z=a.z;
y=a.y<<16;
for(x=a.x;x<=b.x;x++)
{
y2=y>>16;
if (warp_Math.inrange(x,0,width-1)&&warp_Math.inrange(y2,0,height-1))
{
offset=y2*width;
if (z<zBuffer[x+offset])
{
{
screen.pixels[ x + offset ] = color;
zBuffer[x+offset]=z;
}
}
if (useIdBuffer) idBuffer[x+offset]=currentId;
}
z+=dz; y+=dy;
}
}
else
{
if (a.y>b.y){ temp=a; a=b; b=temp; }
if (dy>0)
{
dz=(b.z-a.z)/dy;
dx=((b.x-a.x)<<16)/dy;
}
z=a.z;
x=a.x<<16;
for(y=a.y;y<=b.y;y++)
{
x2=x>>16;
if (warp_Math.inrange(x2,0,width-1)&&warp_Math.inrange(y,0,height-1))
{
offset=y*width;
if (z<zBuffer[x2+offset])
{
{
screen.pixels[ x2 + offset ] = color;
zBuffer[ x2 + offset ] = z;
}
}
if (useIdBuffer) idBuffer[x2+offset]=currentId;
}
z+=dz; x+=dx;
}
}
}
}
}
@@ -1,270 +0,0 @@
using System;
using System.Collections;
namespace Rednettle.Warp3D
{
/// <summary>
/// Summary description for warp_RenderPipeline.
/// </summary>
public class warp_RenderPipeline : IDisposable
{
public warp_Screen screen;
warp_Scene scene;
public warp_Lightmap lightmap;
private bool resizingRequested = false;
private int requestedWidth;
private int requestedHeight;
private double splitOffset;
public bool useId = false;
warp_Rasterizer rasterizer;
ArrayList opaqueQueue = new ArrayList();
ArrayList transparentQueue = new ArrayList();
int zFar = 0xffffff;
public int[] zBuffer;
public int[] idBuffer;
public warp_RenderPipeline(warp_Scene scene, int w, int h)
{
this.scene=scene;
screen=new warp_Screen(w,h);
zBuffer = new int[screen.width * screen.height];
rasterizer=new warp_Rasterizer(this);
}
public float getFPS()
{
return (float)((int)(screen.FPS*100))/100;
}
public void buildLightMap()
{
if (lightmap == null)
{
lightmap = new warp_Lightmap(scene);
}
else
{
lightmap.rebuildLightmap();
}
rasterizer.loadLightmap(lightmap);
}
public void useIdBuffer(bool useId)
{
this.useId = useId;
if (useId)
{
idBuffer = new int[screen.width * screen.height];
}
else
{
idBuffer = null;
}
}
public void render(warp_Camera cam)
{
rasterizer.rebuildReferences(this);
warp_Math.clearBuffer( zBuffer, zFar );
//System.Array.Copy(screen.zBuffer,0,zBuffer,0,zBuffer.Length);
if (useId)
{
warp_Math.clearBuffer(idBuffer, -1);
}
if (scene.environment.background != null)
{
screen.drawBackground(scene.environment.background, 0, 0, screen.width, screen.height);
}
else
{
screen.clear(scene.environment.bgcolor);
}
cam.setScreensize(screen.width, screen.height);
scene.prepareForRendering();
emptyQueues();
// Project
warp_Matrix m = warp_Matrix.multiply(cam.getMatrix(), scene.matrix);
warp_Matrix nm = warp_Matrix.multiply(cam.getNormalMatrix(),scene.normalmatrix);
warp_Matrix vertexProjection, normalProjection;
warp_Object obj;
warp_Triangle t;
warp_Vertex v;
int w = screen.width;
int h = screen.height;
for (int id = scene.objects - 1; id >= 0; id--)
{
obj = scene.wobject[id];
if (obj.visible)
{
vertexProjection = obj.matrix.getClone();
normalProjection = obj.normalmatrix.getClone();
vertexProjection.transform(m);
normalProjection.transform(nm);
for (int i = obj.vertices - 1; i >= 0; i--)
{
v = obj.fastvertex[i];
v.project(vertexProjection, normalProjection, cam);
v.clipFrustrum(w, h);
}
for (int i = obj.triangles - 1; i >= 0; i--)
{
t = obj.fasttriangle[i];
t.project(normalProjection);
t.clipFrustrum(w, h);
enqueueTriangle(t);
}
}
}
//screen.lockImage();
warp_Triangle[] tri;
tri = getOpaqueQueue();
if (tri != null)
{
for (int i = tri.GetLength(0) - 1; i >= 0; i--)
{
rasterizer.loadMaterial(tri[i].parent.material);
rasterizer.render(tri[i]);
}
}
tri = getTransparentQueue();
if (tri != null)
{
for (int i = 0; i < tri.GetLength(0); i++)
{
rasterizer.loadMaterial(tri[i].parent.material);
rasterizer.render(tri[i]);
}
}
//screen.unlockImage();
}
private void performResizing()
{
resizingRequested = false;
//screen.resize(requestedWidth, requestedHeight);
zBuffer = new int[screen.width * screen.height];
if (useId)
{
idBuffer = new int[screen.width * screen.height];
}
}
// Triangle sorting
private void emptyQueues()
{
opaqueQueue.Clear();
transparentQueue.Clear();
}
private void enqueueTriangle(warp_Triangle tri)
{
if (tri.parent.material == null)
{
return;
}
if (tri.visible == false)
{
return;
}
if ( (tri.parent.material.transparency == 255) &&
(tri.parent.material.reflectivity == 0))
{
return;
}
if (tri.parent.material.transparency > 0)
{
transparentQueue.Add(tri);
}
else
{
opaqueQueue.Add(tri);
}
}
private warp_Triangle[] getOpaqueQueue()
{
if (opaqueQueue.Count==0) return null;
IEnumerator enumerator=opaqueQueue.GetEnumerator();
warp_Triangle[] tri=new warp_Triangle[opaqueQueue.Count];
int id=0;
while (enumerator.MoveNext())
tri[id++]=(warp_Triangle)enumerator.Current;
return sortTriangles(tri,0,tri.GetLength(0)-1);
}
private warp_Triangle[] getTransparentQueue()
{
if (transparentQueue.Count==0) return null;
IEnumerator enumerator=transparentQueue.GetEnumerator();
warp_Triangle[] tri=new warp_Triangle[transparentQueue.Count];
int id=0;
while (enumerator.MoveNext())
tri[id++]=(warp_Triangle)enumerator.Current;
return sortTriangles(tri,0,tri.GetLength(0)-1);
}
private warp_Triangle[] sortTriangles(warp_Triangle[] tri, int L, int R)
{
//FIX: Added Index bounds checking. (Was causing random exceptions) - Created by: X
if (L < 0) L = 0;
if (L > tri.GetLength(0)) L = tri.GetLength(0);
if (R < 0) R = 0;
if (R > tri.GetLength(0)) R = tri.GetLength(0);
// - Created by: X
float m = (tri[L].dist + tri[R].dist) / 2;
int i=L;
int j=R;
warp_Triangle temp;
do
{
while (tri[i].dist>m) i++;
while (tri[j].dist<m) j--;
if (i<=j)
{
temp=tri[i];
tri[i]=tri[j];
tri[j]=temp;
i++;
j--;
}
}
while (j>=i);
if (L<j) sortTriangles(tri,L,j);
if (R>i) sortTriangles(tri,i,R);
return tri;
}
public void Dispose()
{
}
}
}
-363
View File
@@ -1,363 +0,0 @@
using System;
using System.Collections;
using System.Drawing;
using System.Timers;
namespace Rednettle.Warp3D
{
/// <summary>
/// Summary description for warp_Scene.
/// </summary>
public class warp_Scene : warp_CoreObject
{
public static String version="1.0.0";
public static String release="0010";
public warp_RenderPipeline renderPipeline;
public int width,height;
public warp_Environment environment=new warp_Environment();
public warp_Camera defaultCamera=warp_Camera.FRONT();
public warp_Object[] wobject;
public warp_Light[] light;
public int objects=0;
public int lights=0;
private bool objectsNeedRebuild=true;
private bool lightsNeedRebuild=true;
protected bool preparedForRendering=false;
public warp_Vector normalizedOffset=new warp_Vector(0f,0f,0f);
public float normalizedScale=1f;
private static bool instancesRunning=false;
public Hashtable objectData=new Hashtable();
public Hashtable lightData=new Hashtable();
public Hashtable materialData=new Hashtable();
public Hashtable cameraData=new Hashtable();
int probes = 0;
int perf = 0;
public String fps = "0";
public int rendertime = 500;
public warp_Scene()
{
}
public warp_Scene(int w, int h)
{
showInfo();
width=w;
height=h;
renderPipeline = new warp_RenderPipeline(this,w,h);
}
public void showInfo()
{
if (instancesRunning) return;
System.Console.WriteLine();
System.Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
System.Console.WriteLine("WARP 3D Kernel "+version+" [Build "+release+"]");
System.Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
instancesRunning=true;
}
public void removeAllObjects()
{
objectData=new Hashtable();
objectsNeedRebuild=true;
rebuild();
}
public void rebuild()
{
if (objectsNeedRebuild)
{
objectsNeedRebuild=false;
objects=objectData.Count;
wobject=new warp_Object[objects];
IDictionaryEnumerator enumerator = objectData.GetEnumerator();
for (int i=objects-1;i>=0;i--)
{
enumerator.MoveNext();
wobject[i]=(warp_Object)enumerator.Value;
wobject[i].id=i;
wobject[i].rebuild();
}
}
if (lightsNeedRebuild)
{
lightsNeedRebuild = false;
lights = lightData.Count;
light = new warp_Light[lights];
IDictionaryEnumerator enumerator = lightData.GetEnumerator();
for (int i = lights - 1; i >= 0; i--)
{
enumerator.MoveNext();
light[i] = (warp_Light) enumerator.Value;
}
}
}
public warp_Object sceneobject(String key)
{
return (warp_Object) objectData[key];
}
public warp_Material material(String key)
{
return (warp_Material) materialData[key];
}
public warp_Camera camera(String key)
{
return (warp_Camera) cameraData[key];
}
public void addObject(String key, warp_Object obj)
{
obj.name=key;
objectData.Add(key, obj);
obj.parent=this;
objectsNeedRebuild=true;
}
public void removeObject(String key)
{
objectData.Remove(key);
objectsNeedRebuild=true;
preparedForRendering=false;
}
public void addMaterial(String key, warp_Material m)
{
materialData.Add(key, m);
}
public void removeMaterial(String key)
{
materialData.Remove(key);
}
public void addCamera(String key, warp_Camera c)
{
cameraData.Add(key, c);
}
public void removeCamera(String key)
{
cameraData.Remove(key);
}
public void addLight(String key, warp_Light l)
{
lightData.Add(key, l);
lightsNeedRebuild = true;
}
public void removeLight(String key)
{
lightData.Remove(key);
lightsNeedRebuild = true;
preparedForRendering = false;
}
public void prepareForRendering()
{
if (preparedForRendering) return;
preparedForRendering=true;
System.Console.WriteLine("warp_Scene| prepareForRendering : Preparing for realtime rendering ...");
rebuild();
renderPipeline.buildLightMap();
printSceneInfo();
}
public void printSceneInfo()
{
System.Console.WriteLine("warp_Scene| Objects : "+objects);
System.Console.WriteLine("warp_Scene| Vertices : "+countVertices());
System.Console.WriteLine("warp_Scene| Triangles : "+countTriangles());
}
public void render()
{
DateTime n = DateTime.Now;
renderPipeline.render(this.defaultCamera);
TimeSpan s = DateTime.Now-n;
perf+=s.Milliseconds;
if(probes++==32)
{
probes=0;
fps = (float)perf/32+","+(float)1000/ (float)(perf/32);
perf=0;
}
}
public Bitmap getImage()
{
return renderPipeline.screen.getImage();
}
public String getFPS()
{
return fps;
}
/*
public java.awt.Dimension size()
{
return new java.awt.Dimension(width,height);
}
*/
public void setBackgroundColor(int bgcolor)
{
environment.bgcolor = bgcolor;
}
public void setBackground(warp_Texture t)
{
environment.setBackground(t);
}
public void setAmbient(int ambientcolor)
{
environment.ambient=ambientcolor;
}
public int countVertices()
{
int counter=0;
for (int i=0;i<objects;i++) counter+=wobject[i].vertices;
return counter;
}
public int countTriangles()
{
int counter=0;
for (int i=0;i<objects;i++) counter+=wobject[i].triangles;
return counter;
}
public void useIdBuffer(bool buffer)
{
renderPipeline.useIdBuffer(buffer);
}
public warp_Triangle identifyTriangleAt(int xpos, int ypos)
{
if (!renderPipeline.useId)
{
return null;
}
if (xpos < 0 || xpos >= width)
{
return null;
}
if (ypos < 0 || ypos >= height)
{
return null;
}
int pos = xpos + renderPipeline.screen.width * ypos;
int idCode = renderPipeline.idBuffer[pos];
if (idCode < 0)
{
return null;
}
return wobject[idCode >> 16].fasttriangle[idCode & 0xFFFF];
}
public warp_Object identifyObjectAt(int xpos, int ypos)
{
warp_Triangle tri = identifyTriangleAt(xpos, ypos);
if (tri == null)
{
return null;
}
return tri.parent;
}
public void normalize()
{
objectsNeedRebuild = true;
rebuild();
warp_Vector min, max, tempmax, tempmin;
if (objects == 0)
{
return;
}
matrix = new warp_Matrix();
normalmatrix = new warp_Matrix();
max = wobject[0].maximum();
min = wobject[0].maximum();
for (int i = 0; i < objects; i++)
{
tempmax = wobject[i].maximum();
tempmin = wobject[i].maximum();
if (tempmax.x > max.x)
{
max.x = tempmax.x;
}
if (tempmax.y > max.y)
{
max.y = tempmax.y;
}
if (tempmax.z > max.z)
{
max.z = tempmax.z;
}
if (tempmin.x < min.x)
{
min.x = tempmin.x;
}
if (tempmin.y < min.y)
{
min.y = tempmin.y;
}
if (tempmin.z < min.z)
{
min.z = tempmin.z;
}
}
float xdist = max.x - min.x;
float ydist = max.y - min.y;
float zdist = max.z - min.z;
float xmed = (max.x + min.x) / 2;
float ymed = (max.y + min.y) / 2;
float zmed = (max.z + min.z) / 2;
float diameter = (xdist > ydist) ? xdist : ydist;
diameter = (zdist > diameter) ? zdist : diameter;
normalizedOffset = new warp_Vector(xmed, ymed, zmed);
normalizedScale = 2 / diameter;
shift(normalizedOffset.reverse());
scale(normalizedScale);
}
}
}
-168
View File
@@ -1,168 +0,0 @@
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
namespace Rednettle.Warp3D
{
/// <summary>
/// Summary description for warp_Screen.
/// </summary>
unsafe public class warp_Screen : IDisposable
{
public int width;
public int height;
// benchmark stuff
private DateTime timestamp;
private DateTime time;
private int probes=32;
public float FPS=0;
Bitmap image = null;
public int[] pixels;
private GCHandle handle;
public warp_Screen(int w, int h)
{
width=w;
height=h;
pixels = new int[ w * h ];
handle = GCHandle.Alloc( pixels, GCHandleType.Pinned );
IntPtr pointer = Marshal.UnsafeAddrOfPinnedArrayElement( pixels, 0 );
image = new Bitmap( w, h, w * 4, PixelFormat.Format32bppPArgb, pointer );
}
public void clear(int c)
{
warp_Math.clearBuffer( pixels, unchecked( ( int )0xff000000 ) | c );
}
public void draw(warp_Texture texture, int posx, int posy, int xsize,int ysize)
{
draw(width, height, texture, posx, posy, xsize, ysize);
}
public void drawBackground(warp_Texture texture, int posx, int posy,int xsize, int ysize)
{
draw(width, height, texture, posx, posy, xsize, ysize);
}
public Bitmap getImage()
{
return image;
}
private void draw(int width, int height, warp_Texture texture, int posx, int posy, int xsize, int ysize)
{
if (texture == null)
{
return;
}
int w = xsize;
int h = ysize;
int xBase = posx;
int yBase = posy;
int tx = texture.width * 255;
int ty = texture.height * 255;
int tw = texture.width;
int dtx = tx / w;
int dty = ty / h;
int txBase = warp_Math.crop( -xBase * dtx, 0, 255 * tx);
int tyBase = warp_Math.crop( -yBase * dty, 0, 255 * ty);
int xend = warp_Math.crop(xBase + w, 0, width);
int yend = warp_Math.crop(yBase + h, 0, height);
int offset1, offset2;
xBase = warp_Math.crop(xBase, 0, width);
yBase = warp_Math.crop(yBase, 0, height);
ty = tyBase;
for (int j = yBase; j < yend; j++)
{
tx = txBase;
offset1 = j * width;
offset2 = (ty >> 8) * tw;
for (int i = xBase; i < xend; i++)
{
pixels[ i + offset1 ] = unchecked( (int)0xff000000) | texture.pixel[ ( tx >> 8 ) + offset2 ];
tx += dtx;
}
ty += dty;
}
}
public void add( warp_Texture texture, int posx, int posy, int xsize, int ysize )
{
add( width, height, texture, posx, posy, xsize, ysize );
}
private void add( int width, int height, warp_Texture texture, int posx, int posy, int xsize, int ysize )
{
if ( texture == null )
{
return;
}
int w = xsize;
int h = ysize;
int xBase = posx;
int yBase = posy;
int tx = texture.width * 255;
int ty = texture.height * 255;
int tw = texture.width;
int dtx = tx / w;
int dty = ty / h;
int txBase = warp_Math.crop( -xBase * dtx, 0, 255 * tx );
int tyBase = warp_Math.crop( -yBase * dty, 0, 255 * ty );
int xend = warp_Math.crop( xBase + w, 0, width );
int yend = warp_Math.crop( yBase + h, 0, height );
int pos, offset1, offset2;
xBase = warp_Math.crop( xBase, 0, width );
yBase = warp_Math.crop( yBase, 0, height );
ty = tyBase;
for ( int j = yBase; j < yend; j++ )
{
tx = txBase;
offset1 = j * width;
offset2 = ( ty >> 8 ) * tw;
for ( int i = xBase; i < xend; i++ )
{
pixels[ i + offset1 ] = unchecked( (int)0xff000000) | warp_Color.add( texture.pixel[ ( tx >> 8 ) + offset2 ], pixels[ i + offset1 ] );
tx += dtx;
}
ty += dty;
}
}
public void performBench()
{
probes+=1;
if (probes>32)
{
time=DateTime.Now;
TimeSpan span = time-timestamp;
FPS=32f/((float)(span.Milliseconds)/1000);
timestamp=time;
probes=0;
}
}
public void Dispose()
{
if ( image != null )
{
handle.Free();
image.Dispose();
image = null;
pixels = null;
}
}
}
}
-217
View File
@@ -1,217 +0,0 @@
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Net;
namespace Rednettle.Warp3D
{
/// <summary>
/// Summary description for warp_Texture.
/// </summary>
public class warp_Texture
{
public int width;
public int height;
public int bitWidth;
public int bitHeight;
public int[] pixel;
public String path=null;
public static int ALPHA = unchecked((int)0xFF000000); // alpha mask
public warp_Texture(int w, int h)
{
height=h;
width=w;
pixel=new int[w*h];
cls();
}
public warp_Texture(int w, int h, int[] data)
{
height=h;
width=w;
pixel=new int[width*height];
System.Array.Copy(data, pixel, pixel.Length);
}
public warp_Texture(string path)
{
Bitmap map;
if( path.StartsWith( "http" ) )
{
WebRequest webrq = WebRequest.Create( path );
map = ( Bitmap )Bitmap.FromStream(webrq.GetResponse().GetResponseStream());
}
else
{
map = new Bitmap( path, false);
}
loadTexture( map );
}
public void resize()
{
double log2inv=1/Math.Log(2);
int w = ( int )Math.Pow( 2, bitWidth = ( int )Math.Ceiling( ( Math.Log( width ) * log2inv ) ) );
int h = ( int )Math.Pow( 2, bitHeight = ( int )Math.Ceiling( ( Math.Log( height ) * log2inv ) ) );
if(!(w==width && h==height))
resize(w,h);
}
public void resize(int w, int h)
{
System.Console.WriteLine("warp_Texture| resize :"+w+","+h);
setSize(w,h);
}
public void cls()
{
warp_Math.clearBuffer(pixel, 0);
}
public warp_Texture toAverage()
{
for (int i=width*height-1;i>=0;i--)
pixel[i]=warp_Color.getAverage(pixel[i]);
return this;
}
public warp_Texture toGray()
{
for (int i=width*height-1;i>=0;i--)
pixel[i]=warp_Color.getGray(pixel[i]);
return this;
}
public warp_Texture valToGray()
{
int intensity;
for (int i=width*height-1;i>=0;i--)
{
intensity=warp_Math.crop(pixel[i],0,255);
pixel[i]=warp_Color.getColor(intensity,intensity,intensity);
}
return this;
}
public warp_Texture colorize(int[] pal)
{
int range=pal.GetLength(0)-1;
for (int i=width*height-1;i>=0;i--)
pixel[i]=pal[warp_Math.crop(pixel[i],0,range)];
return this;
}
private void loadTexture(Bitmap map)
{
width = map.Width;
height = map.Height;
pixel=new int[width*height];
BitmapData bmData = map.LockBits(new Rectangle(0, 0, map.Width, map.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
int scanline = bmData.Stride;
System.IntPtr Scan0 = bmData.Scan0;
/*
// Declare an array to hold the bytes of the bitmap.
// This code is specific to a bitmap with 24 bits per pixels.
byte[] bytes = new byte[(map.Width * map.Height) * 3];
// Copy the RGB values into the array.
System.Runtime.InteropServices.Marshal.Copy ( Scan0, bytes, 0, bytes.Length );
int nOffset = bmData.Stride - map.Width * 3;
int nPixel = 0;
int p =0;
for (int i = 0; i < map.Height; i++)
{
for (int j = 0; j < map.Width; j++)
{
int blue = bytes[p];
int green = bytes[p+1];
int red = bytes[p+2];
pixel[nPixel++] = ALPHA | red << 16 | green << 8 | blue;
p += 3;
}
p += nOffset;
}
*/
// Copy the RGB values back to the bitmap
// System.Runtime.InteropServices.Marshal.Copy(bytes, 0, ptr, bytes.Length);
unsafe
{
byte *p = (byte *)(void *)Scan0;
int nOffset = bmData.Stride - map.Width*3;
int nPixel = 0;
for(int i=0;i<map.Height;i++)
{
for(int j=0;j<map.Width;j++)
{
int blue = p[0];
int green = p[1];
int red = p[2];
pixel[nPixel++] = ALPHA | red << 16 | green << 8 | blue;
p+=3;
}
p+=nOffset;
}
}
map.UnlockBits(bmData);
resize();
}
private void setSize(int w, int h)
{
int offset=w*h;
int offset2;
if (w*h!=0)
{
int[] newpixels=new int[w*h];
for(int j=h-1;j>=0;j--)
{
offset-=w;
offset2=(j*height/h)*width;
for (int i=w-1;i>=0;i--)
newpixels[i+offset]=pixel[(i*width/w)+offset2];
}
width=w;
height=h;
pixel=newpixels;
}
}
private bool inrange(int a, int b, int c)
{
return (a>=b)&(a<c);
}
public warp_Texture getClone()
{
warp_Texture t=new warp_Texture(width,height);
warp_Math.copyBuffer(pixel,t.pixel);
return t;
}
}
}
@@ -1,233 +0,0 @@
using System;
namespace Rednettle.Warp3D
{
/// <summary>
/// Summary description for warp_TextureFactory.
/// </summary>
public class warp_TextureFactory
{
public static float pi = 3.1415926535f;
public static float deg2rad = pi / 180;
private static float[,] noiseBuffer;
private static bool noiseBufferInitialized = false;
static int minx, maxx, miny, maxy;
public static int ALPHA = unchecked((int)0xFF000000); // alpha mask
private warp_TextureFactory()
{
}
public static warp_Texture SKY(int w, int h, float density)
{
int[] colors = new int[2];
colors[0] = 0x003399;
colors[1] = 0xFFFFFF;
return PERLIN(w, h, 0.5f, 2.8f * density, 8, 1024).colorize(warp_Color.makeGradient(colors, 1024));
}
public static warp_Texture MARBLE(int w, int h, float density)
{
int[] colors = new int[3];
colors[0] = 0x111111;
colors[1] = 0x696070;
colors[2] = 0xFFFFFF;
return WAVE(w, h, 0.5f, 0.64f * density, 6, 1024).colorize(warp_Color.makeGradient(colors, 1024));
}
public static warp_Texture WOOD(int w, int h, float density)
{
int[] colors = new int[3];
colors[0] = 0x332211;
colors[1] = 0x523121;
colors[2] = 0x996633;
return GRAIN(w, h, 0.5f, 3f * density, 3, 8, 1024).colorize(warp_Color.makeGradient(colors, 1024));
}
public static warp_Texture PERLIN(int w, int h, float persistency,
float density, int samples, int scale)
{
initNoiseBuffer();
warp_Texture t = new warp_Texture(w, h);
int pos = 0;
float wavelength = (float) ( (w > h) ? w : h) / density;
for (int y = 0; y < h; y++)
{
for (int x = 0; x < w; x++)
{
t.pixel[pos++] = (int) ( (float) scale *
perlin2d(x, y, wavelength, persistency,
samples));
}
}
return t;
}
public static warp_Texture WAVE(int w, int h, float persistency,
float density, int samples, int scale)
{
initNoiseBuffer();
warp_Texture t = new warp_Texture(w, h);
int pos = 0;
float wavelength = (float) ( (w > h) ? w : h) / density;
for (int y = 0; y < h; y++)
{
for (int x = 0; x < w; x++)
{
t.pixel[pos++] = (int) ( (double) scale *
(Math.Sin(32 *
perlin2d(x, y, wavelength,
persistency, samples)) * 0.5 + 0.5));
}
}
return t;
}
public static warp_Texture GRAIN(int w, int h, float persistency,
float density, int samples, int levels,
int scale)
// TIP: For wooden textures
{
initNoiseBuffer();
warp_Texture t = new warp_Texture(w, h);
int pos = 0;
float wavelength = (float) ( (w > h) ? w : h) / density;
float perlin;
for (int y = 0; y < h; y++)
{
for (int x = 0; x < w; x++)
{
perlin = (float) levels *
perlin2d(x, y, wavelength, persistency, samples);
t.pixel[pos++] = (int) ( (float) scale *
(perlin - (float) (int) perlin));
}
}
return t;
}
// Perlin noise functions
private static float perlin2d(float x, float y, float wavelength,
float persistence, int samples)
{
float sum = 0;
float freq = 1f / wavelength;
float amp = persistence;
float range = 0;
for (int i = 0; i < samples; i++)
{
sum += amp * interpolatedNoise(x * freq, y * freq, i);
range += amp;
amp *= persistence;
freq *= 2;
}
return warp_Math.crop(sum / persistence * 0.5f + 0.5f, 0, 1);
}
// Helper methods
private static float interpolatedNoise(float x, float y, int octave)
{
int intx = (int) x;
int inty = (int) y;
float fracx = x - (float) intx;
float fracy = y - (float) inty;
float i1 = warp_Math.interpolate(noise(intx, inty, octave),
noise(intx + 1, inty, octave), fracx);
float i2 = warp_Math.interpolate(noise(intx, inty + 1, octave),
noise(intx + 1, inty + 1, octave),
fracx);
return warp_Math.interpolate(i1, i2, fracy);
}
private static float smoothNoise(int x, int y, int o)
{
return (noise(x - 1, y - 1, o) + noise(x + 1, y - 1, o) +
noise(x - 1, y + 1, o) + noise(x + 1, y + 1, o)) / 16
+
(noise(x - 1, y, o) + noise(x + 1, y, o) + noise(x, y - 1, o) +
noise(x, y + 1, o)) / 8
+ noise(x, y, o) / 4;
}
private static float noise(int x, int y, int octave)
{
return noiseBuffer[octave & 3, (x + y * 57) & 8191];
}
private static float noise(int seed, int octave)
{
int id = octave & 3;
int n = (seed << 13) ^ seed;
if (id == 0)
{
return (float) (1f -
( (n * (n * n * 15731 + 789221) + 1376312589) &
0x7FFFFFFF) *
0.000000000931322574615478515625f);
}
if (id == 1)
{
return (float) (1f -
( (n * (n * n * 12497 + 604727) + 1345679039) &
0x7FFFFFFF) *
0.000000000931322574615478515625f);
}
if (id == 2)
{
return (float) (1f -
( (n * (n * n * 19087 + 659047) + 1345679627) &
0x7FFFFFFF) *
0.000000000931322574615478515625f);
}
return (float) (1f -
( (n * (n * n * 16267 + 694541) + 1345679501) &
0x7FFFFFFF) *
0.000000000931322574615478515625f);
}
private static void initNoiseBuffer()
{
if (noiseBufferInitialized)
{
return;
}
noiseBuffer = new float[4,8192];
for (int octave = 0; octave < 4; octave++)
{
for (int i = 0; i < 8192; i++)
{
noiseBuffer[octave,i] = noise(i, octave);
}
}
noiseBufferInitialized = true;
}
public static warp_Texture CHECKERBOARD(int w, int h, int cellbits, int oddColor, int evenColor)
{
warp_Texture t = new warp_Texture(w, h);
int pos = 0;
for (int y = 0; y < h; y++)
{
for (int x = 0; x < w; x++)
{
int c = ( ( (x >> cellbits) + (y >> cellbits)) & 1) == 0 ? evenColor : oddColor;
t.pixel[pos++] = c;
}
}
return t;
}
}
}
@@ -1,53 +0,0 @@
using System;
namespace Rednettle.Warp3D
{
/// <summary>
/// Summary description for warp_TextureProjector.
/// </summary>
public class warp_TextureProjector
{
public static void projectFrontal(warp_Object obj)
{
obj.rebuild();
warp_Vector min = obj.minimum();
warp_Vector max = obj.maximum();
float du = 1 / (max.x - min.x);
float dv = 1 / (max.y - min.y);
for (int i = 0; i < obj.vertices; i++)
{
obj.fastvertex[i].u = (obj.fastvertex[i].pos.x - min.x) * du;
obj.fastvertex[i].v = 1 - (obj.fastvertex[i].pos.y - min.y) * dv;
}
}
public static void projectTop(warp_Object obj)
{
obj.rebuild();
warp_Vector min = obj.minimum();
warp_Vector max = obj.maximum();
float du = 1 / (max.x - min.x);
float dv = 1 / (max.z - min.z);
for (int i = 0; i < obj.vertices; i++)
{
obj.fastvertex[i].u = (obj.fastvertex[i].pos.x - min.x) * du;
obj.fastvertex[i].v = (obj.fastvertex[i].pos.z - min.z) * dv;
}
}
public static void projectCylindric(warp_Object obj)
{
obj.rebuild();
warp_Vector min = obj.minimum();
warp_Vector max = obj.maximum();
float dz = 1 / (max.z - min.z);
for (int i = 0; i < obj.vertices; i++)
{
obj.fastvertex[i].pos.buildCylindric();
obj.fastvertex[i].u = obj.fastvertex[i].pos.theta / (2 * 3.14159265f);
obj.fastvertex[i].v = (obj.fastvertex[i].pos.z - min.z) * dz;
}
}
}
}
@@ -1,33 +0,0 @@
using System;
namespace Rednettle.Warp3D
{
/// <summary>
/// Summary description for warp_TextureSettings.
/// </summary>
///
public class warp_TextureSettings
{
public warp_Texture texture;
public int width;
public int height;
public int type;
public float persistency;
public float density;
public int samples;
public int numColors;
public int[] colors;
public warp_TextureSettings(warp_Texture tex, int w, int h, int t, float p, float d, int s, int[] c)
{
texture=tex;
width=w;
height=h;
type=t;
persistency=p;
density=d;
samples=s;
colors=c;
}
}
}
@@ -1,98 +0,0 @@
using System;
namespace Rednettle.Warp3D
{
/// <summary>
/// Summary description for warp_Triangle.
/// </summary>
public class warp_Triangle
{
public warp_Object parent; // the object which obtains this triangle
public bool visible=true; //visibility tag for clipping
public bool outOfFrustrum=false; //visibility tag for frustrum clipping
public warp_Vertex p1; // first vertex
public warp_Vertex p2; // second vertex
public warp_Vertex p3; // third vertex
public warp_Vector n; // Normal vector of flat triangle
public warp_Vector n2; // Projected Normal vector
private int minx,maxx,miny,maxy; // for clipping
private warp_Vector triangleCenter=new warp_Vector();
public float dist=0;
public int id=0;
public warp_Triangle(warp_Vertex a, warp_Vertex b, warp_Vertex c)
{
p1=a;
p2=b;
p3=c;
}
public void clipFrustrum(int w, int h)
{
if (parent.material==null) {visible=false; return; }
outOfFrustrum=(p1.clipcode&p2.clipcode&p3.clipcode)!=0;
if (outOfFrustrum) {visible=false; return; }
if (n2.z>0.5) {visible=true; return; }
triangleCenter.x=(p1.pos2.x+p2.pos2.x+p3.pos2.x);
triangleCenter.y=(p1.pos2.y+p2.pos2.y+p3.pos2.y);
triangleCenter.z=(p1.pos2.z+p2.pos2.z+p3.pos2.z);
visible=warp_Vector.angle(triangleCenter,n2)>0;
}
public void project(warp_Matrix normalProjection)
{
n2=n.transform(normalProjection);
dist=getDist();
}
public void regenerateNormal()
{
n=warp_Vector.getNormal(p1.pos,p2.pos,p3.pos);
}
public warp_Vector getWeightedNormal()
{
return warp_Vector.vectorProduct(p1.pos,p2.pos,p3.pos);
}
public warp_Vertex getMedium()
{
float cx=(p1.pos.x+p2.pos.x+p3.pos.x)/3;
float cy=(p1.pos.y+p2.pos.y+p3.pos.y)/3;
float cz=(p1.pos.z+p2.pos.z+p3.pos.z)/3;
float cu=(p1.u+p2.u+p3.u)/3;
float cv=(p1.v+p2.v+p3.v)/3;
return new warp_Vertex(cx,cy,cz,cu,cv);
}
public warp_Vector getCenter()
{
float cx=(p1.pos.x+p2.pos.x+p3.pos.x)/3;
float cy=(p1.pos.y+p2.pos.y+p3.pos.y)/3;
float cz=(p1.pos.z+p2.pos.z+p3.pos.z)/3;
return new warp_Vector(cx,cy,cz);
}
public float getDist()
{
return p1.z+p2.z+p3.z;
}
public bool degenerated()
{
return p1.equals(p2)||p2.equals(p3)||p3.equals(p1);
}
public warp_Triangle getClone()
{
return new warp_Triangle(p1,p2,p3);
}
}
}
-148
View File
@@ -1,148 +0,0 @@
using System;
namespace Rednettle.Warp3D
{
public class warp_Vector
{
public float x=0; //Cartesian (default)
public float y=0; //Cartesian (default)
public float z=0; //Cartesian (default),Cylindric
public float r=0; //Cylindric
public float theta=0; //Cylindric
public warp_Vector()
{
}
public warp_Vector (float xpos, float ypos, float zpos)
{
x=xpos;
y=ypos;
z=zpos;
}
public warp_Vector normalize()
// Normalizes the vector
{
float dist=length();
if (dist==0) return this;
float invdist=1/dist;
x*=invdist;
y*=invdist;
z*=invdist;
return this;
}
public warp_Vector reverse()
// Reverses the vector
{
x=-x;
y=-y;
z=-z;
return this;
}
public float length()
// Lenght of this vector
{
return (float)Math.Sqrt(x*x+y*y+z*z);
}
public warp_Vector transform(warp_Matrix m)
// Modifies the vector by matrix m
{
float newx = x*m.m00 + y*m.m01 + z*m.m02+ m.m03;
float newy = x*m.m10 + y*m.m11 + z*m.m12+ m.m13;
float newz = x*m.m20 + y*m.m21 + z*m.m22+ m.m23;
return new warp_Vector(newx,newy,newz);
}
public void buildCylindric()
// Builds the cylindric coordinates out of the given cartesian coordinates
{
r=(float)Math.Sqrt(x*x+y*y);
theta=(float)Math.Atan2(x,y);
}
public void buildCartesian()
// Builds the cartesian coordinates out of the given cylindric coordinates
{
x=r*warp_Math.cos(theta);
y=r*warp_Math.sin(theta);
}
public static warp_Vector getNormal(warp_Vector a, warp_Vector b)
// returns the normal vector of the plane defined by the two vectors
{
return vectorProduct(a,b).normalize();
}
public static warp_Vector getNormal(warp_Vector a, warp_Vector b, warp_Vector c)
// returns the normal vector of the plane defined by the two vectors
{
return vectorProduct(a,b,c).normalize();
}
public static warp_Vector vectorProduct(warp_Vector a, warp_Vector b)
// returns a x b
{
return new warp_Vector(a.y*b.z-b.y*a.z,a.z*b.x-b.z*a.x,a.x*b.y-b.x*a.y);
}
public static warp_Vector vectorProduct(warp_Vector a, warp_Vector b, warp_Vector c)
// returns (b-a) x (c-a)
{
return vectorProduct(sub(b,a),sub(c,a));
}
public static float angle(warp_Vector a, warp_Vector b)
// returns the angle between 2 vectors
{
a.normalize();
b.normalize();
return (a.x*b.x+a.y*b.y+a.z*b.z);
}
public static warp_Vector add(warp_Vector a, warp_Vector b)
// adds 2 vectors
{
return new warp_Vector(a.x+b.x,a.y+b.y,a.z+b.z);
}
public static warp_Vector sub(warp_Vector a, warp_Vector b)
// substracts 2 vectors
{
return new warp_Vector(a.x-b.x,a.y-b.y,a.z-b.z);
}
public static warp_Vector scale(float f, warp_Vector a)
// substracts 2 vectors
{
return new warp_Vector(f*a.x,f*a.y,f*a.z);
}
public static float len(warp_Vector a)
// length of vector
{
return (float)Math.Sqrt(a.x*a.x+a.y*a.y+a.z*a.z);
}
/*
public static warp_Vector random(float fact)
// returns a random vector
{
return new warp_Vector(fact*warp_Math.random(),fact*warp_Math.random(),fact*warp_Math.random());
}
public String toString()
{
return new String ("<vector x="+x+" y="+y+" z="+z+">\r\n");
}
*/
public warp_Vector getClone()
{
return new warp_Vector(x,y,z);
}
}
}
-194
View File
@@ -1,194 +0,0 @@
using System;
using System.Collections;
namespace Rednettle.Warp3D
{
/// <summary>
/// Summary description for warp_Vertex.
/// </summary>
public class warp_Vertex
{
public warp_Object parent;
public warp_Vector pos=new warp_Vector(); //(x,y,z) Coordinate of vertex
public warp_Vector pos2; //Transformed vertex coordinate
public warp_Vector n=new warp_Vector(); //Normal Vector at vertex
public warp_Vector n2; //Transformed normal vector (camera space)
public int x; //Projected x coordinate
public int y; //Projected y coordinate
public int z; //Projected z coordinate for z-Buffer
public float u=0; // Texture x-coordinate (relative)
public float v=0; // Texture y-coordinate (relative)
public int nx=0; // Normal x-coordinate for envmapping
public int ny=0; // Normal y-coordinate for envmapping
public int tx=0; // Texture x-coordinate (absolute)
public int ty=0; // Texture y-coordinate (absolute)
public float sw = 1.0f;
public bool visible=true; //visibility tag for clipping
public int clipcode=0;
public int id; // Vertex index
private float fact;
//private Vector neighbor=new Vector(); //Neighbor triangles of vertex
private ArrayList neighbor=new ArrayList();
public warp_Vertex()
{
pos=new warp_Vector(0f,0f,0f);
}
public warp_Vertex(float xpos, float ypos, float zpos)
{
pos=new warp_Vector(xpos,ypos,zpos);
}
public warp_Vertex(float xpos, float ypos, float zpos, float u, float v)
{
pos=new warp_Vector(xpos,ypos,zpos);
this.u=u;
this.v=v;
}
public warp_Vertex(warp_Vector ppos)
{
pos=ppos.getClone();
}
public warp_Vertex(warp_Vector ppos, float u, float v)
{
pos=ppos.getClone();
this.u=u;
this.v=v;
}
public void project(warp_Matrix vertexProjection,warp_Matrix normalProjection, warp_Camera camera)
// Projects this vertex into camera space
{
pos2=pos.transform(vertexProjection);
n2=n.transform(normalProjection);
fact=camera.screenscale/camera.fovfact/((pos2.z>0.1)?pos2.z:0.1f);
x=(int)(pos2.x*fact+(camera.screenwidth>>1));
y=(int)(-pos2.y*fact+(camera.screenheight>>1));
z=(int)(65536f*pos2.z);
sw = - (pos2.z);
nx=(int)(n2.x*127+127);
ny=(int)(n2.y*127+127);
if (parent.material==null) return;
if (parent.material.texture==null) return;
tx=(int)((float)parent.material.texture.width*u);
ty=(int)((float)parent.material.texture.height*v);
}
public void setUV(float u, float v)
{
this.u=u;
this.v=v;
}
public void clipFrustrum(int w, int h)
{
// View plane clipping
clipcode=0;
if (x<0) clipcode|=1;
if (x>=w) clipcode|=2;
if (y<0) clipcode|=4;
if (y>=h) clipcode|=8;
if (pos2.z<0) clipcode|=16;
visible=(clipcode==0);
}
public void registerNeighbor(warp_Triangle triangle)
{
if (!neighbor.Contains(triangle)) neighbor.Add(triangle);
}
public void resetNeighbors()
{
neighbor.Clear();
}
public void regenerateNormal()
{
float nx=0;
float ny=0;
float nz=0;
IEnumerator enumerator=neighbor.GetEnumerator();
warp_Triangle tri;
warp_Vector wn;
while (enumerator.MoveNext())
{
tri=(warp_Triangle)enumerator.Current;
wn=tri.getWeightedNormal();
nx+=wn.x;
ny+=wn.y;
nz+=wn.z;
}
n=new warp_Vector(nx,ny,nz).normalize();
}
/*
public void regenerateNormal()
{
float nx=0;
float ny=0;
float nz=0;
Enumeration enum=neighbor.elements();
warp_Triangle tri;
warp_Vector wn;
while (enum.hasMoreElements())
{
tri=(warp_Triangle)enum.nextElement();
wn=tri.getWeightedNormal();
nx+=wn.x;
ny+=wn.y;
nz+=wn.z;
}
n=new warp_Vector(nx,ny,nz).normalize();
}
*/
public void scaleTextureCoordinates(float fx, float fy)
{
u*=fx;
v*=fy;
}
public void moveTextureCoordinates(float fx, float fy)
{
u+=fx;
v+=fy;
}
public warp_Vertex getClone()
{
warp_Vertex newVertex=new warp_Vertex();
newVertex.pos=pos.getClone();
newVertex.n=n.getClone();
newVertex.u=u;
newVertex.v=v;
return newVertex;
}
public bool equals(warp_Vertex v)
{
return ((pos.x==v.pos.x)&&(pos.y==v.pos.y)&&(pos.z==v.pos.z));
}
public bool equals(warp_Vertex v,float tolerance)
{
return Math.Abs(warp_Vector.sub(pos,v.pos).length())<tolerance;
}
}
}
@@ -1,36 +0,0 @@
' Created by: X
' http://www.createdbyx.com/
' ----------------------
' C# to VB.NET conversion of this code was done by hand and with the assistance of the
' Convert C# to VB .NET application availible at http://www.kamalpatel.net/ConvertCSharp2VB.aspx
' ConvertCSharp2VB utility was developed by: Kamal Patel (http://www.KamalPatel.net)
' ----------------------
' Thanks to Alan Simes ( http://alansimes.blogdns.net/ ) for creating the Warp3D library.
' http://alansimes.blogdns.net/cs/files/default.aspx
' ----------------------
Imports System
Namespace Rednettle.Warp3D
'/ <summary>
'/ Summary description for warp_Color.
'/ </summary>
Partial Public Class warp_Color
Public Shared Function Modulate(ByVal color1 As Integer, ByVal color2 As Integer) As Integer
Dim R1 As Integer = (color1 And RED) >> 16
Dim G1 As Integer = (color1 And GREEN) >> 8
Dim B1 As Integer = color1 And BLUE
Dim R2 As Integer = (color2 And RED) >> 16
Dim G2 As Integer = (color2 And GREEN) >> 8
Dim B2 As Integer = color2 And BLUE
Dim R, G, B As Integer
R = (R1 * R2) '* 2
G = (G1 * G2) '* 2
B = (B1 * B2) '* 2
Return ALPHA Or (R << 16) Or (G << 8) Or B
End Function
End Class
End Namespace
@@ -1,254 +0,0 @@
' Created by: X
' http://www.createdbyx.com/
' ----------------------
' C# to VB.NET conversion of this code was done by hand and with the assistance of the
' Convert C# to VB .NET application availible at http://www.kamalpatel.net/ConvertCSharp2VB.aspx
' ConvertCSharp2VB utility was developed by: Kamal Patel (http://www.KamalPatel.net)
' ----------------------
' Thanks to Alan Simes ( http://alansimes.blogdns.net/ ) for creating the Warp3D library.
' http://alansimes.blogdns.net/cs/files/default.aspx
' ----------------------
Imports System
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.Runtime.InteropServices
Namespace Rednettle.Warp3D
Partial Public Class warp_Screen
Public Sub Subtract(ByVal texture As warp_Texture, ByVal posx As Integer, ByVal posy As Integer, ByVal xsize As Integer, ByVal ysize As Integer)
Subtract(width, height, texture, posx, posy, xsize, ysize)
End Sub
Private Sub Subtract(ByVal width As Integer, ByVal height As Integer, ByVal texture As warp_Texture, ByVal posx As Integer, ByVal posy As Integer, ByVal xsize As Integer, ByVal ysize As Integer)
If texture Is Nothing Then Return
Dim w As Integer = xsize
Dim h As Integer = ysize
Dim xBase As Integer = posx
Dim yBase As Integer = posy
Dim tx As Integer = texture.width * 255
Dim ty As Integer = texture.height * 255
Dim tw As Integer = texture.width
Dim dtx As Integer = CInt(tx / w)
Dim dty As Integer = CInt(ty / h)
Dim txBase As Integer = warp_Math.crop(-xBase * dtx, 0, 255 * tx)
Dim tyBase As Integer = warp_Math.crop(-yBase * dty, 0, 255 * ty)
Dim xend As Integer = warp_Math.crop(xBase + w, 0, width)
Dim yend As Integer = warp_Math.crop(yBase + h, 0, height)
Dim pos As Integer, offset1 As Integer, offset2 As Integer
xBase = warp_Math.crop(xBase, 0, width)
yBase = warp_Math.crop(yBase, 0, height)
ty = tyBase
Dim j As Integer
For j = yBase To yend - 1 'Step j + 1
tx = txBase
offset1 = j * width
offset2 = (ty >> 8) * tw
Dim i As Integer
For i = xBase To xend - 1 'Step i + 1
pixels(i + offset1) = &HFF000000 Or warp_Color.sub(texture.pixel((tx >> 8) + offset2), pixels(i + offset1))
tx += dtx
Next
ty += dty
Next
End Sub
Public Sub Mix(ByVal texture As warp_Texture, ByVal posx As Integer, ByVal posy As Integer, ByVal xsize As Integer, ByVal ysize As Integer)
Mix(width, height, texture, posx, posy, xsize, ysize)
End Sub
Private Sub Mix(ByVal width As Integer, ByVal height As Integer, ByVal texture As warp_Texture, ByVal posx As Integer, ByVal posy As Integer, ByVal xsize As Integer, ByVal ysize As Integer)
If texture Is Nothing Then Return
Dim w As Integer = xsize
Dim h As Integer = ysize
Dim xBase As Integer = posx
Dim yBase As Integer = posy
Dim tx As Integer = texture.width * 255
Dim ty As Integer = texture.height * 255
Dim tw As Integer = texture.width
Dim dtx As Integer = CInt(tx / w)
Dim dty As Integer = CInt(ty / h)
Dim txBase As Integer = warp_Math.crop(-xBase * dtx, 0, 255 * tx)
Dim tyBase As Integer = warp_Math.crop(-yBase * dty, 0, 255 * ty)
Dim xend As Integer = warp_Math.crop(xBase + w, 0, width)
Dim yend As Integer = warp_Math.crop(yBase + h, 0, height)
Dim pos As Integer, offset1 As Integer, offset2 As Integer
xBase = warp_Math.crop(xBase, 0, width)
yBase = warp_Math.crop(yBase, 0, height)
ty = tyBase
Dim j As Integer
For j = yBase To yend - 1 'Step j + 1
tx = txBase
offset1 = j * width
offset2 = (ty >> 8) * tw
Dim i As Integer
For i = xBase To xend - 1 'Step i + 1
pixels(i + offset1) = &HFF000000 Or warp_Color.mix(texture.pixel((tx >> 8) + offset2), pixels(i + offset1))
tx += dtx
Next
ty += dty
Next
End Sub
Public Sub Multiply(ByVal texture As warp_Texture, ByVal posx As Integer, ByVal posy As Integer, ByVal xsize As Integer, ByVal ysize As Integer)
multiply(width, height, texture, posx, posy, xsize, ysize)
End Sub
Private Sub Multiply(ByVal width As Integer, ByVal height As Integer, ByVal texture As warp_Texture, ByVal posx As Integer, ByVal posy As Integer, ByVal xsize As Integer, ByVal ysize As Integer)
If texture Is Nothing Then Return
Dim w As Integer = xsize
Dim h As Integer = ysize
Dim xBase As Integer = posx
Dim yBase As Integer = posy
Dim tx As Integer = texture.width * 255
Dim ty As Integer = texture.height * 255
Dim tw As Integer = texture.width
Dim dtx As Integer = CInt(tx / w)
Dim dty As Integer = CInt(ty / h)
Dim txBase As Integer = warp_Math.crop(-xBase * dtx, 0, 255 * tx)
Dim tyBase As Integer = warp_Math.crop(-yBase * dty, 0, 255 * ty)
Dim xend As Integer = warp_Math.crop(xBase + w, 0, width)
Dim yend As Integer = warp_Math.crop(yBase + h, 0, height)
Dim pos As Integer, offset1 As Integer, offset2 As Integer
xBase = warp_Math.crop(xBase, 0, width)
yBase = warp_Math.crop(yBase, 0, height)
ty = tyBase
Dim j As Integer
For j = yBase To yend - 1 'Step j + 1
tx = txBase
offset1 = j * width
offset2 = (ty >> 8) * tw
Dim i As Integer
For i = xBase To xend - 1 'Step i + 1
pixels(i + offset1) = &HFF000000 Or warp_Color.multiply(texture.pixel((tx >> 8) + offset2), pixels(i + offset1))
tx += dtx
Next
ty += dty
Next
End Sub
Public Sub SubNegative(ByVal texture As warp_Texture, ByVal posx As Integer, ByVal posy As Integer, ByVal xsize As Integer, ByVal ysize As Integer)
SubNegative(width, height, texture, posx, posy, xsize, ysize)
End Sub
Private Sub SubNegative(ByVal width As Integer, ByVal height As Integer, ByVal texture As warp_Texture, ByVal posx As Integer, ByVal posy As Integer, ByVal xsize As Integer, ByVal ysize As Integer)
If texture Is Nothing Then Return
Dim w As Integer = xsize
Dim h As Integer = ysize
Dim xBase As Integer = posx
Dim yBase As Integer = posy
Dim tx As Integer = texture.width * 255
Dim ty As Integer = texture.height * 255
Dim tw As Integer = texture.width
Dim dtx As Integer = CInt(tx / w)
Dim dty As Integer = CInt(ty / h)
Dim txBase As Integer = warp_Math.crop(-xBase * dtx, 0, 255 * tx)
Dim tyBase As Integer = warp_Math.crop(-yBase * dty, 0, 255 * ty)
Dim xend As Integer = warp_Math.crop(xBase + w, 0, width)
Dim yend As Integer = warp_Math.crop(yBase + h, 0, height)
Dim pos As Integer, offset1 As Integer, offset2 As Integer
xBase = warp_Math.crop(xBase, 0, width)
yBase = warp_Math.crop(yBase, 0, height)
ty = tyBase
Dim j As Integer
For j = yBase To yend - 1 'Step j + 1
tx = txBase
offset1 = j * width
offset2 = (ty >> 8) * tw
Dim i As Integer
For i = xBase To xend - 1 'Step i + 1
pixels(i + offset1) = &HFF000000 Or warp_Color.subneg(texture.pixel((tx >> 8) + offset2), pixels(i + offset1))
tx += dtx
Next
ty += dty
Next
End Sub
Public Sub Invert(ByVal texture As warp_Texture, ByVal posx As Integer, ByVal posy As Integer, ByVal xsize As Integer, ByVal ysize As Integer)
Invert(width, height, texture, posx, posy, xsize, ysize)
End Sub
Private Sub Invert(ByVal width As Integer, ByVal height As Integer, ByVal texture As warp_Texture, ByVal posx As Integer, ByVal posy As Integer, ByVal xsize As Integer, ByVal ysize As Integer)
If texture Is Nothing Then Return
Dim w As Integer = xsize
Dim h As Integer = ysize
Dim xBase As Integer = posx
Dim yBase As Integer = posy
Dim tx As Integer = texture.width * 255
Dim ty As Integer = texture.height * 255
Dim tw As Integer = texture.width
Dim dtx As Integer = CInt(tx / w)
Dim dty As Integer = CInt(ty / h)
Dim txBase As Integer = warp_Math.crop(-xBase * dtx, 0, 255 * tx)
Dim tyBase As Integer = warp_Math.crop(-yBase * dty, 0, 255 * ty)
Dim xend As Integer = warp_Math.crop(xBase + w, 0, width)
Dim yend As Integer = warp_Math.crop(yBase + h, 0, height)
Dim pos As Integer, offset1 As Integer, offset2 As Integer
xBase = warp_Math.crop(xBase, 0, width)
yBase = warp_Math.crop(yBase, 0, height)
ty = tyBase
Dim j As Integer
For j = yBase To yend - 1 'Step j + 1
tx = txBase
offset1 = j * width
offset2 = (ty >> 8) * tw
Dim i As Integer
For i = xBase To xend - 1 'Step i + 1
pixels(i + offset1) = &HFF000000 Or warp_Color.inv(pixels(i + offset1)) ', texture.pixel((tx >> 8) + offset2)
tx += dtx
Next
ty += dty
Next
End Sub
Public Sub Modulate(ByVal texture As warp_Texture, ByVal posx As Integer, ByVal posy As Integer, ByVal xsize As Integer, ByVal ysize As Integer)
Modulate(width, height, texture, posx, posy, xsize, ysize)
End Sub
Private Sub Modulate(ByVal width As Integer, ByVal height As Integer, ByVal texture As warp_Texture, ByVal posx As Integer, ByVal posy As Integer, ByVal xsize As Integer, ByVal ysize As Integer)
If texture Is Nothing Then Return
Dim w As Integer = xsize
Dim h As Integer = ysize
Dim xBase As Integer = posx
Dim yBase As Integer = posy
Dim tx As Integer = texture.width * 255
Dim ty As Integer = texture.height * 255
Dim tw As Integer = texture.width
Dim dtx As Integer = CInt(tx / w)
Dim dty As Integer = CInt(ty / h)
Dim txBase As Integer = warp_Math.crop(-xBase * dtx, 0, 255 * tx)
Dim tyBase As Integer = warp_Math.crop(-yBase * dty, 0, 255 * ty)
Dim xend As Integer = warp_Math.crop(xBase + w, 0, width)
Dim yend As Integer = warp_Math.crop(yBase + h, 0, height)
Dim pos As Integer, offset1 As Integer, offset2 As Integer
xBase = warp_Math.crop(xBase, 0, width)
yBase = warp_Math.crop(yBase, 0, height)
ty = tyBase
Dim j As Integer
For j = yBase To yend - 1 'Step j + 1
tx = txBase
offset1 = j * width
offset2 = (ty >> 8) * tw
Dim i As Integer
For i = xBase To xend - 1 'Step i + 1
pixels(i + offset1) = &HFF000000 Or warp_Color.Modulate(texture.pixel((tx >> 8) + offset2), pixels(i + offset1))
tx += dtx
Next
ty += dty
Next
End Sub
End Class
End Namespace
@@ -1,13 +0,0 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:2.0.50727.42
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>false</MySubMain>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<ApplicationType>1</ApplicationType>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
</MyApplicationData>
@@ -1,35 +0,0 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("Warp3DVB")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("Warp3DVB")>
<Assembly: AssemblyCopyright("Copyright © 2006")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("99f0f3fb-e2a7-42f7-a691-c2aa778ca36c")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
@@ -1,63 +0,0 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:2.0.50727.42
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Imports System
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Warp3DVB.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set
resourceCulture = value
End Set
End Property
End Module
End Namespace
@@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -1,73 +0,0 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:2.0.50727.42
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings),MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.Warp3DVB.My.MySettings
Get
Return Global.Warp3DVB.My.MySettings.Default
End Get
End Property
End Module
End Namespace
@@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
-117
View File
@@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
-809
View File
@@ -1,809 +0,0 @@
' Created by: X
' http://www.createdbyx.com/
' ----------------------
' C# to VB.NET conversion of this code was done by hand and with the assistance of the
' Convert C# to VB .NET application availible at http://www.kamalpatel.net/ConvertCSharp2VB.aspx
' ConvertCSharp2VB utility was developed by: Kamal Patel (http://www.KamalPatel.net)
' ----------------------
' Thanks to Alan Simes ( http://alansimes.blogdns.net/ ) for creating the Warp3D library.
' http://alansimes.blogdns.net/cs/files/default.aspx
' ----------------------
Imports System
imports System.Collections
imports System.ComponentModel
imports System.Drawing
imports System.Data
imports System.Text
imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports Warp3DVB.Rednettle.Warp3D
namespace Warp3D
Partial Public Class Warp3D
Inherits UserControl
Dim _scene As Rednettle.Warp3D.warp_Scene = Nothing
Dim _waiting As String = "Waiting..."
Private _plugins As New Hashtable()
Private _models As New Hashtable()
Private _dragging As Boolean = False
Private _oldx As Integer = 0
Private _oldy As Integer = 0
Private _controlkey As Boolean = False
Public _keargs As KeyEventArgs
'Public Sub New()
' me.InitializeComponent
' Me.MouseUp = New MouseEventHandler(AddressOf OnMouseUp)
' Me.MouseDown = New MouseEventHandler(AddressOf OnMouseDown)
' Me.MouseMove = New MouseEventHandler(AddressOf OnMouseMove)
'End Sub
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
MyBase.OnPaint(e)
Dim g As Graphics = e.Graphics
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic
If _scene IsNot Nothing Then
g.DrawImage(_scene.getImage(), 0, 0, Me.Width, Me.Height)
Else
Dim drawFont As Font = New Font("Verdana", 8)
Dim drawBrush As SolidBrush = New SolidBrush(Color.Black)
Dim drawRect As RectangleF = New RectangleF(-1, -1, Width + 1, Height + 1)
e.Graphics.FillRectangle(New SolidBrush(Me.BackColor), drawRect)
e.Graphics.DrawString(_waiting, drawFont, drawBrush, drawRect)
End If
End Sub
Public Sub OnMouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseMove
If _dragging Then
Dim dx As Single = (e.Y - _oldy) / 50.0F
Dim dy As Single = (_oldx - e.X) / 50.0F
If _controlkey Then
_scene.defaultCamera.shift(0, 0, dx)
Else
_scene.rotate(dx, dy, 0)
End If
_scene.render()
_oldx = e.X
_oldy = e.Y
Refresh()
End If
End Sub
Public Sub OnMouseUp(ByVal sender As Object, ByVal e As MouseEventArgs)
_dragging = False
End Sub
Public Sub OnMouseDown(ByVal sender As Object, ByVal e As MouseEventArgs)
_oldx = e.X
_oldy = e.Y
_dragging = True
End Sub
Protected Overrides Sub OnPaintBackground(ByVal e As PaintEventArgs)
End Sub
Public Function RegisterPlugIN(ByVal name As String, ByVal plugin As Rednettle.Warp3D.warp_FXPlugin) As Boolean
If _scene Is Nothing Then Return False
_plugins.Add(name, plugin)
Return True
End Function
Public Sub ShiftDefaultCamera(ByVal x As Single, ByVal y As Single, ByVal z As Single)
_scene.defaultCamera.shift(x, y, z)
End Sub
Public Function AddSphere(ByVal name As String, ByVal radius As Single, ByVal segments As Integer) As Boolean
If _scene Is Nothing Then Return False
Dim o As warp_Object = warp_ObjectFactory.SPHERE(radius, segments)
If o Is Nothing Then Return False
_scene.addObject(name, o)
_scene.rebuild()
Return True
End Function
Public Function AddPlane(ByVal name As String, ByVal size As Single) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim o As warp_Object = warp_ObjectFactory.SIMPLEPLANE(size, True)
If o Is Nothing Then
Return False
End If
_scene.addObject(name, o)
Return True
End Function
Public Function AddCube(ByVal name As String, ByVal size As Single) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim o As warp_Object = warp_ObjectFactory.CUBE(size)
If o Is Nothing Then
Return False
End If
_scene.addObject(name, o)
_scene.rebuild()
Return True
End Function
Public Function AddBox(ByVal name As String, ByVal x As Single, ByVal y As Single, ByVal z As Single) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim o As warp_Object = warp_ObjectFactory.BOX(x, y, z)
If o Is Nothing Then
Return False
End If
_scene.addObject(name, o)
_scene.rebuild()
Return True
End Function
Public Function ProjectFrontal(ByVal name As String) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim o As warp_Object = _scene.sceneobject(name)
If o Is Nothing Then
Return False
End If
warp_TextureProjector.projectFrontal(o)
Return True
End Function
Public Function ProjectCylindric(ByVal name As String) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim o As warp_Object = _scene.sceneobject(name)
If o Is Nothing Then
Return False
End If
warp_TextureProjector.projectCylindric(o)
Return True
End Function
Public Function ShiftObject(ByVal name As String, ByVal x As Single, ByVal y As Single, ByVal z As Single) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim o As warp_Object = _scene.sceneobject(name)
If o Is Nothing Then
Return False
End If
o.shift(x, y, z)
Return True
End Function
Public Function SetPos(ByVal name As String, ByVal x As Single, ByVal y As Single, ByVal z As Single) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim o As warp_Object = _scene.sceneobject(name)
If o Is Nothing Then
Return False
End If
o.setPos(x, y, z)
Return True
End Function
Public Function AddLensFlare(ByVal name As String) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim lensFlare As warp_FXLensFlare = New warp_FXLensFlare(name, _scene, False)
lensFlare.preset1()
RegisterPlugIN(name, lensFlare)
Return True
End Function
Public Function NormaliseScene() As Boolean
If _scene Is Nothing Then
Return False
End If
_scene.normalize()
Return True
End Function
Public Function SetAmbient(ByVal c As Integer) As Boolean
If _scene Is Nothing Then
Return False
End If
_scene.setAmbient(c)
Return True
End Function
Public Function RotateScene(ByVal quat As warp_Quaternion, ByVal x As Single, ByVal y As Single, ByVal z As Single) As Boolean
If _scene Is Nothing Then
Return False
End If
_scene.rotate(quat, x, y, z)
Return True
End Function
Public Function RotateScene(ByVal x As Single, ByVal y As Single, ByVal z As Single) As Boolean
If _scene Is Nothing Then
Return False
End If
_scene.rotate(x, y, z)
Return True
End Function
Public Function RotateScene(ByVal m As warp_Matrix) As Boolean
If _scene Is Nothing Then
Return False
End If
_scene.rotate(m)
Return True
End Function
Public Function ScaleScene(ByVal x As Single, ByVal y As Single, ByVal z As Single) As Boolean
If _scene Is Nothing Then
Return False
End If
_scene.scale(x, y, z)
Return True
End Function
Public Function TranslateScene(ByVal x As Single, ByVal y As Single, ByVal z As Single) As Boolean
If _scene Is Nothing Then
Return False
End If
_scene.shift(x, y, z)
Return True
End Function
Public Function RotateObject(ByVal name As String, ByVal x As Single, ByVal y As Single, ByVal z As Single) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim o As warp_Object = _scene.sceneobject(name)
If o Is Nothing Then
Return False
End If
o.rotate(x, y, z)
Return True
End Function
Public Function RotateSelf(ByVal name As String, ByVal x As Single, ByVal y As Single, ByVal z As Single) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim o As warp_Object = _scene.sceneobject(name)
If o Is Nothing Then
Return False
End If
o.rotateSelf(x, y, z)
Return True
End Function
Public Function RotateSelf(ByVal name As String, ByVal m As warp_Matrix) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim o As warp_Object = _scene.sceneobject(name)
If o Is Nothing Then
Return False
End If
o.rotateSelf(m)
Return True
End Function
Public Function RotateSelf(ByVal name As String, ByVal quat As warp_Quaternion) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim o As warp_Object = _scene.sceneobject(name)
If o Is Nothing Then
Return False
End If
o.rotateSelf(quat)
Return True
End Function
Public Function ScaleObject(ByVal name As String, ByVal s As Single) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim o As warp_Object = _scene.sceneobject(name)
If o Is Nothing Then
Return False
End If
o.scale(s)
Return True
End Function
Public Function SetObjectMaterial(ByVal name As String, ByVal m As String) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim material As warp_Material = CType(_scene.materialData(m), warp_Material)
If material Is Nothing Then
Return False
End If
_scene.sceneobject(name).setMaterial(material)
Return True
End Function
Public Function SetEnvMap(ByVal name As String, ByVal path As String) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim texture As warp_Texture = Nothing
Try
texture = New warp_Texture(path)
Catch
Return False
End Try
Dim material As warp_Material = CType(_scene.materialData(name), warp_Material)
If material Is Nothing Then
Return False
End If
material.setEnvmap(texture)
Return True
End Function
Public Function AddLight(ByVal name As String, ByVal x As Single, ByVal y As Single, ByVal z As Single, ByVal color As Integer, ByVal d As Integer, ByVal s As Integer) As Boolean
If _scene Is Nothing Then
Return False
End If
_scene.addLight(name, New warp_Light(New warp_Vector(x, y, z), color, d, s))
Return True
End Function
Public Function RotateModelSelf(ByVal name As String, ByVal x As Single, ByVal y As Single, ByVal z As Single) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim model As Hashtable = CType(_models(name), Hashtable)
If model Is Nothing Then
Return False
End If
Dim myDE As DictionaryEntry
For Each myDE In model
Dim key As String = CType(myDE.Key, String)
Dim o As warp_Object = CType(myDE.Value, warp_Object)
o.rotateSelf(x, y, z)
Next
Return True
End Function
Public Function RotateModel(ByVal name As String, ByVal x As Single, ByVal y As Single, ByVal z As Single) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim model As Hashtable = CType(_models(name), Hashtable)
If model Is Nothing Then
Return False
End If
Dim myDE As DictionaryEntry
For Each myDE In model
Dim key As String = CType(myDE.Key, String)
Dim o As warp_Object = CType(myDE.Value, warp_Object)
o.rotate(x, y, z)
Next
Return True
End Function
Public Function TranslateModel(ByVal name As String, ByVal x As Single, ByVal y As Single, ByVal z As Single) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim model As Hashtable = CType(_models(name), Hashtable)
If model Is Nothing Then
Return False
End If
Dim myDE As DictionaryEntry
For Each myDE In model
Dim key As String = CType(myDE.Key, String)
Dim o As warp_Object = CType(myDE.Value, warp_Object)
o.shift(x, y, z)
Next
Return True
End Function
Public Function ScaleModel(ByVal name As String, ByVal scale As Single) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim model As Hashtable = CType(_models(name), Hashtable)
If model Is Nothing Then
Return False
End If
Dim myDE As DictionaryEntry
For Each myDE In model
Dim key As String = CType(myDE.Key, String)
Dim o As warp_Object = CType(myDE.Value, warp_Object)
o.scaleSelf(scale)
Next
Return True
End Function
Public Function Import3Ds(ByVal name As String, ByVal path As String, ByVal addtoscene As Boolean) As Hashtable
If _scene Is Nothing Then
Return Nothing
End If
Dim list As Hashtable = Nothing
Dim studio As warp_3ds_Importer = New warp_3ds_Importer()
Try
list = studio.importFromFile(name, path)
If addtoscene Then
Dim myDE As DictionaryEntry
For Each myDE In list
Dim key As String = CType(myDE.Key, String)
Dim o As warp_Object = CType(myDE.Value, warp_Object)
_scene.addObject(key, o)
Next
End If
_scene.rebuild()
_models.Add(name, list)
Catch
Return Nothing
End Try
Return list
End Function
Public Function SetBackgroundColor(ByVal c As Integer) As Boolean
If _scene Is Nothing Then
Return False
End If
_scene.environment.bgcolor = c
Return True
End Function
Public Function SetBackgroundTexture(ByVal path As String) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim texture As warp_Texture = Nothing
Try
texture = New warp_Texture(path)
Catch
Return False
End Try
_scene.environment.setBackground(texture)
Return True
End Function
Public Function SetBackgroundMaterial(ByVal path As String) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim material As warp_Material = Nothing
Try
material = New warp_Material(path)
Catch
Return False
End Try
Dim texture As warp_Texture = material.getTexture()
If texture Is Nothing Then
Return False
End If
_scene.environment.setBackground(texture)
Return True
End Function
Public Function SetWireframe(ByVal name As String, ByVal w As Boolean) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim material As warp_Material = CType(_scene.materialData(name), warp_Material)
If material Is Nothing Then
Return False
End If
material.setWireframe(w)
Return True
End Function
Public Function SetTexture(ByVal name As String, ByVal path As String) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim texture As warp_Texture = Nothing
Try
texture = New warp_Texture(path)
Catch
Return False
End Try
Dim material As warp_Material = CType(_scene.materialData(name), warp_Material)
If material Is Nothing Then
Return False
End If
material.setTexture(texture)
Return True
End Function
Public Function AddMaterial(ByVal name As String) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim material As warp_Material = New warp_Material()
_scene.addMaterial(name, material)
Return True
End Function
Public Function AddMaterial(ByVal name As String, ByVal color As Integer) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim material As warp_Material = New warp_Material(color)
_scene.addMaterial(name, material)
Return True
End Function
Public Function AddMaterial(ByVal name As String, ByVal path As String) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim material As warp_Material = Nothing
Try
material = New warp_Material(path)
Catch
Return False
End Try
_scene.addMaterial(name, material)
Return True
End Function
Public Function SetReflectivity(ByVal name As String, ByVal r As Integer) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim material As warp_Material = CType(_scene.materialData(name), warp_Material)
If material Is Nothing Then
Return False
End If
material.setReflectivity(r)
Return True
End Function
Public Function SetTransparency(ByVal name As String, ByVal t As Integer) As Boolean
If _scene Is Nothing Then
Return False
End If
Dim material As warp_Material = CType(_scene.materialData(name), warp_Material)
If material Is Nothing Then
Return False
End If
material.setTransparency(t)
Return True
End Function
Public Function Render() As Boolean
Try
_scene.render()
Dim myDE As DictionaryEntry
For Each myDE In _plugins
Dim plugin As warp_FXPlugin = CType(myDE.Value, warp_FXPlugin)
plugin.apply()
Next
Catch
Return False
End Try
Return True
End Function
Public Function CreateScene(ByVal width As Integer, ByVal height As Integer) As Boolean
Try
_scene = New warp_Scene(width, height)
_plugins.Clear()
_models.Clear()
Catch
Reset()
Return False
End Try
Return True
End Function
Public Sub Reset()
_scene = Nothing
System.GC.Collect()
End Sub
Public Sub DisplayDefaultScene()
_scene = New warp_Scene(512, 512)
Dim crystal As warp_Material = New warp_Material(warp_TextureFactory.MARBLE(128, 128, 0.15F))
_scene.addMaterial("crystal", crystal)
Dim c As warp_Material = CType(_scene.materialData("crystal"), warp_Material)
c.setReflectivity(255)
c.setTransparency(100)
_scene.environment.setBackground(warp_TextureFactory.CHECKERBOARD(128, 128, 3, &H0, &H999999))
_scene.addLight("light1", New warp_Light(New warp_Vector(0.2F, 0.2F, 1.0F), &HFFFFFF, 320, 80))
_scene.addLight("light2", New warp_Light(New warp_Vector(-1.0F, -1.0F, 1.0F), &HFFFFFF, 100, 40))
Dim path() As warp_Vector = New warp_Vector(15) {}
path(0) = New warp_Vector(0.0F, 0.2F, 0)
path(1) = New warp_Vector(0.13F, 0.25F, 0)
path(2) = New warp_Vector(0.33F, 0.3F, 0)
path(3) = New warp_Vector(0.43F, 0.6F, 0)
path(4) = New warp_Vector(0.48F, 0.9F, 0)
path(5) = New warp_Vector(0.5F, 0.9F, 0)
path(6) = New warp_Vector(0.45F, 0.6F, 0)
path(7) = New warp_Vector(0.35F, 0.3F, 0)
path(8) = New warp_Vector(0.25F, 0.2F, 0)
path(9) = New warp_Vector(0.1F, 0.15F, 0)
path(10) = New warp_Vector(0.1F, 0.0F, 0)
path(11) = New warp_Vector(0.1F, -0.5F, 0)
path(12) = New warp_Vector(0.35F, -0.55F, 0)
path(13) = New warp_Vector(0.4F, -0.6F, 0)
path(14) = New warp_Vector(0.0F, -0.6F, 0)
_scene.addObject("wineglass", warp_ObjectFactory.ROTATIONOBJECT(path, 32))
_scene.sceneobject("wineglass").setMaterial(_scene.material("crystal"))
_scene.sceneobject("wineglass").scale(0.8F, 0.8F, 0.8F)
_scene.sceneobject("wineglass").rotate(0.5F, 0.0F, 0.0F)
_scene.render()
Refresh()
End Sub
Private Sub Warp3D_Load(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Private Sub Warp3D_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs)
_keargs = e
_controlkey = e.Control
End Sub
Private Sub Warp3D_KeyUp(ByVal sender As Object, ByVal e As KeyEventArgs)
_keargs = e
_controlkey = e.Control
End Sub
End Class
end namespace
@@ -1,251 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{D6F7F49F-4A6F-41CF-9129-C71B66BFC506}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Warp3DVB</RootNamespace>
<AssemblyName>Warp3DVB</AssemblyName>
<MyType>Windows</MyType>
<OptionStrict>On</OptionStrict>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>Warp3DVB.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<RemoveIntegerChecks>true</RemoveIntegerChecks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>Warp3DVB.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Original|AnyCPU' ">
<OutputPath>bin\Original\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == '64Bit CPU%27s|AnyCPU' ">
<OutputPath>bin\64Bit CPU%27s\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x64\Debug\</OutputPath>
<RemoveIntegerChecks>true</RemoveIntegerChecks>
<DocumentationFile>Warp3DVB.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x64\Release\</OutputPath>
<DocumentationFile>Warp3DVB.xml</DocumentationFile>
<Optimize>true</Optimize>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Original|x64' ">
<OutputPath>bin\x64\Original\</OutputPath>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == '64Bit CPU%27s|x64' ">
<OutputPath>bin\x64\64Bit CPU%27s\</OutputPath>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Slixel Tester|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Slixel Tester\</OutputPath>
<RemoveIntegerChecks>true</RemoveIntegerChecks>
<DocumentationFile>Warp3DVB.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisRuleAssemblies>\rules</CodeAnalysisRuleAssemblies>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.vb</CodeAnalysisModuleSuppressionsFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Slixel Tester|x64' ">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x64\Slixel Tester\</OutputPath>
<RemoveIntegerChecks>true</RemoveIntegerChecks>
<DocumentationFile>Warp3DVB.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleAssemblies>\rules</CodeAnalysisRuleAssemblies>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.vb</CodeAnalysisModuleSuppressionsFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
<Import Include="System.Drawing" />
<Import Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Warp3D.resx">
<DependentUpon>Warp3D.vb</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
</None>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<CustomToolNamespace>My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<Compile Include="Warp3D.vb">
<SubType>UserControl</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Warp_Vector.vb" />
<Compile Include="warp_Vertex.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_Triangle.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_TextureSettings.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_TextureProjector.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_TextureFactory.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_Texture.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_Screen.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_RenderPipeline.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_Rasterizer.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_Quaternion.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_ObjectFactory.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_Object.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_Matrix.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_Math.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_Material.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_Lightmap.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_Light.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_FXPlugin.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_FXLensFlare.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_Environment.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_Edge.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_CoreObject.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_Color.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_Camera.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="warp_3ds_Importer.vb" />
</ItemGroup>
<ItemGroup>
<Compile Include="Custom\warp_Color.vb" />
<Compile Include="Custom\warp_Screen.vb" />
<Compile Include="warp_Scene.vb" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -1,10 +0,0 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}
@@ -1,124 +0,0 @@
' Created by: X
' http://www.createdbyx.com/
' ----------------------
' C# to VB.NET conversion of this code was done by hand and with the assistance of the
' Convert C# to VB .NET application availible at http://www.kamalpatel.net/ConvertCSharp2VB.aspx
' ConvertCSharp2VB utility was developed by: Kamal Patel (http://www.KamalPatel.net)
' ----------------------
' Thanks to Alan Simes ( http://alansimes.blogdns.net/ ) for creating the Warp3D library.
' http://alansimes.blogdns.net/cs/files/default.aspx
' ----------------------
Imports System
Namespace Rednettle.Warp3D
Public Class warp_Vector
Public x As Single = 0 'Cartesian (default)
Public y As Single = 0 'Cartesian (default)
Public z As Single = 0 'Cartesian (default),Cylindric
Public r As Single = 0 'Cylindric
Public theta As Single = 0 'Cylindric
Public Sub New()
End Sub
Public Sub New(ByVal xpos As Single, ByVal ypos As Single, ByVal zpos As Single)
x = xpos
y = ypos
z = zpos
End Sub
Public Function normalize() As warp_Vector
Dim dist As Single = length()
If dist = 0 Then Return Me
Dim invdist As Single = 1 / dist
x *= invdist
y *= invdist
z *= invdist
Return Me
End Function
Public Function reverse() As warp_Vector
x = -x
y = -y
z = -z
Return Me
End Function
Public Function length() As Single
Return CType(Math.Sqrt(x * x + y * y + z * z), Single)
End Function
Public Function transform(ByVal m As warp_Matrix) As warp_Vector
Dim Newx As Single = x * m.m00 + y * m.m01 + z * m.m02 + m.m03
Dim Newy As Single = x * m.m10 + y * m.m11 + z * m.m12 + m.m13
Dim Newz As Single = x * m.m20 + y * m.m21 + z * m.m22 + m.m23
Return New warp_Vector(Newx, Newy, Newz)
End Function
Public Sub buildCylindric()
r = CType(Math.Sqrt(x * x + y * y), Single)
theta = CType(Math.Atan2(x, y), Single)
End Sub
Public Sub buildCartesian()
x = r * warp_Math.cos(theta)
y = r * warp_Math.sin(theta)
End Sub
Public Shared Function getNormal(ByVal a As warp_Vector, ByVal b As warp_Vector) As warp_Vector
Return vectorProduct(a, b).normalize()
End Function
Public Shared Function getNormal(ByVal a As warp_Vector, ByVal b As warp_Vector, ByVal c As warp_Vector) As warp_Vector
Return vectorProduct(a, b, c).normalize()
End Function
Public Shared Function vectorProduct(ByVal a As warp_Vector, ByVal b As warp_Vector) As warp_Vector
Return New warp_Vector(a.y * b.z - b.y * a.z, a.z * b.x - b.z * a.x, a.x * b.y - b.x * a.y)
End Function
Public Shared Function vectorProduct(ByVal a As warp_Vector, ByVal b As warp_Vector, ByVal c As warp_Vector) As warp_Vector
Return vectorProduct(warp_Vector.sub(b, a), warp_Vector.sub(c, a))
End Function
Public Shared Function angle(ByVal a As warp_Vector, ByVal b As warp_Vector) As Single
a.normalize()
b.normalize()
Return (a.x * b.x + a.y * b.y + a.z * b.z)
End Function
Public Shared Function add(ByVal a As warp_Vector, ByVal b As warp_Vector) As warp_Vector
Return New warp_Vector(a.x + b.x, a.y + b.y, a.z + b.z)
End Function
Public Shared Function [sub](ByVal a As warp_Vector, ByVal b As warp_Vector) As warp_Vector
Return New warp_Vector(a.x - b.x, a.y - b.y, a.z - b.z)
End Function
Public Shared Function scale(ByVal f As Single, ByVal a As warp_Vector) As warp_Vector
Return New warp_Vector(f * a.x, f * a.y, f * a.z)
End Function
Public Shared Function len(ByVal a As warp_Vector) As Single
Return CType(Math.Sqrt(a.x * a.x + a.y * a.y + a.z * a.z), Single)
End Function
'
' Public static void New random(single fact)
' ' returns a random vector
' {
' Return New warp_Vector(fact*warp_Math.random(),fact*warp_Math.random(),fact*warp_Math.random())
' }
'
' Public String toString()
' {
' Return New String ("<vector x="+x+" y="+y+" z="+z+">\r\n")
' }
' */
Public Function getClone() As warp_Vector
Return New warp_Vector(x, y, z)
End Function
End Class
End Namespace
@@ -1,196 +0,0 @@
' Created by: X
' http://www.createdbyx.com/
' ----------------------
' C# to VB.NET conversion of this code was done by hand and with the assistance of the
' Convert C# to VB .NET application availible at http://www.kamalpatel.net/ConvertCSharp2VB.aspx
' ConvertCSharp2VB utility was developed by: Kamal Patel (http://www.KamalPatel.net)
' ----------------------
' Thanks to Alan Simes ( http://alansimes.blogdns.net/ ) for creating the Warp3D library.
' http://alansimes.blogdns.net/cs/files/default.aspx
' ----------------------
Imports System
Imports System.IO
Imports System.Collections
Imports System.Net
Namespace Rednettle.Warp3D
'/ <summary>
'/ Summary description for warp_3ds_Importer.
'/ </summary>
Public Class warp_3ds_Importer
Private currentJunkId As Integer
Private nextJunkOffset As Integer
Private currentObjectName As String = Nothing
Private currentObject As warp_Object = Nothing
Private endOfStream As Boolean = False
Private _objects As Hashtable = New Hashtable()
Public Sub New()
End Sub
Public Function importFromFile(ByVal name As String, ByVal path As String) As Hashtable
Dim fs As Stream = Nothing
_objects.Clear()
If path.StartsWith("http") Then
Dim webrq As WebRequest = WebRequest.Create(path)
fs = webrq.GetResponse().GetResponseStream()
Else
fs = New FileStream(path, FileMode.Open)
End If
Dim br As BinaryReader = New BinaryReader(fs)
Return importFromStream(name, br)
End Function
Public Function importFromStream(ByVal name As String, ByVal inStream As BinaryReader) As Hashtable
_objects.Clear()
readJunkHeader(inStream)
If currentJunkId <> &H4D4D Then Return Nothing
Try
While True
readNextJunk(name, inStream)
End While
Catch
' ignored
End Try
inStream.Close()
Return _objects
End Function
Private Sub readJunkHeader(ByVal inStream As BinaryReader)
currentJunkId = readShort(inStream)
nextJunkOffset = readInt(inStream)
endOfStream = currentJunkId < 0
End Sub
Private Function readInt(ByVal inStream As BinaryReader) As Integer
Return inStream.ReadByte() Or (inStream.ReadByte() << 8) Or (inStream.ReadByte() << 16) Or (inStream.ReadByte() << 24)
End Function
Private Function readShort(ByVal inStream As BinaryReader) As Integer
Return (inStream.ReadByte() Or (inStream.ReadByte() << 8))
End Function
Private Sub readNextJunk(ByVal name As String, ByVal inStream As BinaryReader)
readJunkHeader(inStream)
If currentJunkId = &H3D3D Then Return
If currentJunkId = &H4000 Then
currentObjectName = readString(inStream)
Return
End If
If currentJunkId = &H4100 Then
currentObject = New warp_Object()
_objects.Add(name & "_" & currentObjectName, currentObject)
Return
End If
If currentJunkId = &H4110 Then
readVertexList(inStream)
Return
End If
If currentJunkId = &H4120 Then
readPointList(inStream)
Return
End If
If currentJunkId = &H4140 Then
readMappingCoordinates(inStream)
Return
End If
skipJunk(inStream)
End Sub
Private Function readString(ByVal inStream As BinaryReader) As String
Dim result As String = ""
Dim inByte As Byte
inByte = inStream.ReadByte()
While inByte <> 0
result &= inByte
inByte = inStream.ReadByte()
End While
Return result
End Function
Private Function readFloat(ByVal inStream As BinaryReader) As Single
Dim bits As Integer = readInt(inStream)
Dim s As Integer = CInt(IIf((bits >> 31) = 0, 1, -1))
Dim e As Integer = ((bits >> 23) And &HFF)
Dim m As Integer = CInt(IIf((e = 0), (bits And &H7FFFFF) << 1, (bits And &H7FFFFF) Or &H800000))
Dim v As Double = s * m * Math.Pow(2, e - 150)
Return CSng(v)
End Function
Private Sub skipJunk(ByVal inStream As BinaryReader)
Try
For i As Integer = 0 To nextJunkOffset - 6 'AndAlso (Not endOfStream) 'Step i + 1
If Not endOfStream Then endOfStream = (inStream.ReadByte() < 0)
Next
Catch
endOfStream = True
End Try
End Sub
Private Sub readVertexList(ByVal inStream As BinaryReader)
Dim x As Single, y As Single, z As Single
Dim vertices As Integer = readShort(inStream)
For i As Integer = 0 To vertices - 1 'Step i + 1
x = readFloat(inStream)
y = readFloat(inStream)
z = readFloat(inStream)
currentObject.addVertex(x, -y, z)
Next
End Sub
Private Sub readPointList(ByVal inStream As BinaryReader)
Dim v1 As Integer, v2 As Integer, v3 As Integer
Dim triangles As Integer = readShort(inStream)
For i As Integer = 0 To triangles - 1 'Step i + 1
v1 = readShort(inStream)
v2 = readShort(inStream)
v3 = readShort(inStream)
readShort(inStream)
currentObject.addTriangle(currentObject.vertex(v1), _
currentObject.vertex(v2), _
currentObject.vertex(v3))
Next
End Sub
Private Sub readMappingCoordinates(ByVal inStream As BinaryReader)
Dim vertices As Integer = readShort(inStream)
For i As Integer = 0 To vertices - 1 ' Step i + 1
currentObject.vertex(i).u = readFloat(inStream)
currentObject.vertex(i).v = readFloat(inStream)
Next
End Sub
End Class
End Namespace
@@ -1,155 +0,0 @@
' Created by: X
' http://www.createdbyx.com/
' ----------------------
' C# to VB.NET conversion of this code was done by hand and with the assistance of the
' Convert C# to VB .NET application availible at http://www.kamalpatel.net/ConvertCSharp2VB.aspx
' ConvertCSharp2VB utility was developed by: Kamal Patel (http://www.KamalPatel.net)
' ----------------------
' Thanks to Alan Simes ( http://alansimes.blogdns.net/ ) for creating the Warp3D library.
' http://alansimes.blogdns.net/cs/files/default.aspx
' ----------------------
Imports System
Namespace Rednettle.Warp3D
'/ <summary>
'/ Summary description for warp_Camera.
'/ </summary>
'/
Public Class warp_Camera
Public matrix As New warp_Matrix '= New warp_Matrix()
Public normalmatrix As New warp_Matrix '= New warp_Matrix()
Dim needsRebuild As Boolean = True ' Flag indicating changes on matrix
' Camera settings
Public pos As warp_Vector = New warp_Vector(0.0F, 0.0F, 0.0F)
Public lookat As warp_Vector = New warp_Vector(0.0F, 0.0F, 0.0F)
Public rollfactor As Single = 0.0F
Public fovfact As Single
Public screenwidth As Integer
Public screenheight As Integer
Public screenscale As Integer
Public Sub New()
setFov(90.0F)
End Sub
Public Sub New(ByVal fov As Single)
setFov(fov)
End Sub
Public Function getMatrix() As warp_Matrix
rebuildMatrices()
Return matrix
End Function
Public Function getNormalMatrix() As warp_Matrix
rebuildMatrices()
Return normalmatrix
End Function
Private Sub rebuildMatrices()
If Not needsRebuild Then Exit Sub
needsRebuild = False
Dim forward As warp_Vector, up As warp_Vector, right As warp_Vector
forward = warp_Vector.sub(lookat, pos)
up = New warp_Vector(0.0F, 1.0F, 0.0F)
right = warp_Vector.getNormal(up, forward)
up = warp_Vector.getNormal(forward, right)
forward.normalize()
up.normalize()
right.normalize()
normalmatrix = New warp_Matrix(right, up, forward)
normalmatrix.rotate(0, 0, rollfactor)
matrix = normalmatrix.getClone()
matrix.shift(pos.x, pos.y, pos.z)
normalmatrix = normalmatrix.inverse()
matrix = matrix.inverse()
End Sub
Public Sub setFov(ByVal fov As Single)
fovfact = CSng(Math.Tan(warp_Math.deg2rad(fov) / 2))
End Sub
Public Sub roll(ByVal angle As Single)
rollfactor += angle
needsRebuild = True
End Sub
Public Sub setPos(ByVal px As Single, ByVal py As Single, ByVal pz As Single)
pos = New warp_Vector(px, py, pz)
needsRebuild = True
End Sub
Public Sub setPos(ByVal p As warp_Vector)
pos = p
needsRebuild = True
End Sub
Public Sub setlookAt(ByVal px As Single, ByVal py As Single, ByVal pz As Single)
lookat = New warp_Vector(px, py, pz)
needsRebuild = True
End Sub
Public Sub setlookAt(ByVal p As warp_Vector)
lookat = p
needsRebuild = True
End Sub
Public Sub setScreensize(ByVal w As Integer, ByVal h As Integer)
screenwidth = w
screenheight = h
If w < h Then screenscale = w Else screenscale = h
End Sub
Public Sub shift(ByVal dx As Single, ByVal dy As Single, ByVal dz As Single)
pos = pos.transform(warp_Matrix.shiftMatrix(dx, dy, dz))
lookat = lookat.transform(warp_Matrix.shiftMatrix(dx, dy, dz))
needsRebuild = True
End Sub
Public Sub shift(ByVal v As warp_Vector)
shift(v.x, v.y, v.z)
End Sub
Public Sub rotate(ByVal dx As Single, ByVal dy As Single, ByVal dz As Single)
pos = pos.transform(warp_Matrix.rotateMatrix(dx, dy, dz))
needsRebuild = True
End Sub
Public Sub rotate(ByVal v As warp_Vector)
rotate(v.x, v.y, v.z)
End Sub
Public Shared Function FRONT() As warp_Camera
Dim cam As New warp_Camera ' = New warp_Camera()
cam.setPos(0, 0, -2.0F)
Return cam
End Function
Public Shared Function LEFT() As warp_Camera
Dim cam As New warp_Camera '= New warp_Camera()
cam.setPos(2.0F, 0, 0)
Return cam
End Function
Public Shared Function RIGHT() As warp_Camera
Dim cam As New warp_Camera '= New warp_Camera()
cam.setPos(-2.0F, 0, 0)
Return cam
End Function
Public Shared Function TOP() As warp_Camera
Dim cam As New warp_Camera '= New warp_Camera()
cam.setPos(0, -2.0F, 0)
Return cam
End Function
End Class
End Namespace
-192
View File
@@ -1,192 +0,0 @@
' Created by: X
' http://www.createdbyx.com/
' ----------------------
' C# to VB.NET conversion of this code was done by hand and with the assistance of the
' Convert C# to VB .NET application availible at http://www.kamalpatel.net/ConvertCSharp2VB.aspx
' ConvertCSharp2VB utility was developed by: Kamal Patel (http://www.KamalPatel.net)
' ----------------------
' Thanks to Alan Simes ( http://alansimes.blogdns.net/ ) for creating the Warp3D library.
' http://alansimes.blogdns.net/cs/files/default.aspx
' ----------------------
Imports System
Namespace Rednettle.Warp3D
'/ <summary>
'/ Summary description for warp_Color.
'/ </summary>
Public Class warp_Color
Public Shared ALPHA As Integer = &HFF000000 ' alpha mask
Public Shared RED As Integer = &HFF0000 ' red mask
Public Shared GREEN As Integer = &HFF00 ' green mask
Public Shared BLUE As Integer = &HFF ' blue mask
Public Shared MASK7Bit As Integer = &HFEFEFF ' mask for additive/subtractive shading
Public Shared MASK6Bit As Integer = &HFCFCFC ' mask for additive/subtractive shading
Public Shared RGB As Integer = &HFFFFFF ' rgb mask
Private Shared pixel As Integer, color As Integer, overflow As Integer, colorscale As Integer, r As Integer, g As Integer, b As Integer
Private Sub New()
End Sub
Public Shared Function random(ByVal color As Integer, ByVal delta As Integer) As Integer
Dim rnd As Random = New Random()
Dim r As Integer = (color >> 16) And 255
Dim g As Integer = (color >> 8) And 255
Dim b As Integer = color And 255
r = CInt(r + (rnd.NextDouble() * delta))
g = CInt(g + (rnd.NextDouble() * delta))
b = CInt(b + (rnd.NextDouble() * delta))
Return getCropColor(r, g, b)
End Function
Public Shared Function random() As Integer
Dim rnd As Random = New Random()
Return CInt((rnd.NextDouble() * 16777216))
End Function
Public Shared Function getRed(ByVal c As Integer) As Integer
Return (c And RED) >> 16
End Function
Public Shared Function getGreen(ByVal c As Integer) As Integer
Return (c And GREEN) >> 8
End Function
Public Shared Function getBlue(ByVal c As Integer) As Integer
Return c And BLUE
End Function
Public Shared Function makeGradient(ByVal colors() As Integer, ByVal size As Integer) As Integer()
Dim pal(size - 1) As Integer ' = New Integer(size) {}
Dim c1 As Integer, c2 As Integer, pos1 As Integer, pos2 As Integer, range As Integer
Dim r As Integer, g As Integer, b As Integer, r1 As Integer, g1 As Integer, b1 As Integer, r2 As Integer, g2 As Integer, b2 As Integer, dr As Integer, dg As Integer, db As Integer
If colors.GetLength(0) = 1 Then
c1 = colors(0)
For i As Integer = 0 To size - 1 'Step i + 1
pal(i) = c1
Next
Return pal
End If
For c As Integer = 0 To colors.GetLength(0) - 2 ' Step c + 1
c1 = colors(c)
c2 = colors(c + 1)
pos1 = size * c \ (colors.GetLength(0) - 1)
pos2 = size * (c + 1) \ (colors.GetLength(0) - 1)
range = pos2 - pos1
r1 = warp_Color.getRed(c1) << 16
g1 = warp_Color.getGreen(c1) << 16
b1 = warp_Color.getBlue(c1) << 16
r2 = warp_Color.getRed(c2) << 16
g2 = warp_Color.getGreen(c2) << 16
b2 = warp_Color.getBlue(c2) << 16
dr = (r2 - r1) \ range
dg = (g2 - g1) \ range
db = (b2 - b1) \ range
r = r1
g = g1
b = b1
For i As Integer = pos1 To pos2 - 1 'Step i + 1
pal(i) = getColor(r >> 16, g >> 16, b >> 16)
r += dr
g += dg
b += db
Next
Next
Return pal
End Function
Public Shared Function add(ByVal color1 As Integer, ByVal color2 As Integer) As Integer
pixel = (color1 And MASK7Bit) + (color2 And MASK7Bit)
overflow = pixel And &H1010100
overflow = overflow - (overflow >> 8)
Return ALPHA Or overflow Or pixel
End Function
' TOTO: Make sure using xor works properly xor replaces C# ~ operator
Public Shared Function [sub](ByVal color1 As Integer, ByVal color2 As Integer) As Integer
pixel = (color1 And MASK7Bit) + ((color2 Xor color2) And MASK7Bit)
overflow = (pixel Xor pixel) And &H1010100
overflow = overflow - (overflow >> 8)
Return ALPHA Or ((overflow Xor overflow) And pixel)
End Function
Public Shared Function subneg(ByVal color1 As Integer, ByVal color2 As Integer) As Integer
pixel = (color1 And MASK7Bit) + (color2 And MASK7Bit)
overflow = (pixel Xor pixel) And &H1010100
overflow = overflow - (overflow >> 8)
Return ALPHA Or ((overflow Xor overflow) And pixel)
End Function
Public Shared Function inv(ByVal color As Integer) As Integer
Return ALPHA Or (color Xor color)
End Function
Public Shared Function mix(ByVal color1 As Integer, ByVal color2 As Integer) As Integer
' Returns the averidge color from 2 colors
Return ALPHA Or (((color1 And MASK7Bit) >> 1) + ((color2 And MASK7Bit) >> 1))
End Function
Public Shared Function scale(ByVal color As Integer, ByVal factor As Integer) As Integer
If factor = 0 Then Return 0
If factor = 255 Then Return color
If factor = 127 Then Return (color And &HFEFEFE) >> 1
r = (((color >> 16) And 255) * factor) >> 8
g = (((color >> 8) And 255) * factor) >> 8
b = ((color And 255) * factor) >> 8
Return ALPHA Or (r << 16) Or (g << 8) Or b
End Function
Public Shared Function multiply(ByVal color1 As Integer, ByVal color2 As Integer) As Integer
If (color1 And RGB) = 0 Then Return 0
If (color2 And RGB) = 0 Then Return 0
r = (((color1 >> 16) And 255) * ((color2 >> 16) And 255)) >> 8
g = (((color1 >> 8) And 255) * ((color2 >> 8) And 255)) >> 8
b = ((color1 And 255) * (color2 And 255)) >> 8
Return ALPHA Or (r << 16) Or (g << 8) Or b
End Function
Public Shared Function transparency(ByVal bkgrd As Integer, ByVal color As Integer, ByVal alpha As Integer) As Integer
If alpha = 0 Then Return color
If alpha = 255 Then Return bkgrd
If alpha = 127 Then Return mix(bkgrd, color)
r = (alpha * (((bkgrd >> 16) And 255) - ((color >> 16) And 255)) >> 8) + ((color >> 16) And 255)
g = (alpha * (((bkgrd >> 8) And 255) - ((color >> 8) And 255)) >> 8) + ((color >> 8) And 255)
b = (alpha * ((bkgrd And 255) - (color And 255)) >> 8) + (color And 255)
Return alpha Or (r << 16) Or (g << 8) Or b
End Function
Public Shared Function getCropColor(ByVal r As Integer, ByVal g As Integer, ByVal b As Integer) As Integer
Return ALPHA Or (warp_Math.crop(r, 0, 255) << 16) Or (warp_Math.crop(g, 0, 255) << 8) Or warp_Math.crop(b, 0, 255)
End Function
Public Shared Function getColor(ByVal r As Integer, ByVal g As Integer, ByVal b As Integer) As Integer
Return ALPHA Or (r << 16) Or (g << 8) Or b
End Function
Public Shared Function getGray(ByVal color As Integer) As Integer
Dim r As Integer = ((color And RED) >> 16)
Dim g As Integer = ((color And GREEN) >> 8)
Dim b As Integer = (color And BLUE)
Dim Y As Integer = CInt((r * 3 + g * 6 + b) / 10)
Return ALPHA Or (Y << 16) Or (Y << 8) Or Y
End Function
Public Shared Function getAverage(ByVal color As Integer) As Integer
Return (((color And RED) >> 16) + ((color And GREEN) >> 8) + (color And BLUE)) \ 3
End Function
End Class
End Namespace
@@ -1,106 +0,0 @@
' Created by: X
' http://www.createdbyx.com/
' ----------------------
' C# to VB.NET conversion of this code was done by hand and with the assistance of the
' Convert C# to VB .NET application availible at http://www.kamalpatel.net/ConvertCSharp2VB.aspx
' ConvertCSharp2VB utility was developed by: Kamal Patel (http://www.KamalPatel.net)
' ----------------------
' Thanks to Alan Simes ( http://alansimes.blogdns.net/ ) for creating the Warp3D library.
' http://alansimes.blogdns.net/cs/files/default.aspx
' ----------------------
Imports System
Namespace Rednettle.Warp3D
'/ <summary>
'/ Summary description for warp_CoreObject.
'/ </summary>
'/
Public Class warp_CoreObject
Public matrix As New warp_Matrix ' = New warp_Matrix()
Public normalmatrix As New warp_Matrix '= New warp_Matrix()
Public Sub transform(ByVal m As warp_Matrix)
matrix.transform(m)
normalmatrix.transform(m)
End Sub
Public Sub shift(ByVal dx As Single, ByVal dy As Single, ByVal dz As Single)
matrix.shift(dx, dy, dz)
End Sub
Public Sub shift(ByVal v As warp_Vector)
matrix.shift(v.x, v.y, v.z)
End Sub
Public Sub scale(ByVal d As Single)
matrix.scale(d)
End Sub
Public Sub scale(ByVal dx As Single, ByVal dy As Single, ByVal dz As Single)
matrix.scale(dx, dy, dz)
End Sub
Public Sub scaleSelf(ByVal d As Single)
matrix.scaleSelf(d)
End Sub
Public Sub scaleSelf(ByVal dx As Single, ByVal dy As Single, ByVal dz As Single)
matrix.scaleSelf(dx, dy, dz)
End Sub
Public Sub rotate(ByVal d As warp_Vector)
rotateSelf(d.x, d.y, d.z)
End Sub
Public Sub rotateSelf(ByVal d As warp_Vector)
rotateSelf(d.x, d.y, d.z)
End Sub
Public Sub rotate(ByVal dx As Single, ByVal dy As Single, ByVal dz As Single)
matrix.rotate(dx, dy, dz)
normalmatrix.rotate(dx, dy, dz)
End Sub
Public Sub rotate(ByVal quat As warp_Quaternion, ByVal x As Single, ByVal y As Single, ByVal z As Single)
matrix.rotate(quat, x, y, z)
normalmatrix.rotate(quat, x, y, z)
End Sub
Public Sub rotate(ByVal m As warp_Matrix)
matrix.rotate(m)
normalmatrix.rotate(m)
End Sub
Public Sub rotateSelf(ByVal dx As Single, ByVal dy As Single, ByVal dz As Single)
matrix.rotateSelf(dx, dy, dz)
normalmatrix.rotateSelf(dx, dy, dz)
End Sub
Public Sub rotateSelf(ByVal quat As warp_Quaternion)
matrix.rotateSelf(quat)
normalmatrix.rotateSelf(quat)
End Sub
Public Sub rotateSelf(ByVal m As warp_Matrix)
matrix.rotateSelf(m)
normalmatrix.rotateSelf(m)
End Sub
Public Sub setPos(ByVal x As Single, ByVal y As Single, ByVal z As Single)
matrix.m03 = x
matrix.m13 = y
matrix.m23 = z
End Sub
Public Sub setPos(ByVal v As warp_Vector)
setPos(v.x, v.y, v.z)
End Sub
Public Function getPos() As warp_Vector
Return New warp_Vector(matrix.m03, matrix.m13, matrix.m23)
End Function
End Class
End Namespace
@@ -1,38 +0,0 @@
' Created by: X
' http://www.createdbyx.com/
' ----------------------
' C# to VB.NET conversion of this code was done by hand and with the assistance of the
' Convert C# to VB .NET application availible at http://www.kamalpatel.net/ConvertCSharp2VB.aspx
' ConvertCSharp2VB utility was developed by: Kamal Patel (http://www.KamalPatel.net)
' ----------------------
' Thanks to Alan Simes ( http://alansimes.blogdns.net/ ) for creating the Warp3D library.
' http://alansimes.blogdns.net/cs/files/default.aspx
' ----------------------
Imports System
Namespace Rednettle.Warp3D
'/ <summary>
'/ Summary description for warp_Edge.
'/ </summary>
'/
Public Class warp_Edge
Dim a As warp_Vertex, b As warp_Vertex
Public Sub New()
End Sub
Public Sub New(ByVal v1 As warp_Vertex, ByVal v2 As warp_Vertex)
a = v1
b = v2
End Sub
Public Function start() As warp_Vertex
Return a
End Function
Public Function [end]() As warp_Vertex
Return b
End Function
End Class
End Namespace
@@ -1,30 +0,0 @@
' Created by: X
' http://www.createdbyx.com/
' ----------------------
' C# to VB.NET conversion of this code was done by hand and with the assistance of the
' Convert C# to VB .NET application availible at http://www.kamalpatel.net/ConvertCSharp2VB.aspx
' ConvertCSharp2VB utility was developed by: Kamal Patel (http://www.KamalPatel.net)
' ----------------------
' Thanks to Alan Simes ( http://alansimes.blogdns.net/ ) for creating the Warp3D library.
' http://alansimes.blogdns.net/cs/files/default.aspx
' ----------------------
Imports System
Namespace Rednettle.Warp3D
'/ <summary>
'/ Summary description for warp_Environment.
'/ </summary>
Public Class warp_Environment
Public ambient As Integer = 0
Public fogcolor As Integer = 0
Public fogfact As Integer = 0
Public bgcolor As Integer = &HFFFFFFFF
Public background As warp_Texture = Nothing
Public Sub setBackground(ByVal t As warp_Texture)
background = t
End Sub
End Class
End Namespace
@@ -1,330 +0,0 @@
' Created by: X
' http://www.createdbyx.com/
' ----------------------
' C# to VB.NET conversion of this code was done by hand and with the assistance of the
' Convert C# to VB .NET application availible at http://www.kamalpatel.net/ConvertCSharp2VB.aspx
' ConvertCSharp2VB utility was developed by: Kamal Patel (http://www.KamalPatel.net)
' ----------------------
' Thanks to Alan Simes ( http://alansimes.blogdns.net/ ) for creating the Warp3D library.
' http://alansimes.blogdns.net/cs/files/default.aspx
' ----------------------
Imports System
Imports System.Collections.Generic
Imports System.Text
Namespace Rednettle.Warp3D
Public Class warp_FXLensFlare
Inherits warp_FXPlugin
Public flareObject As warp_Object
Private flares As Integer = 0
Private zBufferSensitive As Boolean = True
Private flare() As warp_Texture
Private flareDist() As Single
Private Sub New(ByVal scene As warp_Scene)
MyBase.New(scene)
End Sub
Public Sub New(ByVal name As String, ByVal scene As warp_Scene, ByVal zBufferSensitive As Boolean)
MyBase.New(scene)
Me.zBufferSensitive = zBufferSensitive
flareObject = New warp_Object()
flareObject.addVertex(New warp_Vertex(1.0F, 1.0F, 1.0F))
flareObject.rebuild()
scene.addObject(name, flareObject)
End Sub
Public Sub preset1()
clear()
addGlow(144, &H330099)
addStrike(320, 48, &H3366)
addStrike(48, 240, &H660033)
addRing(120, &H660000)
addRays(320, 32, 20, &H111111)
addSecs(12, 100, 64, &H6633CC, 64)
End Sub
Public Sub preset2()
clear()
addGlow(144, &H995500)
addStrike(640, 64, &HCC0000)
addStrike(32, 480, &HFF)
addStrike(64, 329, &H330099)
addRing(160, &H990000)
addRays(320, 24, 32, &H332211)
addSecs(12, 100, 64, &H333333, 100)
addSecs(12, 60, 40, &H336699, 80)
End Sub
Public Sub preset3()
clear()
addGlow(144, &H993322)
addStrike(400, 200, &HCC00FF)
addStrike(480, 32, &HFF)
addRing(180, &H990000)
addRays(240, 32, 48, &H332200)
addSecs(12, 80, 64, &H555555, 50)
addSecs(12, 60, 40, &H336699, 80)
End Sub
Public Sub setPos(ByVal pos As warp_Vector)
flareObject.fastvertex(0).pos = pos
End Sub
Public Sub clear()
flares = 0
flare = Nothing
flareDist = Nothing
End Sub
Public Sub addGlow(ByVal size As Integer, ByVal color As Integer)
addFlare(createGlow(size, size, color, 256), 0.0F)
End Sub
Public Sub addStrike(ByVal width As Integer, ByVal height As Integer, ByVal color As Integer)
addFlare(createGlow(width, height, color, 48), 0.0F)
End Sub
Public Sub addRing(ByVal size As Integer, ByVal color As Integer)
addFlare(createRing(size, color), 0.0F)
End Sub
Public Sub addRays(ByVal size As Integer, ByVal num As Integer, ByVal rad As Integer, ByVal color As Integer)
addFlare(createRays(size, num, rad, color), 0.0F)
End Sub
Public Sub addSecs(ByVal count As Integer, ByVal averidgeSize As Integer, ByVal sizeDelta As Integer, ByVal averidgeColor As Integer, ByVal colorDelta As Integer)
For i As Integer = 0 To count - 1 'Step i + 1
addFlare(createSec(averidgeSize, sizeDelta, averidgeColor, colorDelta), warp_Math.random(-0.5F, 3.0F))
Next
End Sub
Public Overrides Sub apply()
Dim px As Integer = flareObject.fastvertex(0).x
Dim py As Integer = flareObject.fastvertex(0).y
If Not flareObject.fastvertex(0).visible Then Exit Sub
If zBufferSensitive AndAlso (flareObject.fastvertex(0).z > scene.renderPipeline.zBuffer(px + py * screen.width)) Then Exit Sub
Dim cx As Integer = screen.width \ 2
Dim cy As Integer = screen.height \ 2
Dim dx As Single = (cx - px)
Dim dy As Single = (cy - py)
Dim posx As Integer, posy As Integer, xsize As Integer, ysize As Integer
Dim zoom As Single
Dim i As Integer
For i = 0 To flares - 1 'Step i + 1
zoom = warp_Math.pythagoras(dx, dy) / warp_Math.pythagoras(cx, cy)
zoom = (1 - zoom) / 2 + 1
xsize = flare(i).width
ysize = flare(i).height
posx = CInt(px + (dx * flareDist(i)))
posy = CInt(py + (dy * flareDist(i)))
screen.add(flare(i), posx - xsize \ 2, posy - ysize \ 2, xsize, ysize)
Next
End Sub
Private Sub addFlare(ByVal texture As warp_Texture, ByVal relPos As Single)
flares = flares + 1
If flares = 1 Then
flare = New warp_Texture(1) {}
flareDist = New Single(1) {}
Else
Dim temp1() As warp_Texture = New warp_Texture(flares - 1) {}
System.Array.Copy(flare, 0, temp1, 0, flares - 1)
flare = temp1
Dim temp2() As Single = New Single(flares - 1) {}
System.Array.Copy(flareDist, 0, temp2, 0, flares - 1)
flareDist = temp2
End If
flare(flares - 1) = texture
flareDist(flares - 1) = relPos
End Sub
Private Function createRadialTexture(ByVal w As Integer, ByVal h As Integer, ByVal colormap() As Integer, ByVal alphamap() As Integer) As warp_Texture
Dim offset As Integer
Dim relX As Single, relY As Single
Dim NewTexture As warp_Texture = New warp_Texture(w, h)
Dim palette() As Integer = getPalette(colormap, alphamap)
For y As Integer = h - 1 To 0 Step -1
offset = y * w
For x As Integer = w - 1 To 0 Step -1
relX = CSng((x - (w >> 1)) / (w >> 1))
relY = CSng((y - (h >> 1)) / (h >> 1))
NewTexture.pixel(offset + x) = palette(warp_Math.crop(CInt(255 * Math.Sqrt(relX * relX + relY * relY)), 0, 255))
Next
Next
Return NewTexture
End Function
Private Function getPalette(ByVal color() As Integer, ByVal alpha() As Integer) As Integer()
Dim r As Integer, g As Integer, b As Integer
Dim palette(255) As Integer '= New Integer(255) {}
For i As Integer = 255 To 0 Step -1
r = (((color(i) >> 16) And 255) * alpha(i)) >> 8
g = (((color(i) >> 8) And 255) * alpha(i)) >> 8
b = ((color(i) And 255) * alpha(i)) >> 8
palette(i) = warp_Color.getColor(r, g, b)
Next
Return palette
End Function
Private Function createGlow(ByVal w As Integer, ByVal h As Integer, ByVal color As Integer, ByVal alpha As Integer) As warp_Texture
Return createRadialTexture(w, h, getGlowPalette(color), getConstantAlpha(alpha))
End Function
Private Function createRing(ByVal size As Integer, ByVal color As Integer) As warp_Texture
Return createRadialTexture(size, size, getColorPalette(color, color), getRingAlpha(40))
End Function
Private Function createSec(ByVal size As Integer, ByVal sizedelta As Integer, ByVal color As Integer, ByVal colordelta As Integer) As warp_Texture
Dim s As Integer = CInt(warp_Math.randomWithDelta(size, sizedelta))
Dim c1 As Integer = warp_Color.random(color, colordelta)
Dim c2 As Integer = warp_Color.random(color, colordelta)
Return createRadialTexture(s, s, getColorPalette(c1, c2), getSecAlpha())
End Function
Private Function createRays(ByVal size As Integer, ByVal rays As Integer, ByVal rad As Integer, ByVal color As Integer) As warp_Texture
Dim pos As Integer
Dim relPos As Single
Dim texture As warp_Texture = New warp_Texture(size, size)
Dim radialMap(1023) As Integer '= New Integer(1023) {}
warp_Math.clearBuffer(radialMap, 0)
For i As Integer = 0 To rays - 1 'Step i + 1
pos = CInt(warp_Math.random(rad, 1023 - rad))
For k As Integer = pos - rad To pos + rad 'Step k + 1
relPos = (k - pos + rad) / (rad * 2.0F)
radialMap(k) = CInt(radialMap(k) + (255 * (1 + Math.Sin((relPos - 0.25) * 3.14159 * 2)) / 2))
Next
Next
Dim angle As Integer, offset As Integer, reldist As Integer
Dim xrel As Single, yrel As Single
Dim y As Integer
For y = size - 1 To 0 Step -1
offset = y * size
Dim x As Integer
For x = size - 1 To 0 Step -1
xrel = (2.0F * x - size) / size
yrel = (2.0F * y - size) / size
angle = CInt(1023 * Math.Atan2(xrel, yrel) / 3.14159 / 2) And 1023
reldist = CInt(Math.Max((255 - 255 * warp_Math.pythagoras(xrel, yrel)), 0))
texture.pixel(x + offset) = warp_Color.scale(color, radialMap(angle) * reldist \ 255)
Next
Next
Return texture
End Function
Private Function getGlowPalette(ByVal color As Integer) As Integer()
Dim r As Integer, g As Integer, b As Integer
Dim relDist As Single, diffuse As Single, specular As Single
Dim palette(255) As Integer '= New Integer(256) {}
Dim cr As Integer = (color >> 16) And 255
Dim cg As Integer = (color >> 8) And 255
Dim cb As Integer = color And 255
Dim i As Integer
For i = 255 To 0 Step -1
relDist = i / 255.0F
diffuse = CSng(Math.Cos(relDist * 1.57))
specular = CSng((255 / Math.Pow(2.718, relDist * 2.718) - i / 16))
r = CInt((cr * diffuse + specular))
g = CInt((cg * diffuse + specular))
b = CInt((cb * diffuse + specular))
palette(i) = warp_Color.getCropColor(r, g, b)
Next
Return palette
End Function
Private Function getConstantAlpha(ByVal alpha As Integer) As Integer()
Dim alphaPalette(255) As Integer '= New Integer(256) {}
For i As Integer = 255 To 0 Step -1
alphaPalette(i) = alpha
Next
Return alphaPalette
End Function
Private Function getLinearAlpha() As Integer()
Dim alphaPalette(255) As Integer '= New Integer(256) {}
For i As Integer = 255 To 0 Step -1
alphaPalette(i) = 255 - i
Next
Return alphaPalette
End Function
Private Function getRingAlpha(ByVal ringsize As Integer) As Integer()
Dim alphaPalette(255) As Integer ' = New Integer(256) {}
Dim angle As Single
'For i As Integer = 0 To 256 - 1 ' Step i + 1
' alphaPalette(i) = 0
'Next
For i As Integer = 0 To ringsize - 1 'Step i + 1
angle = 3.14159F / 180 * (180.0F * i / ringsize)
alphaPalette(255 - ringsize + i) = CInt((64 * Math.Sin(angle)))
Next
Return alphaPalette
End Function
Private Function getSecAlpha() As Integer()
Dim alphaPalette() As Integer = getRingAlpha(CInt(warp_Math.random(0, 255)))
For i As Integer = 0 To 255 '6 - 1 Step i + 1
alphaPalette(i) = (alphaPalette(i) + 255 - i) >> 2
Next
Return alphaPalette
End Function
Private Function getColorPalette(ByVal color1 As Integer, ByVal color2 As Integer) As Integer()
Dim palette() As Integer = New Integer(256) {}
Dim r1 As Integer = (color1 >> 16) And 255
Dim g1 As Integer = (color1 >> 8) And 255
Dim b1 As Integer = color1 And 255
Dim r2 As Integer = (color2 >> 16) And 255
Dim g2 As Integer = (color2 >> 8) And 255
Dim b2 As Integer = color2 And 255
Dim dr As Integer = r2 - r1
Dim dg As Integer = g2 - g1
Dim db As Integer = b2 - b1
Dim r As Integer = r1 << 8
Dim g As Integer = g1 << 8
Dim b As Integer = b1 << 8
For i As Integer = 0 To 255 '6 - 1 Step i + 1
palette(i) = warp_Color.getColor(r >> 8, g >> 8, b >> 8)
r += dr
g += dg
b += db
Next
Return palette
End Function
End Class
End Namespace
@@ -1,29 +0,0 @@
' Created by: X
' http://www.createdbyx.com/
' ----------------------
' C# to VB.NET conversion of this code was done by hand and with the assistance of the
' Convert C# to VB .NET application availible at http://www.kamalpatel.net/ConvertCSharp2VB.aspx
' ConvertCSharp2VB utility was developed by: Kamal Patel (http://www.KamalPatel.net)
' ----------------------
' Thanks to Alan Simes ( http://alansimes.blogdns.net/ ) for creating the Warp3D library.
' http://alansimes.blogdns.net/cs/files/default.aspx
' ----------------------
Imports System
Imports System.Collections.Generic
Imports System.Text
Namespace Rednettle.Warp3D
Public MustInherit Class warp_FXPlugin
Public scene As warp_Scene = Nothing
Public screen As warp_Screen = Nothing
Public Sub New(ByVal scene As warp_Scene)
Me.scene = scene
screen = scene.renderPipeline.screen
End Sub
Public MustOverride Sub apply()
End Class
End Namespace
@@ -1,68 +0,0 @@
' Created by: X
' http://www.createdbyx.com/
' ----------------------
' C# to VB.NET conversion of this code was done by hand and with the assistance of the
' Convert C# to VB .NET application availible at http://www.kamalpatel.net/ConvertCSharp2VB.aspx
' ConvertCSharp2VB utility was developed by: Kamal Patel (http://www.KamalPatel.net)
' ----------------------
' Thanks to Alan Simes ( http://alansimes.blogdns.net/ ) for creating the Warp3D library.
' http://alansimes.blogdns.net/cs/files/default.aspx
' ----------------------
Imports System
Namespace Rednettle.Warp3D
'/ <summary>
'/ Summary description for warp_Light.
'/ </summary>
Public Class warp_Light
' F I E L D S
Public v As warp_Vector 'Light direction()
Public v2 As warp_Vector 'projected Light direction
Public diffuse As Integer = 0
Public specular As Integer = 0
Public highlightSheen As Integer = 0
Public highlightSpread As Integer = 0
Dim matrix2 As warp_Matrix
Private Sub New()
End Sub
Public Sub New(ByVal direction As warp_Vector)
v = direction.getClone()
v.normalize()
End Sub
Public Sub New(ByVal direction As warp_Vector, ByVal diffuse As Integer)
v = direction.getClone()
v.normalize()
Me.diffuse = diffuse
End Sub
Public Sub New(ByVal direction As warp_Vector, ByVal color As Integer, ByVal highlightSheen As Integer, ByVal highlightSpread As Integer)
v = direction.getClone()
v.normalize()
Me.diffuse = color
Me.specular = color
Me.highlightSheen = highlightSheen
Me.highlightSpread = highlightSpread
End Sub
Public Sub New(ByVal direction As warp_Vector, ByVal diffuse As Integer, ByVal specular As Integer, ByVal highlightSheen As Integer, ByVal highlightSpread As Integer)
v = direction.getClone()
v.normalize()
Me.diffuse = diffuse
Me.specular = specular
Me.highlightSheen = highlightSheen
Me.highlightSpread = highlightSpread
End Sub
Public Sub project(ByVal m As warp_Matrix)
matrix2 = m.getClone()
matrix2.transform(m)
v2 = v.transform(matrix2)
End Sub
End Class
End Namespace
@@ -1,98 +0,0 @@
' Created by: X
' http://www.createdbyx.com/
' ----------------------
' C# to VB.NET conversion of this code was done by hand and with the assistance of the
' Convert C# to VB .NET application availible at http://www.kamalpatel.net/ConvertCSharp2VB.aspx
' ConvertCSharp2VB utility was developed by: Kamal Patel (http://www.KamalPatel.net)
' ----------------------
' Thanks to Alan Simes ( http://alansimes.blogdns.net/ ) for creating the Warp3D library.
' http://alansimes.blogdns.net/cs/files/default.aspx
' ----------------------
Imports System
Namespace Rednettle.Warp3D
'/ <summary>
'/ Summary description for warp_Lightmap.
'/ </summary>
Public Class warp_Lightmap
Public diffuse() As Integer = New Integer(65535) {}
Public specular() As Integer = New Integer(65535) {}
Private sphere() As Single = New Single(65535) {}
Private light() As warp_Light
Private lights As Integer
Private ambient As Integer
Private temp As Integer, overflow As Integer, color As Integer, pos As Integer, r As Integer, g As Integer, b As Integer
Public Sub New(ByVal scene As warp_Scene)
scene.rebuild()
light = scene.light
lights = scene.lights
ambient = scene.environment.ambient
buildSphereMap()
rebuildLightmap()
End Sub
Private Sub buildSphereMap()
Dim fnx As Single, fny As Single, fnz As Single
Dim pos As Integer
Dim ny As Integer
For ny = -128 To 128 - 1 ' Step ny + 1
fny = ny / 128.0F
Dim nx As Integer
For nx = -128 To 128 - 1 'Step nx + 1
pos = nx + 128 + ((ny + 128) << 8)
fnx = nx / 128.0F
fnz = CSng(1 - Math.Sqrt(fnx * fnx + fny * fny))
If fnz > 0 Then sphere(pos) = fnz Else sphere(pos) = 0
Next
Next
End Sub
Public Sub rebuildLightmap()
' System.Console.WriteLine(">> Rebuilding Light Map ... [" + lights + " light sources]")
Dim l As warp_Vector
Dim fnx As Single, fny As Single, phongfact As Single, sheen As Single, spread As Single
Dim diffuse As Integer, specular As Integer, cos As Integer, dr As Integer, dg As Integer, db As Integer, sr As Integer, sg As Integer, sb As Integer
Dim ny As Integer
For ny = -128 To 128 - 1 'Step ny + 1
fny = ny / 128.0F
Dim nx As Integer
For nx = -128 To 128 - 1 'Step nx + 1
pos = nx + 128 + ((ny + 128) << 8)
fnx = nx / 128.0F
sr = 0
sg = 0
sb = 0
dr = warp_Color.getRed(ambient)
dg = warp_Color.getGreen(ambient)
db = warp_Color.getBlue(ambient)
Dim i As Integer
For i = 0 To lights - 1 'Step i + 1
l = light(i).v
diffuse = light(i).diffuse
specular = light(i).specular
sheen = light(i).highlightSheen / 255.0F
spread = CSng(light(i).highlightSpread / 4096)
If spread < 0.01F Then spread = 0.01F 'else spread = spread
cos = CInt((255 * warp_Vector.angle(light(i).v, New warp_Vector(fnx, fny, sphere(pos)))))
If cos <= 0 Then cos = 0
dr += (warp_Color.getRed(diffuse) * cos) >> 8
dg += (warp_Color.getGreen(diffuse) * cos) >> 8
db += (warp_Color.getBlue(diffuse) * cos) >> 8
phongfact = CSng(sheen * Math.Pow(cos / 255.0F, 1 / spread))
sr = CInt(sr + warp_Color.getRed(specular) * phongfact)
sg = CInt(sg + warp_Color.getGreen(specular) * phongfact)
sb = CInt(sb + warp_Color.getBlue(specular) * phongfact)
Next
Me.diffuse(pos) = warp_Color.getCropColor(dr, dg, db)
Me.specular(pos) = warp_Color.getCropColor(sr, sg, sb)
Next
Next
End Sub
End Class
End Namespace
@@ -1,224 +0,0 @@
' Created by: X
' http://www.createdbyx.com/
' ----------------------
' C# to VB.NET conversion of this code was done by hand and with the assistance of the
' Convert C# to VB .NET application availible at http://www.kamalpatel.net/ConvertCSharp2VB.aspx
' ConvertCSharp2VB utility was developed by: Kamal Patel (http://www.KamalPatel.net)
' ----------------------
' Thanks to Alan Simes ( http://alansimes.blogdns.net/ ) for creating the Warp3D library.
' http://alansimes.blogdns.net/cs/files/default.aspx
' ----------------------
Imports System
Imports System.Drawing
Imports System.IO
Namespace Rednettle.Warp3D
'/ <summary>
'/ Summary description for warp_Material.
'/ </summary>
Public Class warp_Material
Public color As Integer = 0
Public transparency As Integer = 0
Public reflectivity As Integer = 255
Public type As Integer = 0
Public texture As warp_Texture = Nothing
Public envmap As warp_Texture = Nothing
Public flat As Boolean = False
Public wireframe As Boolean = False
Public opaque As Boolean = True
Public texturePath As String = Nothing
Public envmapPath As String = Nothing
Public textureSettings As warp_TextureSettings = Nothing
Public envmapSettings As warp_TextureSettings = Nothing
Public rwx As Double = 500.0
Public rwy As Double = 500.0
Public pt As Point = New Point(0, 0)
Public offset As Integer = 0
Public Sub New()
'
' TODO: Add constructor logic here
'
End Sub
Public Sub New(ByVal color As Integer)
setColor(color)
End Sub
Public Sub New(ByVal t As warp_Texture)
setTexture(t)
reflectivity = 255
End Sub
Public Sub New(ByVal path As String)
Dim fs As FileStream = New FileStream(Path, FileMode.Open)
Dim br As BinaryReader = New BinaryReader(fs)
importFromStream(br)
End Sub
Private Sub importFromStream(ByVal inStream As BinaryReader)
readSettings(inStream)
readTexture(inStream, True)
readTexture(inStream, False)
End Sub
Private Sub readSettings(ByVal inStream As BinaryReader)
setColor(readInt(inStream))
setTransparency(inStream.ReadByte())
setReflectivity(inStream.ReadByte())
setFlat(inStream.ReadBoolean())
End Sub
Private Function readInt(ByVal inStream As BinaryReader) As Integer
Return (inStream.ReadByte() << 24) Or (inStream.ReadByte() << 16) Or (inStream.ReadByte() << 8) Or inStream.ReadByte()
End Function
Private Function readString(ByVal inStream As BinaryReader) As String
Dim result As String = ""
Dim inByte As Byte
inByte = inStream.ReadByte()
While inByte <> 60
result &= inByte
inByte = inStream.ReadByte()
End While
Return result
End Function
Private Sub readTexture(ByVal inStream As BinaryReader, ByVal textureId As Boolean)
Dim t As warp_Texture = Nothing
Dim id As Integer = inStream.ReadSByte()
If id = 1 Then
t = New warp_Texture("c:/source/warp3d/materials/skymap.jpg")
If t IsNot Nothing AndAlso textureId Then
texturePath = t.path
textureSettings = Nothing
setTexture(t)
End If
If t IsNot Nothing AndAlso Not textureId Then
envmapPath = t.path
envmapSettings = Nothing
setEnvmap(t)
End If
End If
If id = 2 Then
Dim w As Integer = readInt(inStream)
Dim h As Integer = readInt(inStream)
Dim type As Integer = inStream.ReadSByte()
Dim persistency As Single = readInt(inStream)
Dim density As Single = readInt(inStream)
persistency = 0.5F
density = 0.5F
Dim samples As Integer = inStream.ReadByte()
Dim numColors As Integer = inStream.ReadByte()
Dim colors() As Integer = New Integer(numColors - 1) {}
Dim i As Integer
For i = 0 To colors.Length - 1 ' numColors - 2 ' Step i + 1
colors(i) = readInt(inStream)
Next
If type = 1 Then
t = warp_TextureFactory.PERLIN(w, h, persistency, density, samples, 1024).colorize(warp_Color.makeGradient(colors, 1024))
End If
If type = 2 Then
t = warp_TextureFactory.WAVE(w, h, persistency, density, samples, 1024).colorize(warp_Color.makeGradient(colors, 1024))
End If
If type = 3 Then
t = warp_TextureFactory.GRAIN(w, h, persistency, density, samples, 20, 1024).colorize(warp_Color.makeGradient(colors, 1024))
End If
If textureId Then
texturePath = Nothing
textureSettings = New warp_TextureSettings(t, w, h, type, persistency, density, samples, colors)
setTexture(t)
Else
envmapPath = Nothing
envmapSettings = New warp_TextureSettings(t, w, h, type, persistency, density, samples, colors)
setEnvmap(t)
End If
End If
End Sub
Public Sub setTexture(ByVal t As warp_Texture)
texture = t
If texture IsNot Nothing Then texture.resize()
End Sub
Public Sub setEnvmap(ByVal env As warp_Texture)
envmap = env
env.resize(256, 256)
End Sub
Public Sub setColor(ByVal c As Integer)
color = c
End Sub
Public Sub setTransparency(ByVal factor As Integer)
transparency = warp_Math.crop(factor, 0, 255)
opaque = (transparency = 0)
End Sub
Public Sub setReflectivity(ByVal factor As Integer)
reflectivity = warp_Math.crop(factor, 0, 255)
End Sub
Public Sub setFlat(ByVal flat As Boolean)
Me.flat = flat
End Sub
Public Sub setWireframe(ByVal wireframe As Boolean)
Me.wireframe = wireframe
End Sub
Public Sub setType(ByVal type As Integer)
Me.type = type
End Sub
Public Function getTexture() As warp_Texture
Return texture
End Function
Public Function getEnvmap() As warp_Texture
Return envmap
End Function
Public Function getColor() As Integer
Return color
End Function
Public Function getTransparency() As Integer
Return transparency
End Function
Public Function getReflectivity() As Integer
Return reflectivity
End Function
Public Function [getType]() As Integer
Return type
End Function
Public Function isFlat() As Boolean
Return flat
End Function
Public Function isWireframe() As Boolean
Return wireframe
End Function
End Class
End Namespace
-182
View File
@@ -1,182 +0,0 @@
' Created by: X
' http://www.createdbyx.com/
' ----------------------
' C# to VB.NET conversion of this code was done by hand and with the assistance of the
' Convert C# to VB .NET application availible at http://www.kamalpatel.net/ConvertCSharp2VB.aspx
' ConvertCSharp2VB utility was developed by: Kamal Patel (http://www.KamalPatel.net)
' ----------------------
' Thanks to Alan Simes ( http://alansimes.blogdns.net/ ) for creating the Warp3D library.
' http://alansimes.blogdns.net/cs/files/default.aspx
' ----------------------
Imports System
Namespace Rednettle.Warp3D
'/ <summary>
'/ Summary description for warp_Math.
'/ </summary>
Public Class warp_Math
Private Shared sinus() As Single
Private Shared cosinus() As Single
Private Shared trig As Boolean = False
Public Shared pi As Single = 3.14159274F
Private Shared rad2scale As Single = 4096.0F / 3.14159274F / 2.0F
Private Shared pad As Single = 256 * 3.14159274F
Private Shared fastRandoms() As Integer
Private Shared fastRndPointer As Integer = 0
Private Shared fastRndInit As Boolean = False
Private Shared _rnd As Random = New Random()
Public Sub New()
'
' TODO: Add constructor logic here
'
End Sub
Public Shared Function interpolate(ByVal a As Single, ByVal b As Single, ByVal d As Single) As Single
Dim f As Single = (1 - cos(d * pi)) * 0.5F
Return a + f * (b - a)
End Function
Public Shared Function random() As Single
Dim rnd As Random = New Random()
Return CType((rnd.NextDouble() * 2 - 1), Single)
End Function
Public Shared Function random(ByVal min As Single, ByVal max As Single) As Single
'Random rnd = new Random();
Return CType((_rnd.NextDouble() * (max - min) + min), Single)
End Function
Public Shared Function randomWithDelta(ByVal averidge As Single, ByVal delta As Single) As Single
Return averidge + random() * delta
End Function
Public Shared Function fastRnd(ByVal bits As Integer) As Integer
If bits < 1 Then Return 0
fastRndPointer = (fastRndPointer + 1) And 31
If Not fastRndInit Then
fastRandoms = New Integer(31) {}
Dim i As Integer
For i = 0 To 30 ' - 1 Step i + 1
fastRandoms(i) = CInt(random(0, &HFFFFFF))
Next
fastRndInit = True
End If
Return fastRandoms(fastRndPointer) And (1 << (bits - 1))
End Function
Public Shared Function fastRndBit() As Integer
Return fastRnd(1)
End Function
Public Shared Function deg2rad(ByVal deg As Single) As Single
Return deg * 0.0174532924F
End Function
Public Shared Function rad2deg(ByVal rad As Single) As Single
Return rad * 57.29578F
End Function
Public Shared Function sin(ByVal angle As Single) As Single
If Not trig Then buildTrig()
Return sinus(CInt((angle + pad) * rad2scale) And &HFFF)
End Function
Public Shared Function cos(ByVal angle As Single) As Single
If Not trig Then buildTrig()
Return cosinus(CInt((angle + pad) * rad2scale) And &HFFF)
End Function
Private Shared Sub buildTrig()
' System.Console.WriteLine(">> Building warp_Math LUT")
sinus = New Single(4095) {}
cosinus = New Single(4095) {}
For i As Integer = 0 To 4095 '6 - 1 Step i + 1
sinus(i) = CSng(Math.Sin(i / rad2scale))
cosinus(i) = CSng(Math.Cos(i / rad2scale))
Next
trig = True
End Sub
Public Shared Function pythagoras(ByVal a As Single, ByVal b As Single) As Single
Return CSng(Math.Sqrt(a * a + b * b))
End Function
Public Shared Function pythagoras(ByVal a As Integer, ByVal b As Integer) As Integer
Return CInt(Math.Sqrt(a * a + b * b))
End Function
Public Shared Function crop(ByVal num As Integer, ByVal min As Integer, ByVal max As Integer) As Integer
If num < min Then Return min
If num > max Then Return max
Return num
End Function
Public Shared Function crop(ByVal num As Single, ByVal min As Single, ByVal max As Single) As Single
If num < min Then Return min
If num > max Then Return max
Return num
End Function
Public Shared Function inrange(ByVal num As Integer, ByVal min As Integer, ByVal max As Integer) As Boolean
Return ((num >= min) AndAlso (num < max))
End Function
Public Shared Sub clearBuffer(ByRef buffer() As Integer, ByVal c As Integer)
System.Array.Clear(buffer, 0, buffer.GetLength(0))
' For i As Integer = 0 To buffer.Length - 1
' buffer(i) = c
' Next
End Sub
Public Shared Sub clearBuffer(ByRef buffer() As Long, ByVal c As Integer)
System.Array.Clear(buffer, 0, buffer.GetLength(0))
' For i As Integer = 0 To buffer.Length - 1
' buffer(i) = c
' Next
End Sub
Public Shared Sub clearBuffer(ByVal buffer() As Byte, ByVal value As Byte)
System.Array.Clear(buffer, 0, buffer.GetLength(0))
End Sub
Public Shared Sub cropBuffer(ByVal buffer() As Integer, ByVal min As Integer, ByVal max As Integer)
For i As Integer = buffer.GetLength(0) - 1 To 0 Step -1
buffer(i) = crop(buffer(i), min, max)
Next
End Sub
Public Shared Sub copyBuffer(ByVal source() As Integer, ByVal target() As Integer)
System.Array.Copy(source, 0, target, 0, crop(source.GetLength(0), 0, target.GetLength(0)))
End Sub
'
' Public static single random()
' {
' Return CType((Math.r.random()*2-1), single)
' }
'
' Public static single random(single min, single max)
' {
' Return CType((Math.random()*(max-min)+min), single)
' }
'
' Public static single randomWithDelta(single averidge, single delta)
' {
' Return averidge+random()*delta
' }
' */
End Class
End Namespace

Some files were not shown because too many files have changed in this diff Show More