Click or drag to resize
Viewport3ds Class
Viewport3ds is a control that is derived from Viewport3D and can shows content of 3ds files.
Inheritance Hierarchy

Namespace: Ab3d.Controls
Assembly: Ab3d.Reader3ds (in Ab3d.Reader3ds.dll) Version: 9.0.5590.1040
Syntax
C#
[ContentPropertyAttribute("Children")]
public class Viewport3ds : Viewport3D

The Viewport3ds type exposes the following members.

Constructors
  NameDescription
Public methodViewport3ds
Constructor
Top
Properties
  NameDescription
Public propertyAnimationDuration
Gets or sets the time in second how long will the whole animation be playing (once from the first to the last frame).
Public propertyAutoRepeat
Gets or set if the animation should automatically repeat itself or not. Default value is true.
Public propertyAutoReverse
Gets or sets if animation should go backwards when coming to the last frame or should it start from beginning. Default value is false.
Public propertyCameraIndex
Gets or sets the index of the used camera from the list of cameras defined in 3ds file
Public propertyFrameNumber
Gets or sets the frame number that is displayed by the Viewport3ds
Public propertyIsAnimated
Gets or sets a Boolean value that specifies if the Viewport3ds is automatically playing the animation read from 3ds file.
Public propertySource
Gets or sets the Source of the 3ds file
Public propertyTexturesPath
Gets or sets the path where the textures are located. If null or "" the path of the 3ds file is used. It is also possible to set TexturesPath to url of the textures (http://...) or to the application resources ("pack://application:,,,/XAMLBrowserApplication1;component/models")
Public propertyUsedReader3ds
Gets the Ab3d.Reader3ds instance that is used to read the 3ds file
Top
Methods
Events
  NameDescription
Public eventAfterReading3dsFile
AfterReading3dsFile event occurs after the 3ds file has been read.
Public eventCode exampleBeforeReading3dsFile
BeforeReading3dsFile event occurs after the UsedReader3ds has been created and before the actual 3ds file has been read.
Top
Fields
  NameDescription
Public fieldStatic memberAnimationDurationProperty
AnimationDurationProperty
Public fieldStatic memberAutoRepeatProperty
AutoRepeatProperty
Public fieldStatic memberAutoReverseProperty
AutoReverseProperty
Public fieldStatic memberCameraIndexProperty
CameraIndexProperty
Public fieldStatic memberFrameNumberProperty
FrameNumberProperty
Public fieldStatic memberIsAnimatedProperty
IsAnimatedProperty
Public fieldStatic memberSourceProperty
SourceProperty
Public fieldStatic memberTexturesPathProperty
TexturesPathProperty
Top
Remarks

Viewport3ds is the most simple way to show 3D objects from 3ds file. With specifying the Source property to the Uri of the 3ds file the Viewport3ds will show the 3D models with lights from the 3ds file.

If the 3ds file also defines cameras, they are also used for the Viewport3ds. By the fault the first camera is used. With CameraIndex property it is possible to set other cameras.

Viewport3ds can play animations from 3ds file. This can be done manually with setting the FrameNumber property. This property can be animated with DoubleAnimation.

Animations can be also played automatically with simply setting IsAnimated property to true. When animation is automatically played AnimationDuration, AutoRepeat and AutoReverseProperty properties are used to control the animation.

Examples

The following xaml shows 3D models from the 'ab3d drop down.3DS' file and plays the animation defined in the 3ds file.

XAML
<Page x:Class="Reader3dsSamples.Viewport3ds.Viewport3dsSample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls3ds="clr-namespace:Ab3d.Controls;assembly=Ab3d.Reader3ds">
<DockPanel>
    <controls3ds:Viewport3ds Source="/Resources/ab3d drop down.3DS"
                             IsAnimated="True"
                             AutoRepeat="True"
                             AnimationDuration="0:0:10"/>
</DockPanel>
</Page>
See Also