This is the discussion forum for Helix Toolkit.
For bugs and new features, use the issue tracker located at GitHub.
Also try the chat room!
0

Port to Winform and SharpGL?

Anonymous 10 years ago 0
This discussion was imported from CodePlex

tingspain wrote at 2013-04-25 02:55:

Hello,

First of all, I would like to say that GREAT JOB. I have checked the demo apps and it is very impresive work.

I was wondering if it is possible to easy port this library to Winform and SharpGL?

I dont know too much about WPF.

Thanks in advance.

objo wrote at 2013-04-25 11:31:

This library targets WPF only and is based on the System.Windows.Media.Media3D classes.
Sorry, there are no plans to port to Windows forms and OpenGL.

RobPerkins wrote at 2013-04-25 18:07:

Is SharpGL even being maintained by anyone any longer?

przem321 wrote at 2013-04-25 23:16:

Well, but there is a DirectX 11 version with SharpDX coming up, isn't it?

objo wrote at 2013-04-26 00:01:

Yes, WPF+SharpDX/DX11 (and maybe Windows Store App+SharpDX) is the direction I would like to see this project moving!
Keep up the good work on the sharpdx fork, Przem!

tingspain wrote at 2013-04-26 01:02:

It a pity that is not plan to port it to winform at least. The last time that SharpGL was updated was on Jan 30, 2013.

I looked around very fast the source code of Helix 3D toolkit, and I found get my lest a little lost. I am not familiar with WPF. Do you think that it will be very hard to port to Winform + SharpGL or SharlpDX?

Maybe I can start the porting the code.

objo wrote at 2013-04-26 22:19:

It would be interesting to port the functionality that could be platform independent (importers/exporters, camera manipulation, geometry classes) to a portable class library. The same code could then be used for both WPF, SharpDX, OpenTK and SharpGL based projects!

tingspain wrote at 2013-04-27 04:38:

Objo, I dont mind to start that project. If you give me some hint and guidance. I will do it without problem.

objo wrote at 2013-05-08 15:48:

I would like to see the file importers/exporters refactored to be platform independent, and sharing the same design pattern. The geometry / mesh generation classes are probably not so good candidates, since these should use the platform's Point/Vector structures for performance...
Feel free to start a fork on this! I wish I had time to follow up, but I'm focusing on other tasks at the moment.

RobPerkins wrote at 2013-06-18 19:47:

I did some preliminary work on this kind of thing (geometry/mesh generation) with an intern about four years ago, and I still have the C# code he did. It seems to me that platform independence could probably be done with a helper static class, making attached methods, one for each kind of library.

Does the architecture make sense in terms of Helix?

objo wrote at 2013-06-18 22:20:

It would be great to see different solutions how this can be achieved without duplicating code on the different platforms! I have not been thinking of a static class with attached methods, please post some examples.

I think performance is important for the mesh generating code. I think this means that platform specific data types (e.g. point, quaternions, transformations) should be used as much as possible, but it is possible that the platform specific data types do not need to be exposed in the public interfaces.

RobPerkins wrote at 2013-06-18 23:16:

Pardon my incorrect use of jargon: What I meant was "Extension methods". Enabled by the .NET Framework, an extension method is decorated with the [Extension] attribute (which might only be a VB.NET requirement), declared static, and takes as its first argument an argument of the type which it extends. For example (from MSDN documentation):
namespace ExtensionMethods
{
    public static class MyExtensions
    {
        public static int WordCount(this String str)
        {
            return str.Split(new char[] { ' ', '.', '?' }, 
                             StringSplitOptions.RemoveEmptyEntries).Length;
        }
    }   
}
Which is then used by declaring using ExtensionMethods and:
string s = "Hello Extension Methods";
int i = s.WordCount();
I note that you have four such classes in the code base which I have (privately) forked for my own use.

What strikes me as interesting is that almost every 3D implementation uses a unique type name for its points, quaternions, and transformations, but the actual structure of the structs or class data have to be identical or nearly so. For games, performance of mesh generators is not vital; under the only architectures I can think of, most of those are loaded or preloaded before a high framerate is needed in the game. For engineering use cases, a high triangle count plus a relatively low framerate (mouse gesture animations, mostly) are the order of the day.

Frankly, for most mesh generation, I'm writing my own code against my data models and emitting the WPF formatted arrays and assigning them to the various Visual3Ds I use from the Helix library. So what I'm thinking about is extension methods like "ToOpenGL--structure--" or "ToSharpDX--whatever--" which would take the WPF structures native to Helix and emit the ones compatible with the other libraries. With a modern i5 or i7 and TPL it wouldn't even be computationally time consuming to execute such functions unless the facet counts were in the millions.

For my engineering based low-frame-rate, medium-delay-tolerant use cases, such an approach would not be so bad. I may give this more thought; the OpenTk stuff looks very, very compelling for non-WPF reasons.
0

Manipulators in code

Anonymous 10 years ago 0
This discussion was imported from CodePlex

ChrisKerridge wrote at 2012-04-30 10:52:

First off, great toolkit.

I want to be able to dynamically add objects to a 3D scene and be able to move them with manipulators using code similar to:

 

            var builder = new MeshBuilder(true, true);

            var position = new Point3D(0, 0, 0);

            builder.AddSphere(position, 1);


            var geom = new GeometryModel3D(builder.ToMesh(), Materials.Red);
            var visual = new ModelVisual3D();
            visual.Content = geom;

            var manipulator = new TranslateManipulator();
            manipulator.Bind(visual);
            manipulator.Position = position;
            manipulator.Direction = new Vector3D(0, 0, 1);
            manipulator.Offset = new Vector3D(0, 0, 1);
            manipulator.Color = Colors.Blue;

            
            vp.Children.Add(manipulator);
            vp.Children.Add(visual);
 

 

This gives me a sphere and an arrow pointing upwards (great), but dragging the arrow up and down has no affect on the sphere. How can I get the manipulator to affect the sphere?

Thanks a lot


objo wrote at 2012-05-02 21:36:

I found a bug in the code - the Manipulator.Bind method should not use CombinedManipulator.TargetTransformProperty, but its own. I will submit the fix soon. Thanks for providing the code that made it easy to find the error.

Also, move your code line

manipulator.Bind(visual);
below the manipulator.Position setter (this will actually modify the Transform and break the Transform binding).

Sorry there is no more documentation than the XML comments and the example on these features - it was experimental code that seemed to work well, so I just put it into the library...


christianw42 wrote at 2013-06-06 11:13:

Hello,

is there still anything broken in the toolkit? Here you can see my code, I can see the box and the manipulator, but when i click the manipulator, nothing happens.
var volumeBox = new BoxVisual3D();
volumeBox.Center = new Point3D(0, 0, 0);
volumeBox.Length = 0.3;
volumeBox.Width = 0.3;
volumeBox.Height = 0.3;
volumeBox.Material = MaterialHelper.CreateMaterial(Colors.SkyBlue, 0.3);

var manipulator = new TranslateManipulator();
manipulator.Color = Colors.Red;
manipulator.Length = 0.4;
manipulator.Diameter = 0.02;
manipulator.Position = new Point3D(0, 0, 0);
manipulator.Direction = new Vector3D(1, 0, 0);
manipulator.Bind(volumeBox);

this.VolumeBoxModel.Children.Add(volumeBox);
this.VolumeBoxModel.Children.Add(manipulator);
Thanks a lot

christianw42 wrote at 2013-06-06 11:30:

Ok, now it works. I think it's an initialize bug of UIElement3D.

Workaround: add the following two lines after the code above.
this.HelixViewport.Visibility = Visibility.Collapsed;
this.HelixViewport.Visibility = Visibility.Visible;
Thanks for a great framework!
0

LinesVisual3D Aren't Rendering

Anonymous 10 years ago 0
This discussion was imported from CodePlex

jrhokie1 wrote at 2013-01-24 15:09:

I have a WPF app, with my HelixViewport3D's ModelVisual3D Content property bound to a Model3DGroup-type property.  I create some EllipsoidVisual3D objects, and add them to my model group by

      modelGroup.Children.Add(ev3.Model);

Now I want to create some line segments.  I do this

   LinesVisual3D lv3d = new LinesVisual3D();

   Point3D p1 = new Point3D(...);

   lv3d.Points.Add(p1);

   Point3D p2 = new Point3D(...);

   lv3d.Points.Add(p2);

   lv3d.Thickness = 20;

   modelGroup.Children.Add(lv3d.Content);

But my lines aren't visible.  Setting IsRendering to true doesn't help.

I'm doing MVVM, so I don't want to directly add a visual to my viewport, as is done in the Points and Lines sample.  I know I'm using it wrong, I just can't figure out where.  Any help will be appreciated.

Thanks.

-reilly.


jrhokie1 wrote at 2013-01-24 16:01:

Never mind.  I found and used MeshBuilder.  Works like a champ.

Seriously, objo, you should put a PayPal "Donate" button up here.  I don't know how much they skim off the top, but I would pay you for your work.


objo wrote at 2013-02-04 15:26:

Ok. I will check if there is a bug in the LinesVisual3D change notifications, though.

I added an Amazon wish list link at the home page, if you feel for donating a book! :)

jrhokie1 wrote at 2013-02-04 16:25:

I had to do it: "Practical Rendering and Computation with Direct3D 11" is on the way.

[FYI, I'm working on a tool to extract statistics from 50 micron scans of coupons which have been subjected to corrosive environments. We read the scan data and visualize it in 3D. The tool provides controls to process the image, detect corroded pits, and extract their statistics for use in modeling. I used Helix to show and annotate the data. It couldn't have been easier.]

