aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ConvertToPlugins/src/physics/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'ConvertToPlugins/src/physics/plugins')
-rw-r--r--ConvertToPlugins/src/physics/plugins/AssemblyInfo.cs31
-rw-r--r--ConvertToPlugins/src/physics/plugins/PhysXplugin.cs199
-rw-r--r--ConvertToPlugins/src/physics/plugins/PhysXplugin.csproj41
-rw-r--r--ConvertToPlugins/src/physics/plugins/PhysXplugin.sln17
-rw-r--r--ConvertToPlugins/src/physics/plugins/default.build49
5 files changed, 337 insertions, 0 deletions
diff --git a/ConvertToPlugins/src/physics/plugins/AssemblyInfo.cs b/ConvertToPlugins/src/physics/plugins/AssemblyInfo.cs
new file mode 100644
index 0000000..0c9c06c
--- /dev/null
+++ b/ConvertToPlugins/src/physics/plugins/AssemblyInfo.cs
@@ -0,0 +1,31 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using 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/ConvertToPlugins/src/physics/plugins/PhysXplugin.cs b/ConvertToPlugins/src/physics/plugins/PhysXplugin.cs
new file mode 100644
index 0000000..58a82fb
--- /dev/null
+++ b/ConvertToPlugins/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*/
27using System;
28using System.Collections.Generic;
29using PhysicsSystem;
30
31namespace 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/ConvertToPlugins/src/physics/plugins/PhysXplugin.csproj b/ConvertToPlugins/src/physics/plugins/PhysXplugin.csproj
new file mode 100644
index 0000000..1b84046
--- /dev/null
+++ b/ConvertToPlugins/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/ConvertToPlugins/src/physics/plugins/PhysXplugin.sln b/ConvertToPlugins/src/physics/plugins/PhysXplugin.sln
new file mode 100644
index 0000000..06e73d1
--- /dev/null
+++ b/ConvertToPlugins/src/physics/plugins/PhysXplugin.sln
@@ -0,0 +1,17 @@
1
2Microsoft Visual Studio Solution File, Format Version 9.00
3# SharpDevelop 2.1.0.2017
4Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysXplugin", "PhysXplugin.csproj", "{ADB751AA-8426-4668-B1FA-43762126CEB3}"
5EndProject
6Global
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
17EndGlobal
diff --git a/ConvertToPlugins/src/physics/plugins/default.build b/ConvertToPlugins/src/physics/plugins/default.build
new file mode 100644
index 0000000..c40fea1
--- /dev/null
+++ b/ConvertToPlugins/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>