diff options
author | gareth | 2007-03-07 19:07:00 +0000 |
---|---|---|
committer | gareth | 2007-03-07 19:07:00 +0000 |
commit | 2159b3079ec8df2a7337a9d4ea54810b7028c4e1 (patch) | |
tree | 5473123011f7a302e63f89ec6ccb4477032fd1db /src/physics | |
parent | Imported branch (diff) | |
download | opensim-SC-2159b3079ec8df2a7337a9d4ea54810b7028c4e1.zip opensim-SC-2159b3079ec8df2a7337a9d4ea54810b7028c4e1.tar.gz opensim-SC-2159b3079ec8df2a7337a9d4ea54810b7028c4e1.tar.bz2 opensim-SC-2159b3079ec8df2a7337a9d4ea54810b7028c4e1.tar.xz |
fixed last screwup
Diffstat (limited to 'src/physics')
-rw-r--r-- | src/physics/AssemblyInfo.cs | 31 | ||||
-rw-r--r-- | src/physics/PhysicsManager.cs | 167 | ||||
-rw-r--r-- | src/physics/PhysicsManager.csproj | 41 | ||||
-rw-r--r-- | src/physics/PhysicsManager.sln | 23 | ||||
-rw-r--r-- | src/physics/default.build | 49 | ||||
-rw-r--r-- | src/physics/plugins/AssemblyInfo.cs | 31 | ||||
-rw-r--r-- | src/physics/plugins/PhysXplugin.cs | 199 | ||||
-rw-r--r-- | src/physics/plugins/PhysXplugin.csproj | 41 | ||||
-rw-r--r-- | src/physics/plugins/PhysXplugin.sln | 17 | ||||
-rw-r--r-- | src/physics/plugins/default.build | 49 |
10 files changed, 648 insertions, 0 deletions
diff --git a/src/physics/AssemblyInfo.cs b/src/physics/AssemblyInfo.cs new file mode 100644 index 0000000..57a8913 --- /dev/null +++ b/src/physics/AssemblyInfo.cs | |||
@@ -0,0 +1,31 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // Information about this assembly is defined by the following | ||
6 | // attributes. | ||
7 | // | ||
8 | // change them to the information which is associated with the assembly | ||
9 | // you compile. | ||
10 | |||
11 | [assembly: AssemblyTitle("PhysicsManager")] | ||
12 | [assembly: AssemblyDescription("")] | ||
13 | [assembly: AssemblyConfiguration("")] | ||
14 | [assembly: AssemblyCompany("")] | ||
15 | [assembly: AssemblyProduct("PhysicsManager")] | ||
16 | [assembly: AssemblyCopyright("")] | ||
17 | [assembly: AssemblyTrademark("")] | ||
18 | [assembly: AssemblyCulture("")] | ||
19 | |||
20 | // This sets the default COM visibility of types in the assembly to invisible. | ||
21 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | ||
22 | [assembly: ComVisible(false)] | ||
23 | |||
24 | // The assembly version has following format : | ||
25 | // | ||
26 | // Major.Minor.Build.Revision | ||
27 | // | ||
28 | // You can specify all values by your own or you can build default build and revision | ||
29 | // numbers with the '*' character (the default): | ||
30 | |||
31 | [assembly: AssemblyVersion("1.0.*")] | ||
diff --git a/src/physics/PhysicsManager.cs b/src/physics/PhysicsManager.cs new file mode 100644 index 0000000..0986501 --- /dev/null +++ b/src/physics/PhysicsManager.cs | |||
@@ -0,0 +1,167 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using System.Collections; | ||
30 | using System.IO; | ||
31 | using System.Reflection; | ||
32 | |||
33 | namespace PhysicsSystem | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// Description of MyClass. | ||
37 | /// </summary> | ||
38 | public class PhysicsManager | ||
39 | { | ||
40 | private Dictionary<string, IPhysicsPlugin> _plugins=new Dictionary<string, IPhysicsPlugin>(); | ||
41 | |||
42 | public PhysicsManager() | ||
43 | { | ||
44 | |||
45 | } | ||
46 | |||
47 | public PhysicsScene GetPhysicsScene(string engineName) | ||
48 | { | ||
49 | if(_plugins.ContainsKey(engineName)) | ||
50 | { | ||
51 | ServerConsole.MainConsole.Instance.WriteLine("creating "+engineName); | ||
52 | return _plugins[engineName].GetScene(); | ||
53 | } | ||
54 | else | ||
55 | { | ||
56 | ServerConsole.MainConsole.Instance.WriteLine("couldn't find physicsEngine: "+ engineName); | ||
57 | return null; | ||
58 | } | ||
59 | } | ||
60 | |||
61 | public void LoadPlugins() | ||
62 | { | ||
63 | string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory ,"Physics"); | ||
64 | string[] pluginFiles = Directory.GetFiles(path, "*.dll"); | ||
65 | |||
66 | |||
67 | for(int i= 0; i<pluginFiles.Length; i++) | ||
68 | { | ||
69 | this.AddPlugin(pluginFiles[i]); | ||
70 | } | ||
71 | } | ||
72 | |||
73 | private void AddPlugin(string FileName) | ||
74 | { | ||
75 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | ||
76 | |||
77 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
78 | { | ||
79 | if (pluginType.IsPublic) | ||
80 | { | ||
81 | if (!pluginType.IsAbstract) | ||
82 | { | ||
83 | Type typeInterface = pluginType.GetInterface("IPhysicsPlugin", true); | ||
84 | |||
85 | if (typeInterface != null) | ||
86 | { | ||
87 | IPhysicsPlugin plug = (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
88 | plug.Init(); | ||
89 | this._plugins.Add(plug.GetName(),plug); | ||
90 | |||
91 | } | ||
92 | |||
93 | typeInterface = null; | ||
94 | } | ||
95 | } | ||
96 | } | ||
97 | |||
98 | pluginAssembly = null; | ||
99 | } | ||
100 | } | ||
101 | public interface IPhysicsPlugin | ||
102 | { | ||
103 | bool Init(); | ||
104 | PhysicsScene GetScene(); | ||
105 | string GetName(); | ||
106 | void Dispose(); | ||
107 | } | ||
108 | |||
109 | public abstract class PhysicsScene | ||
110 | { | ||
111 | public abstract PhysicsActor AddAvatar(PhysicsVector position); | ||
112 | |||
113 | public abstract void Simulate(float timeStep); | ||
114 | |||
115 | public abstract void GetResults(); | ||
116 | |||
117 | public abstract void SetTerrain(float[] heightMap); | ||
118 | |||
119 | public abstract bool IsThreaded | ||
120 | { | ||
121 | get; | ||
122 | } | ||
123 | } | ||
124 | |||
125 | public abstract class PhysicsActor | ||
126 | { | ||
127 | public abstract PhysicsVector Position | ||
128 | { | ||
129 | get; | ||
130 | set; | ||
131 | } | ||
132 | |||
133 | public abstract PhysicsVector Velocity | ||
134 | { | ||
135 | get; | ||
136 | set; | ||
137 | } | ||
138 | |||
139 | public abstract PhysicsVector Acceleration | ||
140 | { | ||
141 | get; | ||
142 | } | ||
143 | |||
144 | public abstract void AddForce(PhysicsVector force); | ||
145 | |||
146 | public abstract void SetMomentum(PhysicsVector momentum); | ||
147 | } | ||
148 | |||
149 | public class PhysicsVector | ||
150 | { | ||
151 | public float X; | ||
152 | public float Y; | ||
153 | public float Z; | ||
154 | |||
155 | public PhysicsVector() | ||
156 | { | ||
157 | |||
158 | } | ||
159 | |||
160 | public PhysicsVector(float x, float y, float z) | ||
161 | { | ||
162 | X = x; | ||
163 | Y = y; | ||
164 | Z = z; | ||
165 | } | ||
166 | } | ||
167 | } | ||
diff --git a/src/physics/PhysicsManager.csproj b/src/physics/PhysicsManager.csproj new file mode 100644 index 0000000..dc705e2 --- /dev/null +++ b/src/physics/PhysicsManager.csproj | |||
@@ -0,0 +1,41 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <OutputType>Library</OutputType> | ||
4 | <RootNamespace>PhysicsManager</RootNamespace> | ||
5 | <AssemblyName>PhysicsManager</AssemblyName> | ||
6 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
7 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
8 | <ProjectGuid>{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}</ProjectGuid> | ||
9 | </PropertyGroup> | ||
10 | <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> | ||
11 | <OutputPath>bin\Debug\</OutputPath> | ||
12 | <Optimize>False</Optimize> | ||
13 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
14 | <DebugSymbols>True</DebugSymbols> | ||
15 | <DebugType>Full</DebugType> | ||
16 | <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> | ||
17 | </PropertyGroup> | ||
18 | <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
19 | <OutputPath>bin\Release\</OutputPath> | ||
20 | <Optimize>True</Optimize> | ||
21 | <DefineConstants>TRACE</DefineConstants> | ||
22 | <DebugSymbols>False</DebugSymbols> | ||
23 | <DebugType>None</DebugType> | ||
24 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
25 | </PropertyGroup> | ||
26 | <ItemGroup> | ||
27 | <Reference Include="System" /> | ||
28 | <Reference Include="System.Xml" /> | ||
29 | </ItemGroup> | ||
30 | <ItemGroup> | ||
31 | <Compile Include="PhysicsManager.cs" /> | ||
32 | <Compile Include="AssemblyInfo.cs" /> | ||
33 | </ItemGroup> | ||
34 | <ItemGroup> | ||
35 | <ProjectReference Include="..\ServerConsole\ServerConsole\ServerConsole.csproj"> | ||
36 | <Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project> | ||
37 | <Name>ServerConsole</Name> | ||
38 | </ProjectReference> | ||
39 | </ItemGroup> | ||
40 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> | ||
41 | </Project> \ No newline at end of file | ||
diff --git a/src/physics/PhysicsManager.sln b/src/physics/PhysicsManager.sln new file mode 100644 index 0000000..565813f --- /dev/null +++ b/src/physics/PhysicsManager.sln | |||
@@ -0,0 +1,23 @@ | |||
1 | | ||
2 | Microsoft Visual Studio Solution File, Format Version 9.00 | ||
3 | # SharpDevelop 2.1.0.2017 | ||
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysicsManager", "PhysicsManager.csproj", "{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}" | ||
5 | EndProject | ||
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysXplugin", "..\PhysXplugin\PhysXplugin\PhysXplugin.csproj", "{ADB751AA-8426-4668-B1FA-43762126CEB3}" | ||
7 | EndProject | ||
8 | Global | ||
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
10 | Debug|Any CPU = Debug|Any CPU | ||
11 | Release|Any CPU = Release|Any CPU | ||
12 | EndGlobalSection | ||
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
14 | {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
15 | {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
16 | {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Release|Any CPU.Build.0 = Release|Any CPU | ||
17 | {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
18 | {ADB751AA-8426-4668-B1FA-43762126CEB3}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
19 | {ADB751AA-8426-4668-B1FA-43762126CEB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
20 | {ADB751AA-8426-4668-B1FA-43762126CEB3}.Release|Any CPU.Build.0 = Release|Any CPU | ||
21 | {ADB751AA-8426-4668-B1FA-43762126CEB3}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
22 | EndGlobalSection | ||
23 | EndGlobal | ||
diff --git a/src/physics/default.build b/src/physics/default.build new file mode 100644 index 0000000..d39e62b --- /dev/null +++ b/src/physics/default.build | |||
@@ -0,0 +1,49 @@ | |||
1 | <?xml version="1.0"?> | ||
2 | <project name="OpenSim" default="build" basedir="."> | ||
3 | <description>nant buildfile for OpenSim</description> | ||
4 | <property name="debug" value="true" overwrite="false" /> | ||
5 | <target name="clean" description="remove all generated files"> | ||
6 | <delete file="../../bin/PhysicsManager.dll" failonerror="false" /> | ||
7 | </target> | ||
8 | |||
9 | <target name="svnupdate" description="updates to latest SVN"> | ||
10 | <exec program="svn"> | ||
11 | <arg value="update" /> | ||
12 | </exec> | ||
13 | </target> | ||
14 | |||
15 | <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build"> | ||
16 | |||
17 | </target> | ||
18 | |||
19 | <target name="build" description="compiles the source code"> | ||
20 | |||
21 | <loadfile file="../../VERSION" property="svnver"/> | ||
22 | <asminfo output="AssemblyInfo.cs" language="CSharp"> | ||
23 | <imports> | ||
24 | <import namespace="System" /> | ||
25 | <import namespace="System.Reflection" /> | ||
26 | <import namespace="System.Runtime.InteropServices" /> | ||
27 | </imports> | ||
28 | <attributes> | ||
29 | <attribute type="ComVisibleAttribute" value="false" /> | ||
30 | <attribute type="CLSCompliantAttribute" value="false" /> | ||
31 | <attribute type="AssemblyVersionAttribute" value="${svnver}" /> | ||
32 | <attribute type="AssemblyTitleAttribute" value="opensim-physicsmanager" /> | ||
33 | <attribute type="AssemblyDescriptionAttribute" value="Handles physics plugins" /> | ||
34 | <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/> | ||
35 | </attributes> | ||
36 | </asminfo> | ||
37 | |||
38 | <csc target="library" output="../../bin/PhysicsManager.dll" debug="${debug}" verbose="true" warninglevel="4"> | ||
39 | <references basedir="../../bin" failonempty="true"> | ||
40 | <include name="System" /> | ||
41 | <include name="System.Xml" /> | ||
42 | <include name="ServerConsole.dll" /> | ||
43 | </references> | ||
44 | <sources basedir="./"> | ||
45 | <include name="*.cs" /> | ||
46 | </sources> | ||
47 | </csc> | ||
48 | </target> | ||
49 | </project> | ||
diff --git a/src/physics/plugins/AssemblyInfo.cs b/src/physics/plugins/AssemblyInfo.cs new file mode 100644 index 0000000..0c9c06c --- /dev/null +++ b/src/physics/plugins/AssemblyInfo.cs | |||
@@ -0,0 +1,31 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // Information about this assembly is defined by the following | ||
6 | // attributes. | ||
7 | // | ||
8 | // change them to the information which is associated with the assembly | ||
9 | // you compile. | ||
10 | |||
11 | [assembly: AssemblyTitle("PhysXplugin")] | ||
12 | [assembly: AssemblyDescription("")] | ||
13 | [assembly: AssemblyConfiguration("")] | ||
14 | [assembly: AssemblyCompany("")] | ||
15 | [assembly: AssemblyProduct("PhysXplugin")] | ||
16 | [assembly: AssemblyCopyright("")] | ||
17 | [assembly: AssemblyTrademark("")] | ||
18 | [assembly: AssemblyCulture("")] | ||
19 | |||
20 | // This sets the default COM visibility of types in the assembly to invisible. | ||
21 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | ||
22 | [assembly: ComVisible(false)] | ||
23 | |||
24 | // The assembly version has following format : | ||
25 | // | ||
26 | // Major.Minor.Build.Revision | ||
27 | // | ||
28 | // You can specify all values by your own or you can build default build and revision | ||
29 | // numbers with the '*' character (the default): | ||
30 | |||
31 | [assembly: AssemblyVersion("1.0.*")] | ||
diff --git a/src/physics/plugins/PhysXplugin.cs b/src/physics/plugins/PhysXplugin.cs new file mode 100644 index 0000000..58a82fb --- /dev/null +++ b/src/physics/plugins/PhysXplugin.cs | |||
@@ -0,0 +1,199 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using PhysicsSystem; | ||
30 | |||
31 | namespace PhysXplugin | ||
32 | { | ||
33 | /// <summary> | ||
34 | /// Will be the PhysX plugin but for now will be a very basic physics engine | ||
35 | /// </summary> | ||
36 | public class PhysXPlugin : IPhysicsPlugin | ||
37 | { | ||
38 | private PhysXScene _mScene; | ||
39 | |||
40 | public PhysXPlugin() | ||
41 | { | ||
42 | |||
43 | } | ||
44 | |||
45 | public bool Init() | ||
46 | { | ||
47 | return true; | ||
48 | } | ||
49 | |||
50 | public PhysicsScene GetScene() | ||
51 | { | ||
52 | if(_mScene == null) | ||
53 | { | ||
54 | _mScene = new PhysXScene(); | ||
55 | } | ||
56 | return(_mScene); | ||
57 | } | ||
58 | |||
59 | public string GetName() | ||
60 | { | ||
61 | return("PhysX"); | ||
62 | } | ||
63 | |||
64 | public void Dispose() | ||
65 | { | ||
66 | |||
67 | } | ||
68 | } | ||
69 | |||
70 | public class PhysXScene :PhysicsScene | ||
71 | { | ||
72 | private List<PhysXActor> _actors = new List<PhysXActor>(); | ||
73 | private float[] _heightMap; | ||
74 | |||
75 | public PhysXScene() | ||
76 | { | ||
77 | |||
78 | } | ||
79 | |||
80 | public override PhysicsActor AddAvatar(PhysicsVector position) | ||
81 | { | ||
82 | PhysXActor act = new PhysXActor(); | ||
83 | act.Position = position; | ||
84 | _actors.Add(act); | ||
85 | return act; | ||
86 | } | ||
87 | |||
88 | public override void Simulate(float timeStep) | ||
89 | { | ||
90 | foreach (PhysXActor actor in _actors) | ||
91 | { | ||
92 | actor.Position.X = actor.Position.X + actor.Velocity.X * timeStep; | ||
93 | actor.Position.Y = actor.Position.Y + actor.Velocity.Y * timeStep; | ||
94 | actor.Position.Z = actor.Position.Z + actor.Velocity.Z * timeStep; | ||
95 | actor.Position.Z = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X]+1; | ||
96 | if(actor.Position.X<0) | ||
97 | { | ||
98 | actor.Position.X = 0; | ||
99 | actor.Velocity.X = 0; | ||
100 | } | ||
101 | if(actor.Position.Y < 0) | ||
102 | { | ||
103 | actor.Position.Y = 0; | ||
104 | actor.Velocity.Y = 0; | ||
105 | } | ||
106 | if(actor.Position.X > 255) | ||
107 | { | ||
108 | actor.Position.X = 255; | ||
109 | actor.Velocity.X = 0; | ||
110 | } | ||
111 | if(actor.Position.Y > 255) | ||
112 | { | ||
113 | actor.Position.Y = 255; | ||
114 | actor.Velocity.X = 0; | ||
115 | } | ||
116 | } | ||
117 | } | ||
118 | |||
119 | public override void GetResults() | ||
120 | { | ||
121 | |||
122 | } | ||
123 | |||
124 | public override bool IsThreaded | ||
125 | { | ||
126 | get | ||
127 | { | ||
128 | return(false); // for now we won't be multithreaded | ||
129 | } | ||
130 | } | ||
131 | |||
132 | public override void SetTerrain(float[] heightMap) | ||
133 | { | ||
134 | this._heightMap = heightMap; | ||
135 | } | ||
136 | } | ||
137 | |||
138 | public class PhysXActor : PhysicsActor | ||
139 | { | ||
140 | private PhysicsVector _position; | ||
141 | private PhysicsVector _velocity; | ||
142 | private PhysicsVector _acceleration; | ||
143 | |||
144 | public PhysXActor() | ||
145 | { | ||
146 | _velocity = new PhysicsVector(); | ||
147 | _position = new PhysicsVector(); | ||
148 | _acceleration = new PhysicsVector(); | ||
149 | } | ||
150 | |||
151 | public override PhysicsVector Position | ||
152 | { | ||
153 | get | ||
154 | { | ||
155 | return _position; | ||
156 | } | ||
157 | set | ||
158 | { | ||
159 | _position = value; | ||
160 | } | ||
161 | } | ||
162 | |||
163 | public override PhysicsVector Velocity | ||
164 | { | ||
165 | get | ||
166 | { | ||
167 | return _velocity; | ||
168 | } | ||
169 | set | ||
170 | { | ||
171 | _velocity = value; | ||
172 | } | ||
173 | } | ||
174 | |||
175 | public override PhysicsVector Acceleration | ||
176 | { | ||
177 | get | ||
178 | { | ||
179 | return _acceleration; | ||
180 | } | ||
181 | |||
182 | } | ||
183 | public void SetAcceleration (PhysicsVector accel) | ||
184 | { | ||
185 | this._acceleration = accel; | ||
186 | } | ||
187 | |||
188 | public override void AddForce(PhysicsVector force) | ||
189 | { | ||
190 | |||
191 | } | ||
192 | |||
193 | public override void SetMomentum(PhysicsVector momentum) | ||
194 | { | ||
195 | |||
196 | } | ||
197 | } | ||
198 | |||
199 | } | ||
diff --git a/src/physics/plugins/PhysXplugin.csproj b/src/physics/plugins/PhysXplugin.csproj new file mode 100644 index 0000000..1b84046 --- /dev/null +++ b/src/physics/plugins/PhysXplugin.csproj | |||
@@ -0,0 +1,41 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <OutputType>Library</OutputType> | ||
4 | <RootNamespace>PhysXplugin</RootNamespace> | ||
5 | <AssemblyName>PhysXplugin</AssemblyName> | ||
6 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
7 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
8 | <ProjectGuid>{ADB751AA-8426-4668-B1FA-43762126CEB3}</ProjectGuid> | ||
9 | </PropertyGroup> | ||
10 | <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> | ||
11 | <OutputPath>bin\Debug\</OutputPath> | ||
12 | <Optimize>False</Optimize> | ||
13 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
14 | <DebugSymbols>True</DebugSymbols> | ||
15 | <DebugType>Full</DebugType> | ||
16 | <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> | ||
17 | </PropertyGroup> | ||
18 | <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
19 | <OutputPath>bin\Release\</OutputPath> | ||
20 | <Optimize>True</Optimize> | ||
21 | <DefineConstants>TRACE</DefineConstants> | ||
22 | <DebugSymbols>False</DebugSymbols> | ||
23 | <DebugType>None</DebugType> | ||
24 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
25 | </PropertyGroup> | ||
26 | <ItemGroup> | ||
27 | <Reference Include="System" /> | ||
28 | <Reference Include="System.Xml" /> | ||
29 | </ItemGroup> | ||
30 | <ItemGroup> | ||
31 | <Compile Include="PhysXplugin.cs" /> | ||
32 | <Compile Include="AssemblyInfo.cs" /> | ||
33 | </ItemGroup> | ||
34 | <ItemGroup> | ||
35 | <ProjectReference Include="..\PhysicsManager.csproj"> | ||
36 | <Project>{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}</Project> | ||
37 | <Name>PhysicsManager</Name> | ||
38 | </ProjectReference> | ||
39 | </ItemGroup> | ||
40 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> | ||
41 | </Project> \ No newline at end of file | ||
diff --git a/src/physics/plugins/PhysXplugin.sln b/src/physics/plugins/PhysXplugin.sln new file mode 100644 index 0000000..06e73d1 --- /dev/null +++ b/src/physics/plugins/PhysXplugin.sln | |||
@@ -0,0 +1,17 @@ | |||
1 | | ||
2 | Microsoft Visual Studio Solution File, Format Version 9.00 | ||
3 | # SharpDevelop 2.1.0.2017 | ||
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysXplugin", "PhysXplugin.csproj", "{ADB751AA-8426-4668-B1FA-43762126CEB3}" | ||
5 | EndProject | ||
6 | Global | ||
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
8 | Debug|Any CPU = Debug|Any CPU | ||
9 | Release|Any CPU = Release|Any CPU | ||
10 | EndGlobalSection | ||
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
12 | {ADB751AA-8426-4668-B1FA-43762126CEB3}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
13 | {ADB751AA-8426-4668-B1FA-43762126CEB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
14 | {ADB751AA-8426-4668-B1FA-43762126CEB3}.Release|Any CPU.Build.0 = Release|Any CPU | ||
15 | {ADB751AA-8426-4668-B1FA-43762126CEB3}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
16 | EndGlobalSection | ||
17 | EndGlobal | ||
diff --git a/src/physics/plugins/default.build b/src/physics/plugins/default.build new file mode 100644 index 0000000..c40fea1 --- /dev/null +++ b/src/physics/plugins/default.build | |||
@@ -0,0 +1,49 @@ | |||
1 | <?xml version="1.0"?> | ||
2 | <project name="OpenSim" default="build" basedir="."> | ||
3 | <description>nant buildfile for OpenSim</description> | ||
4 | <property name="debug" value="true" overwrite="false" /> | ||
5 | <target name="clean" description="remove all generated files"> | ||
6 | <delete file="../../../bin/Physics/PhysXplugin.dll" failonerror="false" /> | ||
7 | </target> | ||
8 | |||
9 | <target name="svnupdate" description="updates to latest SVN"> | ||
10 | <exec program="svn"> | ||
11 | <arg value="update" /> | ||
12 | </exec> | ||
13 | </target> | ||
14 | |||
15 | <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build"> | ||
16 | |||
17 | </target> | ||
18 | |||
19 | <target name="build" description="compiles the source code"> | ||
20 | |||
21 | <loadfile file="../../../VERSION" property="svnver"/> | ||
22 | <asminfo output="AssemblyInfo.cs" language="CSharp"> | ||
23 | <imports> | ||
24 | <import namespace="System" /> | ||
25 | <import namespace="System.Reflection" /> | ||
26 | <import namespace="System.Runtime.InteropServices" /> | ||
27 | </imports> | ||
28 | <attributes> | ||
29 | <attribute type="ComVisibleAttribute" value="false" /> | ||
30 | <attribute type="CLSCompliantAttribute" value="false" /> | ||
31 | <attribute type="AssemblyVersionAttribute" value="${svnver}" /> | ||
32 | <attribute type="AssemblyTitleAttribute" value="opensim-physicsmanager-physx" /> | ||
33 | <attribute type="AssemblyDescriptionAttribute" value="PhysX plugin for OpenSim" /> | ||
34 | <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/> | ||
35 | </attributes> | ||
36 | </asminfo> | ||
37 | |||
38 | <csc target="library" output="../../../bin/Physics/PhysXplugin.dll" debug="${debug}" verbose="true" warninglevel="4"> | ||
39 | <references basedir="../../../bin" failonempty="true"> | ||
40 | <include name="System" /> | ||
41 | <include name="System.Xml" /> | ||
42 | <include name="PhysicsManager.dll" /> | ||
43 | </references> | ||
44 | <sources basedir="./"> | ||
45 | <include name="*.cs" /> | ||
46 | </sources> | ||
47 | </csc> | ||
48 | </target> | ||
49 | </project> | ||