Please keep up the good work.

Regards,

-reilly.

objo wrote at 2013-02-05 08:55:

Great! Thank you!
Regarding the code - it seems like you are 'stealing' the Model3D from the LinesVisual3D instance. The screen space visuals must be updated every time the camera or transforms are changed, currently this is handled by the CompositionTarget.Rendering event. I guess there was no updating going on in your case where you had disconnected the LinesVisual3D from the visual tree.
0

Billboard rendering problem

Anonymous 10 years ago 0
This discussion was imported from CodePlex

jdek wrote at 2013-08-08 16:30:

Hello,
The Billboard is working well, but sometimes it has additional dashes at its bottom and right sides. Here is how the Billboard looks for me :



Behold my code used to initialized the Billboard :
new BillboardTextVisual3D { Text = "1800", Position = new Point3D(0, 0, 0) };
May be this is due to antialiasing...
If somebody has a solution...

objo wrote at 2013-08-08 16:42:

Could some padding/margin around the text work? I think I added a property to control this.

jdek wrote at 2013-08-08 16:55:

Good idea thank you, but no, "dashes" are translated but still visible.
But I found a workaround :
Set this property on the HelixViewport3D :
RenderOptions.BitmapScalingMode="Fant"
"HighQuality" is working too. May be it is a lack of precision of my graphic card because this doesn't appear if I switch from one to another (laptop with Nvidia Optimus).

objo wrote at 2013-08-08 17:03:

thanks for the workaround. I hadn't seen the Fant mode before :)

3dfx_IceFire wrote at 2014-02-28 08:32:

I am having a similar problem with my source code. If I am creating my billboard text items by creating several BillboardTextVisual3D it looks nicely. However due to performance issues I would prefer to use BillboardTextGroupVisual3D with a list of BillboardTextItem but then I get the same rendering issues as mentioned by jdek above.
See the following picture as an example:


I fould out that this happens only if the background is not set to transparent.
See my cource code:

variant 1

         labelTextGroup = new BillboardTextGroupVisual3D()
         {
            Background = Brushes.White,
            Items = null
         };
[...]
var labelTextItems = new List<BillboardTextItem>();
labelTextItems.Add(new BillboardTextItem()
{
   Text = current.ToString(),
   Position = (Point3D)((double)i * Direction + (FontSize * 0.07) * DesciptionOrientation),
   VerticalAlignment = VerticalAlignment.Center,
   HorizontalAlignment = HorizontalAlignment.Center
 });
labelTextGroup.Items = labelTextItems;

variant 2

            BillboardTextVisual3D label = new BillboardTextVisual3D()
            {
               Text = current.ToString(),
               FontFamily = new FontFamily("Courier New"),
               FontSize = this.fontSize,
               Background = new SolidColorBrush(Color.FromRgb(255, 255, 255)),
               Position = (Point3D)((double)i * Direction + (FontSize * 0.07) * DesciptionOrientation),
            };
Besides that I cannot find a BitmapScalingMode property in the HelixViewport3D. Was there a change in the HelixViewport3D class?
0

VRML Importer version

Anonymous 10 years ago 0
This discussion was imported from CodePlex

michaeldjackson wrote at 2012-11-19 16:48:

If I download the latest version Oct 2012, will it containthe VRML importer feature? If not, how do I get the version with VRML importer?


objo wrote at 2012-11-19 16:58:

You find the vrml import fork on http://helixtoolkit.codeplex.com/SourceControl/network/forks/glgweeke/vrmlImport

This fork has not been merged into the default branch yet.


michaeldjackson wrote at 2012-11-19 18:35:

I'm trying to import a simple wrl model using the VRML reader. It fails with the following exception:

System.FormatException was unhandled
  HResult=-2146233033
  Message=Input string was not in a correct format.
  Source=mscorlib
  StackTrace:
       at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt)
       at System.Double.Parse(String s, IFormatProvider provider)
       at HelixToolkit.Wpf.VrmlReader.GetValues(Double[]& result)
       at HelixToolkit.Wpf.VrmlReader.ReadGeometry(Model3DGroup model3DGroup)
       at HelixToolkit.Wpf.VrmlReader.DoShapeNode(Int32 level, Model3DGroup model3DGroup)
       at HelixToolkit.Wpf.VrmlReader.ReadTransform(Model3DGroup model3DGroup, Int32 level)
       at HelixToolkit.Wpf.VrmlReader.DoGroupNode(Int32 level, Model3DGroup model3DGroup)
       at HelixToolkit.Wpf.VrmlReader.ReadTransform(Model3DGroup model3DGroup, Int32 level)
       at HelixToolkit.Wpf.VrmlReader.Read(Stream s)
       at HelixToolkit.Wpf.VrmlReader.Read(String path)
       at VRMLImportTest.MainViewModel.LoadModel() in c:\CPG Dev Projects\VRMLImportTest\VRMLImportTest\MainViewModel.cs:line 26
       at VRMLImportTest.MainWindow.btnRun_Click_1(Object sender, RoutedEventArgs e) in c:\CPG Dev Projects\VRMLImportTest\VRMLImportTest\MainWindow.xaml.cs:line 42
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
       at System.Windows.Controls.Primitives.ButtonBase.OnClick()
       at System.Windows.Controls.Button.OnClick()
       at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
       at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
       at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
       at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
       at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
       at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
       at System.Windows.Input.InputManager.ProcessStagingArea()
       at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
       at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
       at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
       at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.Run()
       at System.Windows.Application.RunDispatcher(Object ignore)
       at System.Windows.Application.RunInternal(Window window)
       at System.Windows.Application.Run(Window window)
       at System.Windows.Application.Run()
       at VRMLImportTest.App.Main() in c:\CPG Dev Projects\VRMLImportTest\VRMLImportTest\obj\Debug\App.g.cs:line 0
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:


glgweeke wrote at 2012-11-20 08:16:

Hi,

can you add your .wrl file?

Thanks!


michaeldjackson wrote at 2012-11-20 12:58:

Not sure how to attach file to reply.


glgweeke wrote at 2012-11-21 11:34:

Hi,

you can create a new issue and attach a file.

Max. 4MB. (use Zip)


objo wrote at 2012-11-21 11:55:

I would suggest sharing by a service like
http://www.filedropper.com
http://www.filefactory.com
http://fileden.com/ 

or for source files
http://pastebin.com
etc. 


michaeldjackson wrote at 2012-11-21 13:37:

Link to my troublesome .wrl file.

http://www.filefactory.com/file/6lpoznkjny8d/n/AF1_wrl

The AF1.wrl file is an export from Flac3D 5.0 from Itasca, and represents a rectilinear grid.

I used MeshLab (free, opensource) to view the file to ensure it is not corrupted.


glgweeke wrote at 2012-11-21 22:04:

In the vrml import fork i make some bugfixes. Now you can import the file.

Currently i do not support texture mapping.

But it will be possible to add this feature in near future.


michaeldjackson wrote at 2012-11-29 19:50:

I have uploaded a .png to http://www.filefactory.com/file/5dmq1jc0ulgv/n/VRMLInMeshLab_PNG which represents the AF1.wrl file that I sent you previously for your testing purposes being viewed in MeshLab. Is is possible to get this type of view from your VRML importer? In MeshLab, this view is obtained by clicking the "WireFrame" button.


glgweeke wrote at 2012-12-04 18:39:

Hi,

in WPF it is not possible to draw a real line in 3D.

Your .WRL-File is using IndexedLineSet which need this feature.

This Helix-Toolkit creates a line with 2 Triangles which what a real size. Not only one pixel on every viewpoint.

To do what you like, 

pease patch the following to lines in the VRMLReader.cs file.

1.) Line 734: 

            if (FindNode("IndexedFaceSet"))

replace 

if (false)

 

2.) Line 949:

                    mesh.Positions = lg.CreatePositions(linePoints, 0.001);

replace

                    mesh.Positions = lg.CreatePositions(linePoints, 0.1);

 

This importer is not stable not finished and not perfect.

0

PointsVisual3D different Point Colors

Anonymous 10 years ago 0
This discussion was imported from CodePlex

Dave_evaD wrote at 2012-10-01 18:20:

Hi,

i have a PointsVisual3D object and I would like to use different colors for the points. As objo mentioned in this post, creating different materials (by creating different PointsVisual3D subobjects) for each point is too slow in rendering. But I don't understand what objo means by "This only supports a single color, but can be extended to support a material containing a 'palette' of colors (then you can set different colors for each point by texture coordinates)." Could you explain it to me or give me an example?

Kind regards, Dave_evaD


govert wrote at 2012-10-01 21:36:

I have some pieces that might get you started:

You can create a small bitmap with one row of colors, maybe like this:

 

		// Creates a bitmap that has a single row containing single pixels with the given colors.
		// At most 256 colors.
		public static BitmapSource GetColorsBitmap(IList<Color> colors)
		{
			if (colors == null) throw new ArgumentNullException("colors");
			if (colors.Count > 256) throw new ArgumentOutOfRangeException("More than 256 colors");

			int size = colors.Count;
			for (int j = colors.Count; j < 256; j++)
			{
				colors.Add(Colors.White);
			}

			var palette = new BitmapPalette(colors);
			byte[] pixels = new byte[size];
			for (int i = 0; i < size; i++)
			{
				pixels[i] = (byte)i;
			}

			var bm = BitmapSource.Create(size, 1, 96, 96, PixelFormats.Indexed8, palette, pixels, 1 * size);
			bm.Freeze();
			return bm;
		}

 

