diff --git a/Helpers/ModelViewer/Grid3D.cs b/Helpers/ModelViewer/Grid3D.cs deleted file mode 100644 index ec52c9e..0000000 --- a/Helpers/ModelViewer/Grid3D.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System.Windows.Media; -using System.Windows.Media.Media3D; -using _3DTools; - -namespace s3piwrappers.ModelViewer -{ - public class Grid3D : ModelVisual3D - { - private int mGridSize = 10; - private Color mXColor = Colors.Red; - private Color mYColor = Colors.Yellow; - private Color mZColor = Colors.Blue; - private Color mGridColor = Colors.LightGray; - private float mMajorGridLine = 1f; - public Grid3D() - { - Init(); - } - void Init() - { - Children.Clear(); - Children.Add(DrawLine(mGridSize, 0, 0, -mGridSize, 0, 0, mXColor)); - Children.Add(DrawLine(0, mGridSize, 0, 0, -mGridSize, 0, mYColor)); - Children.Add(DrawLine(0, 0, mGridSize, 0, 0, -mGridSize, mZColor)); - Color c = Colors.Gray; - for (float x = 1; x < mGridSize; x += mMajorGridLine) - { - for (float z = 1; z < mGridSize; z += mMajorGridLine) - { - Children.Add(DrawLine(x, 0, mGridSize, x, 0, -mGridSize, mGridColor)); - Children.Add(DrawLine(-x, 0, mGridSize, -x, 0, -mGridSize, mGridColor)); - Children.Add(DrawLine(mGridSize, 0, z, -mGridSize, 0, z, mGridColor)); - Children.Add(DrawLine(mGridSize, 0, -z, -mGridSize, 0, -z, mGridColor)); - } - } - - Children.Add(DrawLine(mGridSize, 0, mGridSize, -mGridSize, 0, mGridSize, mGridColor)); - Children.Add(DrawLine(-mGridSize, 0, -mGridSize, -mGridSize, 0, mGridSize, mGridColor)); - Children.Add(DrawLine(mGridSize, 0, mGridSize, mGridSize, 0, -mGridSize, mGridColor)); - Children.Add(DrawLine(-mGridSize, 0, -mGridSize, mGridSize, 0, -mGridSize, mGridColor)); - - } - public float MajorGridLine - { - get { return mMajorGridLine; } - set { if(mMajorGridLine!=value){mMajorGridLine = value; Init();} } - } - - - public Color GridColor - { - get { return mGridColor; } - set { if(mGridColor!=value){mGridColor = value; Init();} } - } - - public Color ZColor - { - get { return mZColor; } - set { if(mZColor!=value){mZColor = value; Init();} } - } - - public Color YColor - { - get { return mYColor; } - set { if(mYColor!=value){mYColor = value; Init();} } - } - - public Color XColor - { - get { return mXColor; } - set { if(mXColor!=value){mXColor = value; Init();} } - } - - public int GridSize - { - get { return mGridSize; } - set { if(mGridSize!=value){mGridSize = value; Init();} } - } - - static ScreenSpaceLines3D DrawLine(double x1, double y1, double z1, double x2, double y2, double z2, Color color) - { - ScreenSpaceLines3D l = new ScreenSpaceLines3D(); - l.Points.Add(new Point3D(x1, y1, z1)); - l.Points.Add(new Point3D(x2, y2, z2)); - l.Color = color; - return l; - } - } -} \ No newline at end of file diff --git a/Helpers/ModelViewer/MainWindow.xaml b/Helpers/ModelViewer/MainWindow.xaml index 879ec7c..f5151b7 100644 --- a/Helpers/ModelViewer/MainWindow.xaml +++ b/Helpers/ModelViewer/MainWindow.xaml @@ -1,8 +1,8 @@  + - - Shading: - - Shading: + + - - - + Meshes: - - States: - States: + - + @@ -123,6 +124,10 @@ Polygons: 1000 + + + + @@ -137,35 +142,17 @@ Grid.RowSpan="1" MinWidth="320" Background="#FF6F6F6F"> - - - - - - - - - - - - - - - - - - - - - - - + Focusable="True" CameraRotationMode="Trackball" ModelUpDirection="0,0,-1"> + + + + + + + + diff --git a/Helpers/ModelViewer/MainWindow.xaml.cs b/Helpers/ModelViewer/MainWindow.xaml.cs index 6708f9e..dfc7091 100644 --- a/Helpers/ModelViewer/MainWindow.xaml.cs +++ b/Helpers/ModelViewer/MainWindow.xaml.cs @@ -193,6 +193,22 @@ public MainWindow() mShadowMapMaterial = new DiffuseMaterial(shadowBrush); GeostateDictionary = LoadDictionary("Geostates"); MeshDictionary = LoadDictionary("MeshNames"); + Help.Text = + @" +Zoom: +1. Mouse Wheel +2. Ctrl+RMB+Drag +3. PageUp/PageDown + +Pan: +1. MouseWheel+Drag +2. Shift+RMB+Drag +3. Shift+Arrow Keys + +Rotate: +1. RMB+Drag +2. Arrow Keys +"; } public MainWindow(Stream s) @@ -240,8 +256,13 @@ void InitScene() if (chunk != null) { var mlod = chunk.RCOLBlock as MLOD; + double max_height = 0; foreach (var m in mlod.Meshes) { + if (m.Bounds.Max.Y > max_height) + { + max_height = m.Bounds.Max.Y; + } vertCount += m.VertexCount; polyCount += m.PrimitiveCount; var vbuf = (VBUF)GenericRCOLResource.ChunkReference.GetBlock(rcol, m.VertexBufferIndex); @@ -291,6 +312,7 @@ void InitScene() mGroupMeshes.Children.Add(model); mSceneMeshes.Add(sceneMesh); } + } else { @@ -403,7 +425,7 @@ static GeometryModel3D DrawModel(meshExpImp.ModelBlocks.Vertex[] verts, Int32[] { meshExpImp.ModelBlocks.Vertex v = verts[k]; - if (v.Position != null) mesh.Positions.Add(new Point3D(v.Position[0], v.Position[1], v.Position[2])); + if (v.Position != null) mesh.Positions.Add(new Point3D(v.Position[0], -v.Position[2], v.Position[1])); if (v.Normal != null) mesh.Normals.Add(new Vector3D(v.Normal[0], v.Normal[1], v.Normal[2])); if (v.UV != null && v.UV.Length > 0) mesh.TextureCoordinates.Add(new Point(v.UV[0][0], v.UV[0][1])); } diff --git a/Helpers/ModelViewer/ModelViewer.csproj b/Helpers/ModelViewer/ModelViewer.csproj index dde6262..3036a99 100644 --- a/Helpers/ModelViewer/ModelViewer.csproj +++ b/Helpers/ModelViewer/ModelViewer.csproj @@ -54,9 +54,8 @@ false - - False - ..\..\lib\3DTools-1.01-bin\3DTools.dll + + ..\..\..\..\..\..\lib\NET\helix\HelixToolkit.Wpf.dll ..\..\lib\s3pi_current\s3pi.GenericRCOLResource.dll @@ -89,7 +88,6 @@ - MSBuild:Compile Designer diff --git a/s3piwrappers.sln b/s3piwrappers.sln index 22cb621..24f8135 100644 --- a/s3piwrappers.sln +++ b/s3piwrappers.sln @@ -1,6 +1,6 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Helpers", "Helpers", "{9F9C64E9-B8A3-4933-9C3B-78560F6A206E}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "s3piwrappers.AnimationResources", "s3piwrappers.AnimationResources\s3piwrappers.AnimationResources.csproj", "{B33F19DE-F211-4D32-8D03-43024B88F177}"