aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin')
-rw-r--r--OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/AssemblyInfo.cs31
-rw-r--r--OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs277
-rw-r--r--OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj93
-rw-r--r--OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj.user12
-rw-r--r--OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build42
5 files changed, 455 insertions, 0 deletions
diff --git a/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/AssemblyInfo.cs b/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/AssemblyInfo.cs
new file mode 100644
index 0000000..0c9c06c
--- /dev/null
+++ b/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/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/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
new file mode 100644
index 0000000..c37acc8
--- /dev/null
+++ b/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
@@ -0,0 +1,277 @@
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 OpenSim.Physics.Manager;
30
31namespace OpenSim.Physics.BasicPhysicsPlugin
32{
33 /// <summary>
34 /// Will be the PhysX plugin but for now will be a very basic physics engine
35 /// </summary>
36 public class BasicPhysicsPlugin : IPhysicsPlugin
37 {
38 private BasicScene _mScene;
39
40 public BasicPhysicsPlugin()
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 BasicScene();
55 }
56 return(_mScene);
57 }
58
59 public string GetName()
60 {
61 return("basicphysics");
62 }
63
64 public void Dispose()
65 {
66
67 }
68 }
69
70 public class BasicScene :PhysicsScene
71 {
72 private List<BasicActor> _actors = new List<BasicActor>();
73 private float[] _heightMap;
74
75 public BasicScene()
76 {
77
78 }
79
80 public override PhysicsActor AddAvatar(PhysicsVector position)
81 {
82 BasicActor act = new BasicActor();
83 act.Position = position;
84 _actors.Add(act);
85 return act;
86 }
87
88 public override void RemoveAvatar(PhysicsActor actor)
89 {
90 BasicActor act = (BasicActor)actor;
91 if(_actors.Contains(act))
92 {
93 _actors.Remove(act);
94 }
95
96 }
97
98 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size)
99 {
100 return null;
101 }
102
103 public override void Simulate(float timeStep)
104 {
105 foreach (BasicActor actor in _actors)
106 {
107 actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep);
108 actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep);
109 actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep);
110 /*if(actor.Flying)
111 {
112 actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep);
113 }
114 else
115 {
116 actor.Position.Z = actor.Position.Z + ((-9.8f + actor.Velocity.Z) * timeStep);
117 }
118 if(actor.Position.Z < (_heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X]+1))
119 {*/
120 if ((actor.Position.Y > 0 && actor.Position.Y < 256) && (actor.Position.X > 0 && actor.Position.X < 256))
121 {
122 actor.Position.Z = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1;
123 }
124 //}
125
126
127
128 // This code needs sorting out - border crossings etc
129/* if(actor.Position.X<0)
130 {
131 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z));
132 actor.Position.X = 0;
133 actor.Velocity.X = 0;
134 }
135 if(actor.Position.Y < 0)
136 {
137 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z));
138 actor.Position.Y = 0;
139 actor.Velocity.Y = 0;
140 }
141 if(actor.Position.X > 255)
142 {
143 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z));
144 actor.Position.X = 255;
145 actor.Velocity.X = 0;
146 }
147 if(actor.Position.Y > 255)
148 {
149 ControllingClient.CrossSimBorder(new LLVector3(this.Position.X,this.Position.Y,this.Position.Z));
150 actor.Position.Y = 255;
151 actor.Velocity.X = 0;
152 }*/
153 }
154 }
155
156 public override void GetResults()
157 {
158
159 }
160
161 public override bool IsThreaded
162 {
163 get
164 {
165 return(false); // for now we won't be multithreaded
166 }
167 }
168
169 public override void SetTerrain(float[] heightMap)
170 {
171 this._heightMap = heightMap;
172 }
173
174 public override void DeleteTerrain()
175 {
176
177 }
178 }
179
180 public class BasicActor : PhysicsActor
181 {
182 private PhysicsVector _position;
183 private PhysicsVector _velocity;
184 private PhysicsVector _acceleration;
185 private bool flying;
186 public BasicActor()
187 {
188 _velocity = new PhysicsVector();
189 _position = new PhysicsVector();
190 _acceleration = new PhysicsVector();
191 }
192
193 public override bool Flying
194 {
195 get
196 {
197 return false;
198 }
199 set
200 {
201 flying= value;
202 }
203 }
204
205 public override PhysicsVector Position
206 {
207 get
208 {
209 return _position;
210 }
211 set
212 {
213 _position = value;
214 }
215 }
216
217 public override PhysicsVector Velocity
218 {
219 get
220 {
221 return _velocity;
222 }
223 set
224 {
225 _velocity = value;
226 }
227 }
228
229 public override Axiom.MathLib.Quaternion Orientation
230 {
231 get
232 {
233 return Axiom.MathLib.Quaternion.Identity;
234 }
235 set
236 {
237
238 }
239 }
240
241 public override PhysicsVector Acceleration
242 {
243 get
244 {
245 return _acceleration;
246 }
247
248 }
249
250 public override bool Kinematic
251 {
252 get
253 {
254 return true;
255 }
256 set
257 {
258
259 }
260 }
261 public void SetAcceleration (PhysicsVector accel)
262 {
263 this._acceleration = accel;
264 }
265
266 public override void AddForce(PhysicsVector force)
267 {
268
269 }
270
271 public override void SetMomentum(PhysicsVector momentum)
272 {
273
274 }
275 }
276
277}
diff --git a/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj b/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj
new file mode 100644
index 0000000..6d5b4d0
--- /dev/null
+++ b/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj
@@ -0,0 +1,93 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{4F874463-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.Physics.BasicPhysicsPlugin</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenSim.Physics.BasicPhysicsPlugin</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\bin\Physics\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\bin\Physics\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="Axiom.MathLib.dll" >
66 <HintPath>..\..\bin\Axiom.MathLib.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 </ItemGroup>
70 <ItemGroup>
71 <ProjectReference Include="..\Manager\OpenSim.Physics.Manager.csproj">
72 <Name>OpenSim.Physics.Manager</Name>
73 <Project>{8BE16150-0000-0000-0000-000000000000}</Project>
74 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
75 <Private>False</Private>
76 </ProjectReference>
77 </ItemGroup>
78 <ItemGroup>
79 <Compile Include="AssemblyInfo.cs">
80 <SubType>Code</SubType>
81 </Compile>
82 <Compile Include="BasicPhysicsPlugin.cs">
83 <SubType>Code</SubType>
84 </Compile>
85 </ItemGroup>
86 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
87 <PropertyGroup>
88 <PreBuildEvent>
89 </PreBuildEvent>
90 <PostBuildEvent>
91 </PostBuildEvent>
92 </PropertyGroup>
93</Project>
diff --git a/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj.user b/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj.user
new file mode 100644
index 0000000..d47d65d
--- /dev/null
+++ b/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj.user
@@ -0,0 +1,12 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>
diff --git a/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build b/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build
new file mode 100644
index 0000000..3497a55
--- /dev/null
+++ b/OpenSim-Source/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build
@@ -0,0 +1,42 @@
1<?xml version="1.0" ?>
2<project name="OpenSim.Physics.BasicPhysicsPlugin" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenSim.Physics.BasicPhysicsPlugin" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="AssemblyInfo.cs" />
15 <include name="BasicPhysicsPlugin.cs" />
16 </sources>
17 <references basedir="${project::get-base-directory()}">
18 <lib>
19 <include name="${project::get-base-directory()}" />
20 <include name="${project::get-base-directory()}/${build.dir}" />
21 </lib>
22 <include name="System.dll" />
23 <include name="../../bin/Axiom.MathLib.dll" />
24 <include name="../../bin/OpenSim.Physics.Manager.dll" />
25 </references>
26 </csc>
27 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/Physics/" />
28 <mkdir dir="${project::get-base-directory()}/../../bin/Physics/"/>
29 <copy todir="${project::get-base-directory()}/../../bin/Physics/">
30 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
31 <include name="*.dll"/>
32 <include name="*.exe"/>
33 </fileset>
34 </copy>
35 </target>
36 <target name="clean">
37 <delete dir="${bin.dir}" failonerror="false" />
38 <delete dir="${obj.dir}" failonerror="false" />
39 </target>
40 <target name="doc" description="Creates documentation.">
41 </target>
42</project>