Then your model might use this Bitmap as its Brush (only two colors used here):

 

	BitmapSource bm = Mesh3DUtil.GetColorsBitmap(new List<Color> { BaseColor, SelectedColor });
	ImageBrush ib = new ImageBrush(bm) { ViewportUnits = BrushMappingMode.Absolute, Viewport = new Rect(0, 0, 1, 1) };  // Matches the pixels in the bitmap.
        GeometryModel3D model = new GeometryModel3D() { Geometry = mesh, Material = new DiffuseMaterial(ib) };

And then for the TextureCoordinates you pick points halfway along the Bitmap:

 

    mesh.TextureCoordinates.Add(new Point(0.5, 0.5));

 

This is for each little mesh of triangles that forms the little sphere for a point.


Dave_evaD wrote at 2012-10-01 22:00:

Hi govert,

thank you for your reply. I think I've finally understood what the ImageBrush idea is about. But there remains a problem:

As far as I see, I can't set the material/brush for the PointsVisual3D object since it is set in a private method in ScreenSpaceVisual3D. Furthermore I can't access the TextureCoordinates.

Looks like I have to modify the code a bit. I hope the license allows that ;)

 


Dave_evaD wrote at 2012-10-02 23:21:

Hi govert,

is there a way to use more than 256 colors? I've found nothing for an ImageBrush, what about a BitmapCacheBrush?


govert wrote at 2012-10-02 23:37:

The 256 color limitation might just be a result of the PixelFormat I chose in the BitmapSource.Create call. So if you pick another PixelFormat it might work with more colors. I don't think it has anything to do with the ImageBrush itself. I don't know anything about BitmapCacheBrush, but that seems like a performance optimisation.

This was done a few years ago, though, and I remember that getting the Bitmap and the colors to work right was rather fiddly. You have to get into this stuff a bit: http://msdn.microsoft.com/en-us/magazine/cc534995.aspx.


Dave_evaD wrote at 2012-10-02 23:53:

I tried changing the PixelFormat but the restriction comes from the BitmapPalette. Here's what I found out up to now:

You could use a Brush that draws an ImageSource or a Visual.

If you want to use the ImageSource, you have certain possibilities:

