[Liblas-commits] libpc: get swig building
liblas-commits at liblas.org
liblas-commits at liblas.org
Thu Mar 3 13:09:33 EST 2011
details: http://hg.liblas.orglibpc/rev/c2bebf3e40bd
changeset: 160:c2bebf3e40bd
user: Michael P. Gerlek <mpg at flaxen.com>
date: Thu Mar 03 09:55:47 2011 -0800
description:
get swig building
Subject: libpc: get swig building
details: http://hg.liblas.orglibpc/rev/fd1e3abfca1d
changeset: 161:fd1e3abfca1d
user: Michael P. Gerlek <mpg at flaxen.com>
date: Thu Mar 03 09:58:37 2011 -0800
description:
get swig building
Subject: libpc: start of pcview
details: http://hg.liblas.orglibpc/rev/598d3126a001
changeset: 162:598d3126a001
user: Michael P. Gerlek <mpg at flaxen.com>
date: Thu Mar 03 10:09:26 2011 -0800
description:
start of pcview
diffstat:
.hgignore | 4 +
csharp/PCView/App.xaml | 8 +
csharp/PCView/App.xaml.cs | 44 +
csharp/PCView/Mouse.fx | 35 +
csharp/PCView/Mouse.xaml | 14 +
csharp/PCView/Mouse.xaml.cs | 205 ++
csharp/PCView/MouseRenderEngine.cs | 296 ++++
csharp/PCView/PCView.csproj | 141 ++
csharp/PCView/Properties/AssemblyInfo.cs | 58 +
csharp/PCView/app.config | 3 +
csharp/README.txt | 4 +
csharp/libpc_swig.sln | 127 +-
csharp/libpc_swig_cpp/libpc.i | 162 +-
csharp/libpc_swig_cpp/libpc_swig_cpp.vcxproj | 356 ++--
csharp/libpc_swig_cpp/libpc_wrap.cpp | 1722 -------------------------
csharp/libpc_swig_cs/Dimension.cs | 179 --
csharp/libpc_swig_cs/VectorU32.cs | 349 -----
csharp/libpc_swig_cs/VectorU8.cs | 349 -----
csharp/libpc_swig_cs/libpc_swig_cpp.cs | 17 -
csharp/libpc_swig_cs/libpc_swig_cppPINVOKE.cs | 427 ------
csharp/libpc_swig_cs/libpc_swig_cs.csproj | 208 +-
csharp/libpc_swig_test/Program.cs | 76 +-
csharp/libpc_swig_test/TestDimension.cs | 56 +-
csharp/libpc_swig_test/libpc_swig_test.csproj | 190 +-
mpg-config.bat | 6 +-
25 files changed, 1422 insertions(+), 3614 deletions(-)
diffs (truncated from 5194 to 300 lines):
diff -r 689b6280c0d2 -r 598d3126a001 .hgignore
--- a/.hgignore Wed Mar 02 20:47:18 2011 -0800
+++ b/.hgignore Thu Mar 03 10:09:26 2011 -0800
@@ -1,5 +1,6 @@
syntax: glob
+# this is generated by cmake
libpc_defines.h
# rst outputs
@@ -27,3 +28,6 @@
*.sdf
*.suo
*.opensdf
+
+# generated swig files
+csharp/libpc_swig_cs/*.cs
diff -r 689b6280c0d2 -r 598d3126a001 csharp/PCView/App.xaml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/csharp/PCView/App.xaml Thu Mar 03 10:09:26 2011 -0800
@@ -0,0 +1,8 @@
+<Application x:Class="Flaxen.SlimDXControlLib.MouseExample.MouseApp"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ StartupUri="Mouse.xaml">
+ <Application.Resources>
+
+ </Application.Resources>
+</Application>
diff -r 689b6280c0d2 -r 598d3126a001 csharp/PCView/App.xaml.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/csharp/PCView/App.xaml.cs Thu Mar 03 10:09:26 2011 -0800
@@ -0,0 +1,44 @@
+//-----------------------------------------------------------------------
+// <copyright file="App.xaml.cs" company="Flaxen Geo">
+// Copyright (c) 2011, Michael P. Gerlek. All rights reserved.
+// </copyright>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * Neither the name of Flaxen Geo nor the names of its contributors may be
+// used to endorse or promote products derived from this software without
+// specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+// THE POSSIBILITY OF SUCH DAMAGE.
+//-----------------------------------------------------------------------
+
+namespace Flaxen.SlimDXControlLib.MouseExample
+{
+ using System.Windows;
+
+ /// <summary>
+ /// App class for the Mouse example.
+ /// </summary>
+ public partial class MouseApp : Application
+ {
+ }
+}
diff -r 689b6280c0d2 -r 598d3126a001 csharp/PCView/Mouse.fx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/csharp/PCView/Mouse.fx Thu Mar 03 10:09:26 2011 -0800
@@ -0,0 +1,35 @@
+cbuffer cbPerObject
+{
+ float4x4 gWVP;
+}
+
+// VertexShader
+void VS(float4 inputPos: POSITION,
+ float4 inputCol: COLOR,
+ out float4 outputPos : SV_POSITION,
+ out float4 outputCol : COLOR)
+{
+ //PS_IN output = (PS_IN)0;
+
+ outputPos = mul(inputPos, gWVP);
+
+ outputCol = inputCol;
+}
+
+// PixelShader
+void PS(float4 inputPos: SV_POSITION,
+ float4 inputCol: COLOR,
+ out float4 outputCol: SV_TARGET)
+{
+ outputCol = inputCol;
+}
+
+technique10 Render
+{
+ pass P0
+ {
+ SetGeometryShader( 0 );
+ SetVertexShader( CompileShader( vs_4_0, VS() ) );
+ SetPixelShader( CompileShader( ps_4_0, PS() ) );
+ }
+}
diff -r 689b6280c0d2 -r 598d3126a001 csharp/PCView/Mouse.xaml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/csharp/PCView/Mouse.xaml Thu Mar 03 10:09:26 2011 -0800
@@ -0,0 +1,14 @@
+<Window x:Class="Flaxen.SlimDXControlLib.MouseExample.Mouse"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d3d="clr-namespace:Flaxen.SlimDXControlLib;assembly=Flaxen.SlimDXControlLib"
+ Title="Mouse Example"
+ Width="500"
+ Height="500">
+
+ <DockPanel LastChildFill="True" >
+ <TextBlock DockPanel.Dock="Bottom" Text="{Binding Path=PositionString}" />
+ <d3d:SlimDXControl DockPanel.Dock="Top" x:Name="x_contentControl" />
+ </DockPanel>
+
+</Window>
diff -r 689b6280c0d2 -r 598d3126a001 csharp/PCView/Mouse.xaml.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/csharp/PCView/Mouse.xaml.cs Thu Mar 03 10:09:26 2011 -0800
@@ -0,0 +1,205 @@
+//-----------------------------------------------------------------------
+// <copyright file="Mouse.xaml.cs" company="Flaxen Geo">
+// Copyright (c) 2011, Michael P. Gerlek. All rights reserved.
+// </copyright>
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// * Neither the name of Flaxen Geo nor the names of its contributors may be
+// used to endorse or promote products derived from this software without
+// specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+// THE POSSIBILITY OF SUCH DAMAGE.
+//-----------------------------------------------------------------------
+
+namespace Flaxen.SlimDXControlLib.MouseExample
+{
+ using System.Collections.Generic;
+ using System.ComponentModel;
+ using System.Globalization;
+ using System.Windows;
+ using System.Windows.Documents;
+ using System.Windows.Input;
+ using SlimDX;
+
+ /// <summary>
+ /// Implements the MouseExample test.
+ /// </summary>
+ public partial class Mouse : Window, INotifyPropertyChanged
+ {
+ private MouseRenderEngine m_renderEngine;
+ private Point m_downPoint;
+ private bool m_isMoving = false;
+ private string m_positionString;
+
+ /// <summary>
+ /// Initializes a new instance of the Mouse class.
+ /// </summary>
+ public Mouse()
+ {
+ InitializeComponent();
+
+ Vector4[] points = CreateAxes();
+ m_renderEngine = new MouseRenderEngine(points);
+ x_contentControl.RegisterRenderer(m_renderEngine);
+
+ this.MouseMove += new MouseEventHandler(Mouse_MouseMove);
+ this.MouseDown += new MouseButtonEventHandler(Mouse_MouseDown);
+ this.MouseUp += new MouseButtonEventHandler(Mouse_MouseUp);
+ this.MouseWheel += new MouseWheelEventHandler(Mouse_MouseWheel);
+
+ PositionString = string.Empty;
+
+ this.DataContext = this;
+
+ return;
+ }
+
+ /// <summary>
+ /// Gets or sets a string containing the mouse position (in world coordinates).
+ /// </summary>
+ public string PositionString
+ {
+ get
+ {
+ return m_positionString;
+ }
+
+ set
+ {
+ if (value != m_positionString)
+ {
+ m_positionString = value;
+ NotifyPropertyChanged("PositionString");
+ }
+ }
+ }
+
+ #region mouse handlers
+ private void Mouse_MouseDown(object sender, MouseButtonEventArgs e)
+ {
+ if (e.LeftButton == MouseButtonState.Pressed)
+ {
+ m_downPoint = e.GetPosition(x_contentControl);
+ m_isMoving = true;
+ }
+ }
+
+ private void Mouse_MouseUp(object sender, MouseButtonEventArgs e)
+ {
+ m_isMoving = false;
+ }
+
+ private void Mouse_MouseMove(object sender, MouseEventArgs e)
+ {
+ Point mouse = e.GetPosition(x_contentControl);
+
+ Vector3 world = m_renderEngine.ConvertToWorldCoordinates(mouse, (float)x_contentControl.ActualWidth, (float)x_contentControl.ActualHeight);
+
+ PositionString = string.Format(
+ CultureInfo.InvariantCulture,
+ "[{0},{1}] X={2} Y={3} Z={4}",
+ mouse.X,
+ mouse.Y,
+ world.X.ToString("F1", CultureInfo.InvariantCulture),
+ world.Y.ToString("F1", CultureInfo.InvariantCulture),
+ world.Z.ToString("F1", CultureInfo.InvariantCulture));
+
+ if (e.LeftButton == MouseButtonState.Pressed)
+ {
+ if (m_isMoving)
+ {
+ Point currPoint = e.GetPosition(x_contentControl);
+ Vector3 camera = m_renderEngine.CameraPosition;
+ Vector3 target = m_renderEngine.TargetPosition;
+ camera.X += (float)(m_downPoint.X - currPoint.X) / 100.0f;
+ target.X += (float)(m_downPoint.X - currPoint.X) / 100.0f;
+ camera.Y += -(float)(m_downPoint.Y - currPoint.Y) / 100.0f;
+ target.Y += -(float)(m_downPoint.Y - currPoint.Y) / 100.0f;
+ m_renderEngine.CameraPosition = camera;
+ m_renderEngine.TargetPosition = target;
+ m_downPoint = currPoint;
+ }
+ }
+
+ return;
+ }
+
+ private void Mouse_MouseWheel(object sender, MouseWheelEventArgs e)
+ {
+ Vector3 camera = m_renderEngine.CameraPosition;
+ camera.Z += e.Delta / 100.0f;
+ camera.Z += e.Delta / 100.0f;
+ m_renderEngine.CameraPosition = camera;
+ }
+ #endregion
+
+ private Vector4[] CreateAxes()
+ {
+ Vector4 red = new Vector4(1, 0, 0, 1);
+ Vector4 green = new Vector4(0, 1, 0, 1);
+ Vector4 blue = new Vector4(0, 0, 1, 1);
+
+ List<Vector4> points = new List<Vector4>();
More information about the Liblas-commits
mailing list