-You could draw a Drawing which offers the possibility to draw an ImageSource (among others which I don't think about that they will be useful)

-You could draw a Direct3D image which does not seem to be what I want

-You could draw a BitmapSource (which has certain subtypes as shown in your link). But each of them has a BitmapPalette which is restricted to 256 colors

If you want to use a Visual, you also have different options:

-A Viewport3DVisual does not seem to be the right thing

-You can draw a Drawing which results in drawing an ImageSource

-You can draw a UIElement. Maybe I could use a Canvas on which I have drawn an Image before, but I wonder whether there is no way to use an Image or Bitmap (not BitmapSource) directly?


govert wrote at 2012-10-03 00:12:

I don't think you have to use an indexed Bitmap format with a fixed palette. You should be able to use one of the other Bitmap formats which give the color of each pixel ? I'd expect WPF to handle most of these formats fine when used with an ImageBrush. You just have to figure out how to encode the actual Bitmap data - maybe first make some bitmaps in Paint or something, and see if you can map those colors into TextureCoordinates.


Dave_evaD wrote at 2012-10-03 00:50:

Hi,

you were right, I realized that I didn't have to use the palette. I use the Bgra32-Format now.

Thanks for your tips.

0

Wanting to importing VRML

Anonymous 10 years ago 0
This discussion was imported from CodePlex

BradSoft wrote at 2012-04-20 15:33:

Hi, I want to import a wrl (vrml) file. Has any one have some experience with the import of this format?
And may be give me some tips and tricks where to start?


objo wrote at 2012-04-20 21:24:

glgweeke has started a vrml97 fork of this library! 

VRML97

BradSoft wrote at 2012-04-20 22:20:

Thanks that is what I was looking for.


glgweeke wrote at 2012-06-20 18:53:

Hi,

i make some improvements to the importer and commit it into the trunk.

You can import now complex wrl Files with DEF- and USE-cases.

The speed is better too.

I will be glad to get some feedback.


objo wrote at 2012-06-21 09:09:

great, I will look at it when you have committed the new source to the fork!


BradSoft wrote at 2012-06-21 09:45:

Hi,

Nice I had to use DEF and USE cases and implemented my own implementation for that to get my files work.

I also ran into the problem that the translations of nested levels didn't work right.
I implemented a fix for this to use matrix calculations for the translations and rotations.

And i run into the problem with nested levels. The method you use now is sometimes skipping information that it should use.

The last thing I changed was the material color, but this is also related with the problem above that the nested information is not read right.

How can I send you my files so you can have a look at what I fixed and how you can use it for your code?
I tested it with a lot of files also from the web that I found and most I can read good now.
Try this to import this is a small part of a file i had to import

#VRML V2.0 utf8

# Produced by 3D Studio MAX VRML97 exporter, Version 14, Revision 1,21
# Date: Tue Apr 10 20:44:16 2012

DEF Block:bci_licht2007 Transform {
  translation 9.708e+004 3400 -1.562e+005
  rotation 0 -1 0 -3.142
  children [
    DEF Layer:CSi_palletiser Transform {
      translation -382.5 52.54 65
      children [
        Shape {
          appearance Appearance {
            material Material {
              diffuseColor 1 0.498 0
            }
          }
          geometry DEF Layer:CSi_palletiser-FACES IndexedFaceSet {
            ccw TRUE
            solid TRUE
            coord DEF Layer:CSi_palletiser-COORD Coordinate { point [
              -347.5 -87.54 253.3, -332.5 -87.54 253.3, -332.5 -87.54 245.5,
              -317.9 -87.54 245.5, -317.9 -87.54 -375.5, -332.5 -87.54 -375.5,
              -332.5 -87.54 -383.3, -347.5 -87.54 -383.3, -334.5 -95.04 253.3,
              -334.5 -95.04 245.5, -321.9 -102.3 245.5, -321.9 -102.3 -375.5,
              -334.5 -95.04 -375.5, -334.5 -95.04 -383.3, -340 -100.5 253.3,
              -340 -100.5 245.5, -332.7 -113.2 245.5, -332.7 -113.2 -375.5,
              -340 -100.5 -375.5, -340 -100.5 -383.3, -347.5 -102.5 253.3,
              -347.5 -102.5 245.5, -347.5 -117.1 245.5, -347.5 -117.1 -375.5,
              -347.5 -102.5 -375.5, -347.5 -102.5 -383.3, -355 -100.5 253.3,
              -355 -100.5 245.5, -362.3 -113.2 245.5, -362.3 -113.2 -375.5,
              -355 -100.5 -375.5, -355 -100.5 -383.3, -360.5 -95.04 253.3,
              -360.5 -95.04 245.5, -373.1 -102.3 245.5, -373.1 -102.3 -375.5,
              -360.5 -95.04 -375.5, -360.5 -95.04 -383.3, -362.5 -87.54 253.3,
              -362.5 -87.54 245.5, -377.1 -87.54 245.5, -377.1 -87.54 -375.5,
              -362.5 -87.54 -375.5, -362.5 -87.54 -383.3, -360.5 -80.04 253.3,
              -360.5 -80.04 245.5, -373.1 -72.75 245.5, -373.1 -72.75 -375.5,
              -360.5 -80.04 -375.5, -360.5 -80.04 -383.3, -355 -74.55 253.3,
              -355 -74.55 245.5, -362.3 -61.92 245.5, -362.3 -61.92 -375.5,
              -355 -74.55 -375.5, -355 -74.55 -383.3, -347.5 -72.54 253.3,
              -347.5 -72.54 245.5, -347.5 -57.96 245.5, -347.5 -57.96 -375.5,
              -347.5 -72.54 -375.5, -347.5 -72.54 -383.3, -340 -74.55 253.3,
              -340 -74.55 245.5, -332.7 -61.92 245.5, -332.7 -61.92 -375.5,
              -340 -74.55 -375.5, -340 -74.55 -383.3, -334.5 -80.04 253.3,
              -334.5 -80.04 245.5, -321.9 -72.75 245.5, -321.9 -72.75 -375.5,
              -334.5 -80.04 -375.5, -334.5 -80.04 -383.3, -373.1 -102.3 220,
              -362.3 -113.2 220, -373.1 -102.3 217, -362.3 -113.2 217,
              -347.5 -117.1 220, -347.5 -117.1 217, -332.7 -113.2 220,
              -332.7 -113.2 217, -321.9 -102.3 220, -321.9 -102.3 217,
              -317.9 -87.54 220, -317.9 -87.54 217, -321.9 -72.75 220,
              -321.9 -72.75 217, -332.7 -61.92 220, -332.7 -61.92 217,
              -347.5 -57.96 220, -347.5 -57.96 217, -308.5 -57.96 220,
              -308.5 -57.96 217, -308.5 -221 220, -308.5 -221 217,
              -343.2 -221 220, -343.2 -221 217, -382.5 -107 220,
              -382.5 -107 217, -382.5 -104 220, -382.5 -104 217,
              -380.5 -102 220, -380.5 -102 217, -327.2 -113.5 245,
              -332.7 -113.2 245, -327.2 -113.5 220, -332.7 -113.2 220,
              -321.9 -102.3 245, -321.9 -102.3 220, -317.9 -87.54 245,
              -317.9 -87.54 220, -321.9 -72.75 245, -321.9 -72.75 220,
              -332.7 -61.92 245, -332.7 -61.92 220, -327.2 -61.54 245,
              -327.2 -61.54 220, -295.5 -61.54 245, -295.5 -61.54 220,
              -274.9 -77.69 245, -274.9 -77.69 220, -274.9 -97.39 245,
              -274.9 -97.39 220, -295.5 -113.5 245, -295.5 -113.5 220,
              -362.3 -113.2 -350, -373.1 -102.3 -350, -362.3 -113.2 -347,
              -373.1 -102.3 -347, -347.5 -117.1 -350, -347.5 -117.1 -347,
              -332.7 -113.2 -350, -332.7 -113.2 -347, -321.9 -102.3 -350,
              -321.9 -102.3 -347, -317.9 -87.54 -350, -317.9 -87.54 -347,
              -321.9 -72.75 -350, -321.9 -72.75 -347, -332.7 -61.92 -350,
              -332.7 -61.92 -347, -347.5 -57.96 -350, -347.5 -57.96 -347,
              -308.5 -57.96 -350, -308.5 -57.96 -347, -308.5 -221 -350,
              -308.5 -221 -347, -343.2 -221 -350, -343.2 -221 -347,
              -382.5 -107 -350, -382.5 -107 -347, -382.5 -104 -350,
              -382.5 -104 -347, -380.5 -102 -350, -380.5 -102 -347,
              -332.7 -113.2 -375, -327.2 -113.5 -375, -332.7 -113.2 -350,
              -327.2 -113.5 -350, -321.9 -102.3 -375, -321.9 -102.3 -350,
              -317.9 -87.54 -375, -317.9 -87.54 -350, -321.9 -72.75 -375,
              -321.9 -72.75 -350, -332.7 -61.92 -375, -332.7 -61.92 -350,
              -327.2 -61.54 -375, -327.2 -61.54 -350, -295.5 -61.54 -375,
              -295.5 -61.54 -350, -274.9 -77.69 -375, -274.9 -77.69 -350,
              -274.9 -97.39 -375, -274.9 -97.39 -350, -295.5 -113.5 -375,
              -295.5 -113.5 -350, 347.5 -87.54 253.3, 332.5 -87.54 253.3,
              332.5 -87.54 245.5, 317.9 -87.54 245.5, 317.9 -87.54 -375.5,
              332.5 -87.54 -375.5, 332.5 -87.54 -383.3, 347.5 -87.54 -383.3,
              334.5 -95.04 253.3, 334.5 -95.04 245.5, 321.9 -102.3 245.5,
              321.9 -102.3 -375.5, 334.5 -95.04 -375.5, 334.5 -95.04 -383.3,
              340 -100.5 253.3, 340 -100.5 245.5, 332.7 -113.2 245.5,
              332.7 -113.2 -375.5, 340 -100.5 -375.5, 340 -100.5 -383.3,
              347.5 -102.5 253.3, 347.5 -102.5 245.5, 347.5 -117.1 245.5,
              347.5 -117.1 -375.5, 347.5 -102.5 -375.5, 347.5 -102.5 -383.3,
              355 -100.5 253.3, 355 -100.5 245.5, 362.3 -113.2 245.5,
              362.3 -113.2 -375.5, 355 -100.5 -375.5, 355 -100.5 -383.3,
              360.5 -95.04 253.3, 360.5 -95.04 245.5, 373.1 -102.3 245.5,
              373.1 -102.3 -375.5, 360.5 -95.04 -375.5, 360.5 -95.04 -383.3,
              362.5 -87.54 253.3, 362.5 -87.54 245.5, 377.1 -87.54 245.5,
              377.1 -87.54 -375.5, 362.5 -87.54 -375.5, 362.5 -87.54 -383.3,
              360.5 -80.04 253.3, 360.5 -80.04 245.5, 373.1 -72.75 245.5,
              373.1 -72.75 -375.5, 360.5 -80.04 -375.5, 360.5 -80.04 -383.3,
              355 -74.55 253.3, 355 -74.55 245.5, 362.3 -61.92 245.5,
              362.3 -61.92 -375.5, 355 -74.55 -375.5, 355 -74.55 -383.3,
              347.5 -72.54 253.3, 347.5 -72.54 245.5, 347.5 -57.96 245.5,
              347.5 -57.96 -375.5, 347.5 -72.54 -375.5, 347.5 -72.54 -383.3,
              340 -74.55 253.3, 340 -74.55 245.5, 332.7 -61.92 245.5,
              332.7 -61.92 -375.5, 340 -74.55 -375.5, 340 -74.55 -383.3,
              334.5 -80.04 253.3, 334.5 -80.04 245.5, 321.9 -72.75 245.5,
              321.9 -72.75 -375.5, 334.5 -80.04 -375.5, 334.5 -80.04 -383.3,
              362.3 -113.2 220, 373.1 -102.3 220, 362.3 -113.2 217,
              373.1 -102.3 217, 347.5 -117.1 220, 347.5 -117.1 217,
              332.7 -113.2 220, 332.7 -113.2 217, 321.9 -102.3 220,
              321.9 -102.3 217, 317.9 -87.54 220, 317.9 -87.54 217,
              321.9 -72.75 220, 321.9 -72.75 217, 332.7 -61.92 220,
              332.7 -61.92 217, 347.5 -57.96 220, 347.5 -57.96 217,
              308.5 -57.96 220, 308.5 -57.96 217, 308.5 -221 220,
              308.5 -221 217, 343.2 -221 220, 343.2 -221 217,
              382.5 -107 220, 382.5 -107 217, 382.5 -104 220,
              382.5 -104 217, 380.5 -102 220, 380.5 -102 217,
              332.7 -113.2 245, 327.2 -113.5 245, 332.7 -113.2 220,
              327.2 -113.5 220, 321.9 -102.3 245, 321.9 -102.3 220,
              317.9 -87.54 245, 317.9 -87.54 220, 321.9 -72.75 245,
              321.9 -72.75 220, 332.7 -61.92 245, 332.7 -61.92 220,
              327.2 -61.54 245, 327.2 -61.54 220, 295.5 -61.54 245,
              295.5 -61.54 220, 274.9 -77.69 245, 274.9 -77.69 220,
              274.9 -97.39 245, 274.9 -97.39 220, 295.5 -113.5 245,
              295.5 -113.5 220, 373.1 -102.3 -350, 362.3 -113.2 -350,
              373.1 -102.3 -347, 362.3 -113.2 -347, 347.5 -117.1 -350,
              347.5 -117.1 -347, 332.7 -113.2 -350, 332.7 -113.2 -347,
              321.9 -102.3 -350, 321.9 -102.3 -347, 317.9 -87.54 -350,
              317.9 -87.54 -347, 321.9 -72.75 -350, 321.9 -72.75 -347,
              332.7 -61.92 -350, 332.7 -61.92 -347, 347.5 -57.96 -350,
              347.5 -57.96 -347, 308.5 -57.96 -350, 308.5 -57.96 -347,
              308.5 -221 -350, 308.5 -221 -347, 343.2 -221 -350,
              343.2 -221 -347, 382.5 -107 -350, 382.5 -107 -347,
              382.5 -104 -350, 382.5 -104 -347, 380.5 -102 -350,
              380.5 -102 -347, 327.2 -113.5 -375, 332.7 -113.2 -375,
              327.2 -113.5 -350, 332.7 -113.2 -350, 321.9 -102.3 -375,
              321.9 -102.3 -350, 317.9 -87.54 -375, 317.9 -87.54 -350,
              321.9 -72.75 -375, 321.9 -72.75 -350, 332.7 -61.92 -375,
              332.7 -61.92 -350, 327.2 -61.54 -375, 327.2 -61.54 -350,
              295.5 -61.54 -375, 295.5 -61.54 -350, 274.9 -77.69 -375,
              274.9 -77.69 -350, 274.9 -97.39 -375, 274.9 -97.39 -350,
              295.5 -113.5 -375, 295.5 -113.5 -350, 90.5 -156.5 350.8,
              -25 -156.5 350.8, -25 -156.5 220, 90.5 -156.5 220,
              90.5 -51.34 350.8, -25 -51.34 350.8, -25 -51.34 220,
              90.5 -51.34 220, 17.5 -51.34 303.3, -17.5 -51.34 303.3,
              -41 -45.04 303.3, -41 -6.043 303.3, -54.83 -6.043 303.3,
              -55 200 303.3, -34 221 303.3, 17.5 221 303.3, -12.82 -51.34 285.8,
              -33.16 -45.04 274, -33.16 -6.043 274, -45.14 -6.043 267.1,
              -45.29 200 267, -27.1 221 277.5, -0.002472 -51.34 273,
              -11.75 -45.04 252.6, -11.75 -6.043 252.6, -18.66 -6.043 240.7,
              -18.75 200 240.5, -8.25 221 258.7, 17.5 -51.34 268.3,
              17.5 -45.04 244.8, 17.5 -6.043 244.8, 17.5 -6.043 231,
              17.5 200 230.8, 17.5 221 251.8, 35 -51.34 273,
              46.75 -45.04 252.6, 46.75 -6.043 252.6, 53.66 -6.043 240.7,
              53.75 200 240.5, 43.25 221 258.7, 47.82 -51.34 285.8,
              68.16 -45.04 274, 68.16 -6.043 274, 80.14 -6.043 267.1,
              80.29 200 267, 62.1 221 277.5, 52.5 -51.34 303.3,
              76 -45.04 303.3, 76 -6.043 303.3, 89.83 -6.043 303.3,
              90 200 303.3, 69 221 303.3, 47.82 -51.34 320.8,
              68.16 -45.04 332.5, 68.16 -6.043 332.5, 80.14 -6.043 339.5,
              80.29 200 339.5, 62.1 221 329, 35 -51.34 333.6,
              46.75 -45.04 354, 46.75 -6.043 354, 53.66 -6.043 365.9,
              53.75 200 366.1, 43.25 221 347.9, 17.5 -51.34 338.3,
              17.5 -45.04 361.8, 17.5 -6.043 361.8, 17.5 -6.043 375.6,
              17.5 200 375.8, 17.5 221 354.8, -0.002472 -51.34 333.6,
              -11.75 -45.04 354, -11.75 -6.043 354, -18.66 -6.043 365.9,
              -18.75 200 366.1, -8.25 221 347.9, -12.82 -51.34 320.8,
              -33.16 -45.04 332.5, -33.16 -6.043 332.5, -45.14 -6.043 339.5,
              -45.29 200 339.5, -27.1 221 329, -56.5 1.957 243.3,
              -146.5 1.957 243.3, -146.5 1.957 383.3, -56.5 1.957 383.3,
              -56.5 184 243.3, -146.5 184 243.3, -146.5 184 383.3,
              -56.5 184 383.3, -308.5 -221 220, 308.5 -221 220,
              308.5 -221 -350, -308.5 -221 -350, -308.5 -57.96 220,
              308.5 -57.96 220, 308.5 -57.96 -350, -308.5 -57.96 -350]
            }
            coordIndex [
              0, 1, 0, -1, 0, 1, 8, -1, 1, 2, 8, -1, 8, 2, 9, -1,
              2, 3, 9, -1, 9, 3, 10, -1, 3, 4, 10, -1, 10, 4, 11, -1,
              4, 5, 11, -1, 11, 5, 12, -1, 5, 6, 12, -1, 12, 6, 13, -1,
              6, 7, 13, -1, 0, 8, 14, -1, 8, 9, 14, -1, 14, 9, 15, -1,
              9, 10, 15, -1, 15, 10, 16, -1, 10, 11, 16, -1,
              16, 11, 17, -1, 11, 12, 17, -1, 17, 12, 18, -1,
              12, 13, 18, -1, 18, 13, 19, -1, 13, 7, 19, -1,
              0, 14, 20, -1, 14, 15, 20, -1, 20, 15, 21, -1,
              15, 16, 21, -1, 21, 16, 22, -1, 16, 17, 22, -1,
              22, 17, 23, -1, 17, 18, 23, -1, 23, 18, 24, -1,
              18, 19, 24, -1, 24, 19, 25, -1, 19, 7, 25, -1,
              0, 20, 26, -1, 20, 21, 26, -1, 26, 21, 27, -1,
              21, 22, 27, -1, 27, 22, 28, -1, 22, 23, 28, -1,
              28, 23, 29, -1, 23, 24, 29, -1, 29, 24, 30, -1,
              24, 25, 30, -1, 30, 25, 31, -1, 25, 7, 31, -1,
              0, 26, 32, -1, 26, 27, 32, -1, 32, 27, 33, -1,
              27, 28, 33, -1, 33, 28, 34, -1, 28, 29, 34, -1,
              34, 29, 35, -1, 29, 30, 35, -1, 35, 30, 36, -1,
              30, 31, 36, -1, 36, 31, 37, -1, 31, 7, 37, -1,
              0, 32, 38, -1, 32, 33, 38, -1, 38, 33, 39, -1,
              33, 34, 39, -1, 39, 34, 40, -1, 34, 35, 40, -1,
              40, 35, 41, -1, 35, 36, 41, -1, 41, 36, 42, -1,
              36, 37, 42, -1, 42, 37, 43, -1, 37, 7, 43, -1,
              0, 38, 44, -1, 38, 39, 44, -1, 44, 39, 45, -1,
              39, 40, 45, -1, 45, 40, 46, -1, 40, 41, 46, -1,
              46, 41, 47, -1, 41, 42, 47, -1, 47, 42, 48, -1,
              42, 43, 48, -1, 48, 43, 49, -1, 43, 7, 49, -1,
              0, 44, 50, -1, 44, 45, 50, -1, 50, 45, 51, -1,
              45, 46, 51, -1, 51, 46, 52, -1, 46, 47, 52, -1,
              52, 47, 53, -1, 47, 48, 53, -1, 53, 48, 54, -1,
              48, 49, 54, -1, 54, 49, 55, -1, 49, 7, 55, -1,
              0, 50, 56, -1, 50, 51, 56, -1, 56, 51, 57, -1,
              51, 52, 57, -1, 57, 52, 58, -1, 52, 53, 58, -1,
              58, 53, 59, -1, 53, 54, 59, -1, 59, 54, 60, -1,
              54, 55, 60, -1, 60, 55, 61, -1, 55, 7, 61, -1,
              0, 56, 62, -1, 56, 57, 62, -1, 62, 57, 63, -1,
              57, 58, 63, -1, 63, 58, 64, -1, 58, 59, 64, -1,
              64, 59, 65, -1, 59, 60, 65, -1, 65, 60, 66, -1,
              60, 61, 66, -1, 66, 61, 67, -1, 61, 7, 67, -1,
              0, 62, 68, -1, 62, 63, 68, -1, 68, 63, 69, -1,
              63, 64, 69, -1, 69, 64, 70, -1, 64, 65, 70, -1,
              70, 65, 71, -1, 65, 66, 71, -1, 71, 66, 72, -1,
              66, 67, 72, -1, 72, 67, 73, -1, 67, 7, 73, -1,
              0, 68, 1, -1, 68, 69, 1, -1, 1, 69, 2, -1, 69, 70, 2, -1,
              2, 70, 3, -1, 70, 71, 3, -1, 3, 71, 4, -1, 71, 72, 4, -1,
              4, 72, 5, -1, 72, 73, 5, -1, 5, 73, 6, -1, 73, 7, 6, -1,
              74, 75, 76, -1, 75, 77, 76, -1, 75, 78, 77, -1,
              78, 79, 77, -1, 78, 80, 79, -1, 80, 81, 79, -1,
              80, 82, 81, -1, 82, 83, 81, -1, 82, 84, 83, -1,
              84, 85, 83, -1, 84, 86, 85, -1, 86, 87, 85, -1,
              86, 88, 87, -1, 88, 89, 87, -1, 88, 90, 89, -1,
              90, 91, 89, -1, 90, 92, 91, -1, 92, 93, 91, -1,
              92, 94, 93, -1, 94, 95, 93, -1, 94, 96, 95, -1,
              96, 97, 95, -1, 96, 98, 97, -1, 98, 99, 97, -1,
              98, 100, 99, -1, 100, 101, 99, -1, 100, 102, 101, -1,
              102, 103, 101, -1, 102, 74, 103, -1, 74, 76, 103, -1,
              74, 98, 75, -1, 74, 102, 98, -1, 102, 100, 98, -1,
              98, 96, 75, -1, 94, 80, 96, -1, 92, 84, 94, -1,
              90, 88, 92, -1, 88, 86, 92, -1, 86, 84, 92, -1,
              84, 82, 94, -1, 82, 80, 94, -1, 80, 78, 96, -1,
              78, 75, 96, -1, 101, 103, 99, -1, 103, 76, 99, -1,
              79, 97, 77, -1, 79, 81, 97, -1, 97, 81, 95, -1,
              81, 83, 95, -1, 87, 93, 85, -1, 87, 89, 93, -1,
              89, 91, 93, -1, 93, 95, 85, -1, 97, 99, 77, -1,
              99, 76, 77, -1, 95, 83, 85, -1, 104, 105, 106, -1,
              105, 107, 106, -1, 105, 108, 107, -1, 108, 109, 107, -1,
              108, 110, 109, -1, 110, 111, 109, -1, 110, 112, 111, -1,
              112, 113, 111, -1, 112, 114, 113, -1, 114, 115, 113, -1,
              114, 116, 115, -1, 116, 117, 115, -1, 116, 118, 117, -1,
              118, 119, 117, -1, 118, 120, 119, -1, 120, 121, 119, -1,
              120, 122, 121, -1, 122, 123, 121, -1, 122, 124, 123, -1,
              124, 125, 123, -1, 124, 104, 125, -1, 104, 106, 125, -1,
              105, 104, 108, -1, 104, 124, 108, -1, 108, 124, 110, -1,
              124, 122, 110, -1, 122, 120, 110, -1, 116, 112, 118, -1,
              116, 114, 112, -1, 112, 110, 118, -1, 118, 110, 120, -1,
              106, 109, 125, -1, 106, 107, 109, -1, 109, 111, 125, -1,
              113, 119, 111, -1, 115, 117, 113, -1, 117, 119, 113, -1,
              119, 121, 111, -1, 121, 123, 111, -1, 123, 125, 111, -1,
              126, 127, 128, -1, 127, 129, 128, -1, 130, 126, 131, -1,
              126, 128, 131, -1, 132, 130, 133, -1, 130, 131, 133, -1,
              134, 132, 135, -1, 132, 133, 135, -1, 136, 134, 137, -1,
              134, 135, 137, -1, 138, 136, 139, -1, 136, 137, 139, -1,
              140, 138, 141, -1, 138, 139, 141, -1, 142, 140, 143, -1,
              140, 141, 143, -1, 144, 142, 145, -1, 142, 143, 145, -1,
              146, 144, 147, -1, 144, 145, 147, -1, 148, 146, 149, -1,
              146, 147, 149, -1, 150, 148, 151, -1, 148, 149, 151, -1,
              152, 150, 153, -1, 150, 151, 153, -1, 154, 152, 155, -1,
              152, 153, 155, -1, 127, 154, 129, -1, 154, 155, 129, -1,
              154, 127, 150, -1, 154, 150, 152, -1, 130, 148, 126, -1,
              130, 132, 148, -1, 148, 132, 146, -1, 132, 134, 146, -1,
              138, 144, 136, -1, 138, 140, 144, -1, 140, 142, 144, -1,
              144, 146, 136, -1, 148, 150, 126, -1, 150, 127, 126, -1,
              146, 134, 136, -1, 128, 129, 151, -1, 128, 151, 149, -1,
              128, 149, 131, -1, 153, 151, 155, -1, 131, 149, 133, -1,
              145, 137, 147, -1, 143, 141, 145, -1, 141, 139, 145, -1,
              139, 137, 145, -1, 137, 135, 147, -1, 135, 133, 147, -1,
              147, 133, 149, -1, 155, 151, 129, -1, 156, 157, 158, -1,
              157, 159, 158, -1, 160, 156, 161, -1, 156, 158, 161, -1,
              162, 160, 163, -1, 160, 161, 163, -1, 164, 162, 165, -1,
              162, 163, 165, -1, 166, 164, 167, -1, 164, 165, 167, -1,
              168, 166, 169, -1, 166, 167, 169, -1, 170, 168, 171, -1,
              168, 169, 171, -1, 172, 170, 173, -1, 170, 171, 173, -1,
              174, 172, 175, -1, 172, 173, 175, -1, 176, 174, 177, -1,
              174, 175, 177, -1, 157, 176, 159, -1, 176, 177, 159, -1,
              156, 160, 157, -1, 157, 160, 176, -1, 164, 170, 162, -1,
              166, 168, 164, -1, 168, 170, 164, -1, 170, 172, 162, -1,
              172, 174, 162, -1, 174, 176, 162, -1, 162, 176, 160, -1,
              158, 159, 161, -1, 175, 163, 177, -1, 175, 173, 163, -1,
              173, 171, 163, -1, 163, 171, 165, -1, 167, 165, 169, -1,
              169, 165, 171, -1, 163, 161, 177, -1, 161, 159, 177, -1,
              178, 179, 178, -1, 178, 179, 186, -1, 179, 180, 186, -1,
              186, 180, 187, -1, 180, 181, 187, -1, 187, 181, 188, -1,
              181, 182, 188, -1, 188, 182, 189, -1, 182, 183, 189, -1,
              189, 183, 190, -1, 183, 184, 190, -1, 190, 184, 191, -1,
              184, 185, 191, -1, 178, 186, 192, -1, 186, 187, 192, -1,
              192, 187, 193, -1, 187, 188, 193, -1, 193, 188, 194, -1,
              188, 189, 194, -1, 194, 189, 195, -1, 189, 190, 195, -1,
              195, 190, 196, -1, 190, 191, 196, -1, 196, 191, 197, -1,
              191, 185, 197, -1, 178, 192, 198, -1, 192, 193, 198, -1,
              198, 193, 199, -1, 193, 194, 199, -1, 199, 194, 200, -1,
              194, 195, 200, -1, 200, 195, 201, -1, 195, 196, 201, -1,
              201, 196, 202, -1, 196, 197, 202, -1, 202, 197, 203, -1,
              197, 185, 203, -1, 178, 198, 204, -1, 198, 199, 204, -1,
              204, 199, 205, -1, 199, 200, 205, -1, 205, 200, 206, -1,
              200, 201, 206, -1, 206, 201, 207, -1, 201, 202, 207, -1,
              207, 202, 208, -1, 202, 203, 208, -1, 208, 203, 209, -1,
              203, 185, 209, -1, 178, 204, 210, -1, 204, 205, 210, -1,
              210, 205, 211, -1, 205, 206, 211, -1, 211, 206, 212, -1,
              206, 207, 212, -1, 212, 207, 213, -1, 207, 208, 213, -1,
              213, 208, 214, -1, 208, 209, 214, -1, 214, 209, 215, -1,
              209, 185, 215, -1, 178, 210, 216, -1, 210, 211, 216, -1,
              216, 211, 217, -1, 211, 212, 217, -1, 217, 212, 218, -1,
              212, 213, 218, -1, 218, 213, 219, -1, 213, 214, 219, -1,
              219, 214, 220, -1, 214, 215, 220, -1, 220, 215, 221, -1,
              215, 185, 221, -1, 178, 216, 222, -1, 216, 217, 222, -1,
              222, 217, 223, -1, 217, 218, 223, -1, 223, 218, 224, -1,
              218, 219, 224, -1, 224, 219, 225, -1, 219, 220, 225, -1,
              225, 220, 226, -1, 220, 221, 226, -1, 226, 221, 227, -1,
              221, 185, 227, -1, 178, 222, 228, -1, 222, 223, 228, -1,
              228, 223, 229, -1, 223, 224, 229, -1, 229, 224, 230, -1,
              224, 225, 230, -1, 230, 225, 231, -1, 225, 226, 231, -1,
              231, 226, 232, -1, 226, 227, 232, -1, 232, 227, 233, -1,
              227, 185, 233, -1, 178, 228, 234, -1, 228, 229, 234, -1,
              234, 229, 235, -1, 229, 230, 235, -1, 235, 230, 236, -1,
              230, 231, 236, -1, 236, 231, 237, -1, 231, 232, 237, -1,
              237, 232, 238, -1, 232, 233, 238, -1, 238, 233, 239, -1,
              233, 185, 239, -1, 178, 234, 240, -1, 234, 235, 240, -1,
              240, 235, 241, -1, 235, 236, 241, -1, 241, 236, 242, -1,
              236, 237, 242, -1, 242, 237, 243, -1, 237, 238, 243, -1,
              243, 238, 244, -1, 238, 239, 244, -1, 244, 239, 245, -1,
              239, 185, 245, -1, 178, 240, 246, -1, 240, 241, 246, -1,
              246, 241, 247, -1, 241, 242, 247, -1, 247, 242, 248, -1,
              242, 243, 248, -1, 248, 243, 249, -1, 243, 244, 249, -1,
              249, 244, 250, -1, 244, 245, 250, -1, 250, 245, 251, -1,
              245, 185, 251, -1, 178, 246, 179, -1, 246, 247, 179, -1,
              179, 247, 180, -1, 247, 248, 180, -1, 180, 248, 181, -1,
              248, 249, 181, -1, 181, 249, 182, -1, 249, 250, 182, -1,
              182, 250, 183, -1, 250, 251, 183, -1, 183, 251, 184, -1,
              251, 185, 184, -1, 252, 253, 254, -1, 253, 255, 254, -1,
              256, 252, 257, -1, 252, 254, 257, -1, 258, 256, 259, -1,
              256, 257, 259, -1, 260, 258, 261, -1, 258, 259, 261, -1,
              262, 260, 263, -1, 260, 261, 263, -1, 264, 262, 265, -1,
              262, 263, 265, -1, 266, 264, 267, -1, 264, 265, 267, -1,
              268, 266, 269, -1, 266, 267, 269, -1, 270, 268, 271, -1,
              268, 269, 271, -1, 272, 270, 273, -1, 270, 271, 273, -1,
              274, 272, 275, -1, 272, 273, 275, -1, 276, 274, 277, -1,
              274, 275, 277, -1, 278, 276, 279, -1, 276, 277, 279, -1,
              280, 278, 281, -1, 278, 279, 281, -1, 253, 280, 255, -1,
              280, 281, 255, -1, 280, 253, 276, -1, 280, 276, 278, -1,
              256, 274, 252, -1, 256, 258, 274, -1, 274, 258, 272, -1,
              258, 260, 272, -1, 264, 270, 262, -1, 264, 266, 270, -1,
              266, 268, 270, -1, 270, 272, 262, -1, 274, 276, 252, -1,
              276, 253, 252, -1, 272, 260, 262, -1, 254, 255, 277, -1,
              254, 277, 275, -1, 254, 275, 257, -1, 279, 277, 281, -1,
              257, 275, 259, -1, 271, 263, 273, -1, 269, 267, 271, -1,
              267, 265, 271, -1, 265, 263, 271, -1, 263, 261, 273, -1,
              261, 259, 273, -1, 273, 259, 275, -1, 281, 277, 255, -1,
              282, 283, 284, -1, 283, 285, 284, -1, 286, 282, 287, -1,
              282, 284, 287, -1, 288, 286, 289, -1, 286, 287, 289, -1,
              290, 288, 291, -1, 288, 289, 291, -1, 292, 290, 293, -1,
              290, 291, 293, -1, 294, 292, 295, -1, 292, 293, 295, -1,
              296, 294, 297, -1, 294, 295, 297, -1, 298, 296, 299, -1,
              296, 297, 299, -1, 300, 298, 301, -1, 298, 299, 301, -1,
              302, 300, 303, -1, 300, 301, 303, -1, 283, 302, 285, -1,
              302, 303, 285, -1, 282, 286, 283, -1, 283, 286, 302, -1,
              290, 296, 288, -1, 292, 294, 290, -1, 294, 296, 290, -1,
              296, 298, 288, -1, 298, 300, 288, -1, 300, 302, 288, -1,
              288, 302, 286, -1, 284, 285, 287, -1, 301, 289, 303, -1,
              301, 299, 289, -1, 299, 297, 289, -1, 289, 297, 291, -1,
              293, 291, 295, -1, 295, 291, 297, -1, 289, 287, 303, -1,
              287, 285, 303, -1, 304, 305, 306, -1, 305, 307, 306, -1,
              305, 308, 307, -1, 308, 309, 307, -1, 308, 310, 309, -1,
              310, 311, 309, -1, 310, 312, 311, -1, 312, 313, 311, -1,
              312, 314, 313, -1, 314, 315, 313, -1, 314, 316, 315, -1,
              316, 317, 315, -1, 316, 318, 317, -1, 318, 319, 317, -1,
              318, 320, 319, -1, 320, 321, 319, -1, 320, 322, 321, -1,
              322, 323, 321, -1, 322, 324, 323, -1, 324, 325, 323, -1,
              324, 326, 325, -1, 326, 327, 325, -1, 326, 328, 327, -1,
              328, 329, 327, -1, 328, 330, 329, -1, 330, 331, 329, -1,
              330, 332, 331, -1, 332, 333, 331, -1, 332, 304, 333, -1,
              304, 306, 333, -1, 304, 328, 305, -1, 304, 332, 328, -1,
              332, 330, 328, -1, 328, 326, 305, -1, 324, 310, 326, -1,
              322, 314, 324, -1, 320, 318, 322, -1, 318, 316, 322, -1,
              316, 314, 322, -1, 314, 312, 324, -1, 312, 310, 324, -1,
              310, 308, 326, -1, 308, 305, 326, -1, 331, 333, 329, -1,
              333, 306, 329, -1, 309, 327, 307, -1, 309, 311, 327, -1,
              327, 311, 325, -1, 311, 313, 325, -1, 317, 323, 315, -1,
              317, 319, 323, -1, 319, 321, 323, -1, 323, 325, 315, -1,
              327, 329, 307, -1, 329, 306, 307, -1, 325, 313, 315, -1,
              334, 335, 336, -1, 335, 337, 336, -1, 335, 338, 337, -1,
              338, 339, 337, -1, 338, 340, 339, -1, 340, 341, 339, -1,
              340, 342, 341, -1, 342, 343, 341, -1, 342, 344, 343, -1,
              344, 345, 343, -1, 344, 346, 345, -1, 346, 347, 345, -1,
              346, 348, 347, -1, 348, 349, 347, -1, 348, 350, 349, -1,
              350, 351, 349, -1, 350, 352, 351, -1, 352, 353, 351, -1,
              352, 354, 353, -1, 354, 355, 353, -1, 354, 334, 355, -1,
              334, 336, 355, -1, 335, 334, 338, -1, 334, 354, 338, -1,
              338, 354, 340, -1, 354, 352, 340, -1, 352, 350, 340, -1,
              346, 342, 348, -1, 346, 344, 342, -1, 342, 340, 348, -1,
              348, 340, 350, -1, 336, 339, 355, -1, 336, 337, 339, -1,
              339, 341, 355, -1, 343, 349, 341, -1, 345, 347, 343, -1,
              347, 349, 343, -1, 349, 351, 341, -1, 351, 353, 341, -1,
              353, 355, 341, -1, 356, 359, 357, -1, 359, 358, 357, -1,
              360, 361, 363, -1, 361, 362, 363, -1, 356, 357, 360, -1,
              357, 361, 360, -1, 359, 363, 358, -1, 363, 362, 358, -1,
              356, 360, 359, -1, 360, 363, 359, -1, 357, 358, 361, -1,
              358, 362, 361, -1, 364, 365, 364, -1, 364, 365, 372, -1,
              365, 366, 372, -1, 372, 366, 373, -1, 366, 367, 373, -1,
              373, 367, 374, -1, 367, 368, 374, -1, 374, 368, 375, -1,
              368, 369, 375, -1, 375, 369, 376, -1, 369, 370, 376, -1,
              376, 370, 377, -1, 370, 371, 377, -1, 364, 372, 378, -1,
              372, 373, 378, -1, 378, 373, 379, -1, 373, 374, 379, -1,
              379, 374, 380, -1, 374, 375, 380, -1, 380, 375, 381, -1,
              375, 376, 381, -1, 381, 376, 382, -1, 376, 377, 382, -1,
              382, 377, 383, -1, 377, 371, 383, -1, 364, 378, 384, -1,
              378, 379, 384, -1, 384, 379, 385, -1, 379, 380, 385, -1,
              385, 380, 386, -1, 380, 381, 386, -1, 386, 381, 387, -1,
              381, 382, 387, -1, 387, 382, 388, -1, 382, 383, 388, -1,
              388, 383, 389, -1, 383, 371, 389, -1, 364, 384, 390, -1,
              384, 385, 390, -1, 390, 385, 391, -1, 385, 386, 391, -1,
              391, 386, 392, -1, 386, 387, 392, -1, 392, 387, 393, -1,
              387, 388, 393, -1, 393, 388, 394, -1, 388, 389, 394, -1,
              394, 389, 395, -1, 389, 371, 395, -1, 364, 390, 396, -1,
              390, 391, 396, -1, 396, 391, 397, -1, 391, 392, 397, -1,
              397, 392, 398, -1, 392, 393, 398, -1, 398, 393, 399, -1,
              393, 394, 399, -1, 399, 394, 400, -1, 394, 395, 400, -1,
              400, 395, 401, -1, 395, 371, 401, -1, 364, 396, 402, -1,
              396, 397, 402, -1, 402, 397, 403, -1, 397, 398, 403, -1,
              403, 398, 404, -1, 398, 399, 404, -1, 404, 399, 405, -1,
              399, 400, 405, -1, 405, 400, 406, -1, 400, 401, 406, -1,
              406, 401, 407, -1, 401, 371, 407, -1, 364, 402, 408, -1,
              402, 403, 408, -1, 408, 403, 409, -1, 403, 404, 409, -1,
              409, 404, 410, -1, 404, 405, 410, -1, 410, 405, 411, -1,
              405, 406, 411, -1, 411, 406, 412, -1, 406, 407, 412, -1,
              412, 407, 413, -1, 407, 371, 413, -1, 364, 408, 414, -1,
              408, 409, 414, -1, 414, 409, 415, -1, 409, 410, 415, -1,
              415, 410, 416, -1, 410, 411, 416, -1, 416, 411, 417, -1,
              411, 412, 417, -1, 417, 412, 418, -1, 412, 413, 418, -1,
              418, 413, 419, -1, 413, 371, 419, -1, 364, 414, 420, -1,
              414, 415, 420, -1, 420, 415, 421, -1, 415, 416, 421, -1,
              421, 416, 422, -1, 416, 417, 422, -1, 422, 417, 423, -1,
              417, 418, 423, -1, 423, 418, 424, -1, 418, 419, 424, -1,
              424, 419, 425, -1, 419, 371, 425, -1, 364, 420, 426, -1,
              420, 421, 426, -1, 426, 421, 427, -1, 421, 422, 427, -1,
              427, 422, 428, -1, 422, 423, 428, -1, 428, 423, 429, -1,
              423, 424, 429, -1, 429, 424, 430, -1, 424, 425, 430, -1,
              430, 425, 431, -1, 425, 371, 431, -1, 364, 426, 432, -1,
              426, 427, 432, -1, 432, 427, 433, -1, 427, 428, 433, -1,
              433, 428, 434, -1, 428, 429, 434, -1, 434, 429, 435, -1,
              429, 430, 435, -1, 435, 430, 436, -1, 430, 431, 436, -1,
              436, 431, 437, -1, 431, 371, 437, -1, 364, 432, 365, -1,
              432, 433, 365, -1, 365, 433, 366, -1, 433, 434, 366, -1,
              366, 434, 367, -1, 434, 435, 367, -1, 367, 435, 368, -1,
              435, 436, 368, -1, 368, 436, 369, -1, 436, 437, 369, -1,
              369, 437, 370, -1, 437, 371, 370, -1, 438, 441, 439, -1,
              441, 440, 439, -1, 442, 443, 445, -1, 443, 444, 445, -1,
              438, 439, 442, -1, 439, 443, 442, -1, 441, 445, 440, -1,
              445, 444, 440, -1, 438, 442, 441, -1, 442, 445, 441, -1,
              439, 440, 443, -1, 440, 444, 443, -1, 446, 449, 447, -1,
              449, 448, 447, -1, 450, 451, 453, -1, 451, 452, 453, -1,
              446, 447, 450, -1, 447, 451, 450, -1, 449, 453, 448, -1,
              453, 452, 448, -1, 446, 450, 449, -1, 450, 453, 449, -1,
              447, 448, 451, -1, 448, 452, 451, -1]
            }
        }
      ]
    },
    DEF Layer:TRANSPORT Transform {
      translation -382.5 -25.62 0
      children [
        Shape {
          appearance Appearance {
            material Material {
              diffuseColor 1 1 1
            }
          }
          geometry DEF Layer:TRANSPORT-FACES IndexedFaceSet {
            ccw TRUE
            solid TRUE
            coord DEF Layer:TRANSPORT-COORD Coordinate { point [
              378.5 -25.62 -225, 382.2 -14.28 -225, 381.8 -2.362 -225,
              377.4 8.739 -225, 369.6 17.74 -225, 359.2 23.59 -225,
              347.5 25.62 -225, -347.5 25.62 -225, -359.2 23.59 -225,
              -369.6 17.74 -225, -377.4 8.739 -225, -381.8 -2.362 -225,
              -382.2 -14.28 -225, -378.5 -25.62 -225, 378.5 -25.62 225,
              382.2 -14.28 225, 381.8 -2.362 225, 377.4 8.739 225,
              369.6 17.74 225, 359.2 23.59 225, 347.5 25.62 225,
              -347.5 25.62 225, -359.2 23.59 225, -369.6 17.74 225,
              -377.4 8.739 225, -381.8 -2.362 225, -382.2 -14.28 225,
              -378.5 -25.62 225]
            }
            coordIndex [
              0, 1, 14, -1, 14, 1, 15, -1, 1, 2, 15, -1, 15, 2, 16, -1,
              2, 3, 16, -1, 16, 3, 17, -1, 3, 4, 17, -1, 17, 4, 18, -1,
              4, 5, 18, -1, 18, 5, 19, -1, 5, 6, 19, -1, 19, 6, 20, -1,
              6, 7, 20, -1, 20, 7, 21, -1, 7, 8, 21, -1, 21, 8, 22, -1,
              8, 9, 22, -1, 22, 9, 23, -1, 9, 10, 23, -1, 23, 10, 24, -1,
              10, 11, 24, -1, 24, 11, 25, -1, 11, 12, 25, -1,
              25, 12, 26, -1, 12, 13, 26, -1, 26, 13, 27, -1]
            }
        }
      ]
    },
    DEF Block:ptobci Transform {
      translation -730 -35 318.3
      rotation 0 0 1 -3.142
      children [
        DEF Layer:TRANSPORT_0 Transform {
          translation 47.5 45 50.45
          children [
            Shape {
              appearance Appearance {
                material Material {
                  diffuseColor 1 1 1
                }
              }
              geometry DEF Layer:TRANSPORT_0-FACES IndexedFaceSet {
                ccw FALSE
                solid TRUE
                coord DEF Layer:TRANSPORT_0-COORD Coordinate { point [
                  126.5 129 -43.75, -126.5 129 -43.75, -126.5 129 43.75,
                  126.5 129 43.75, 126.5 -129 -43.75, -126.5 -129 -43.75,
                  -126.5 -129 43.75, 126.5 -129 43.75]
                }
                coordIndex [
                  0, 3, 1, -1, 3, 2, 1, -1, 4, 5, 7, -1, 5, 6, 7, -1,
                  0, 1, 4, -1, 1, 5, 4, -1, 3, 7, 2, -1, 7, 6, 2, -1,
                  0, 4, 3, -1, 4, 7, 3, -1, 1, 2, 5, -1, 2, 6, 5, -1]
                }
            }
          ]
        },
      ]
    }
  ]
}


objo wrote at 2012-06-21 10:48:

> How can I send you my files so you can have a look at what I fixed and how you can use it for your code?

create a fork from  https://hg.codeplex.com/forks/glgweeke/vrml97, apply your changes and send a pull request!


glgweeke wrote at 2012-06-27 21:10:

Sorry,

that it takes so long to push the files into to repository. But I get an error (Bad Gateway 255 or so).

So i push only the one vrml.cs file and not the complete merge repository. That works.

Your .wrl file can be display well.

0

Automatically move manipulator

Arjan 9 years ago 0
I have created a small example with a "robot" containing rotating axes.
With the three manipulators I can move the axis of the robot.
But I'm looking for a way to move the manipulators when the robot moves.
So when axis 1 of the robot moves you see all the 'stacked' objects moving but not the manipulators.
How can I achieve this?

Here is my source code:
SphereVisual3D sphereAxis1 = new SphereVisual3D();
sphereAxis1.Fill = new SolidColorBrush(Colors.Blue);
sphereAxis1.Center = new System.Windows.Media.Media3D.Point3D(0, 0, 0);
sphereAxis1.Radius = 1.0;
hvpMain.Children.Add(sphereAxis1);


RotateManipulator manipulatorAxis1 = new RotateManipulator();
manipulatorAxis1.Color = Colors.Blue;
manipulatorAxis1.Bind(sphereAxis1);
manipulatorAxis1.Axis = new System.Windows.Media.Media3D.Vector3D(0, 0, 1);
manipulatorAxis1.Diameter = 3.5;
manipulatorAxis1.InnerDiameter = 2.5;
hvpMain.Children.Add(manipulatorAxis1);


PipeVisual3D pipe1 = new PipeVisual3D();
pipe1.Fill = new SolidColorBrush(Colors.Orange);
pipe1.Diameter = 5.0;
pipe1.Point1 = new System.Windows.Media.Media3D.Point3D(0, 0, -1);
pipe1.Point2 = new System.Windows.Media.Media3D.Point3D(0, 0, 0);
sphereAxis1.Children.Add(pipe1);


PipeVisual3D pipe2 = new PipeVisual3D();
pipe2.Fill = new SolidColorBrush(Colors.Orange);
pipe2.Diameter = 2.0;
pipe2.Point1 = new System.Windows.Media.Media3D.Point3D(0, 0, 0);
pipe2.Point2 = new System.Windows.Media.Media3D.Point3D(0, 0, 2);
pipe1.Children.Add(pipe2);


SphereVisual3D sphereAxis2 = new SphereVisual3D();
sphereAxis2.Fill = new SolidColorBrush(Colors.Blue);
sphereAxis2.Center = new System.Windows.Media.Media3D.Point3D(0, 0, 2);
sphereAxis2.Radius = 1.0;
pipe2.Children.Add(sphereAxis2);


RotateManipulator manipulatorAxis2 = new RotateManipulator();
manipulatorAxis2.Pivot = new System.Windows.Media.Media3D.Point3D(0, 0, 2);
manipulatorAxis2.Axis = new System.Windows.Media.Media3D.Vector3D(0, 1, 0);
manipulatorAxis2.Color = Colors.Green;
manipulatorAxis2.Bind(sphereAxis2);
manipulatorAxis2.Position = new System.Windows.Media.Media3D.Point3D(0, 0, 2);
manipulatorAxis2.Diameter = 3.5;
manipulatorAxis2.InnerDiameter = 2.5;
hvpMain.Children.Add(manipulatorAxis2);


PipeVisual3D pipe3 = new PipeVisual3D();
pipe3.Fill = new SolidColorBrush(Colors.Orange);
pipe3.Diameter = 2.0;
pipe3.Point1 = new System.Windows.Media.Media3D.Point3D(0, 0, 2);
pipe3.Point2 = new System.Windows.Media.Media3D.Point3D(0, 0, 7);
sphereAxis2.Children.Add(pipe3);


SphereVisual3D sphereAxis3 = new SphereVisual3D();
sphereAxis3.Fill = new SolidColorBrush(Colors.Blue);
sphereAxis3.Center = new System.Windows.Media.Media3D.Point3D(0, 0, 7);
sphereAxis3.Radius = 1.0;
pipe3.Children.Add(sphereAxis3);


RotateManipulator manipulatorAxis3 = new RotateManipulator();
manipulatorAxis3.Pivot = new System.Windows.Media.Media3D.Point3D(0, 0, 7);
manipulatorAxis3.Axis = new System.Windows.Media.Media3D.Vector3D(0, 1, 0);
manipulatorAxis3.Color = Colors.Green;
manipulatorAxis3.Bind(sphereAxis3);
manipulatorAxis3.Position = new System.Windows.Media.Media3D.Point3D(0, 0, 7);
manipulatorAxis3.Diameter = 3.5;
manipulatorAxis3.InnerDiameter = 2.5;
hvpMain.Children.Add(manipulatorAxis3);


PipeVisual3D pipe4 = new PipeVisual3D();
pipe4.Fill = new SolidColorBrush(Colors.Orange);
pipe4.Diameter = 2.0;
pipe4.Point1 = new System.Windows.Media.Media3D.Point3D(0, 0, 7);
pipe4.Point2 = new System.Windows.Media.Media3D.Point3D(7, 0, 7);
sphereAxis3.Children.Add(pipe4);

Kind regards,

Arjan
0

DataTemplate3D for custom ModelVisual3D Xml/View

Michael Powell 9 years ago updated 9 years ago 4
I've got a custom ModelVisual3D, literally I extended into a Xml/View to build a model. I will likely have several of these animals, but each of them are a ModelVisual3D.

I am studying the WPF DataTemplate example, and it is interesting, data template acts as a kind of bridge into the 3D model?

I'm not sure what CreateItem is all about, except possibly a convention integrating with the sister ItemsVisual3D?

I wouldn't have such a thing in my model. In fact, I'm not sure I would potentially have one data template per model in the view, the content of which is the view instance?

It's making some sense grasping the connecting tissue.

Thank you...
0
Under review

How to render grass and chalk lines easily

Michael Powell 10 years ago updated 9 years ago 3
Hello,

I am taking a look at some options how to render grass, for instance as a texture, overlaid on a model, like a RectangleVisual3D and/or polygonal-surface, for instance, then in such a way that I can also render chalk lines, identify some material, etc, that simulates chalk lines, in both lines (or small rectangles themselves), and for font-materials (if there were such a thing? haven't done the research there, yet...).

I've found some tutorials how to work through apps like Paint.NET, GIMP, etc, in order to crank out some grass textures. Basically what's I would consider low to low/medium end quality. Not really looking for medium/high to high end quality at this point for this purpose, nothing even remotely like a Cinema 4D, for instance.

I am also taking a look at Unity3D for potential options there, they can generate grass, but this looks more like a full-fledged game-style development environment. Which might be along the lines what I'd like to do, especially with simulation for sprites, physics, etc. I'm not positive, SharpDX an analog to Unity3D, but it came up looking for grass and related effects.

Anyhow, for now, looking for the configuration aspects and what I can accomplish with a simpler-generated model.

Thank you...

Best regards,

Michael