mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
Add new C# sample which allow to render the OCCT scene to a Direct3D context in a WPF application. DirectX SDK is required in order to build this sample.
101 lines
2.5 KiB
C#
101 lines
2.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Shapes;
|
|
|
|
namespace IE_WPF_WinForms
|
|
{
|
|
public enum Material
|
|
{
|
|
Brass,
|
|
Bronze,
|
|
Copper,
|
|
Gold,
|
|
Pewter,
|
|
Plaster,
|
|
Plastic,
|
|
Silver
|
|
}
|
|
|
|
/// <summary>
|
|
/// Interaction logic for MaterialDlg.xaml
|
|
/// </summary>
|
|
public partial class MaterialDlg : Window
|
|
{
|
|
public MaterialDlg( OCCTProxy theView )
|
|
{
|
|
this.InitializeComponent();
|
|
|
|
if ( theView == null )
|
|
{
|
|
MessageBox.Show( "Fatal Error during the graphic initialisation", "Error!" );
|
|
}
|
|
|
|
View = theView;
|
|
|
|
SetInitialState();
|
|
}
|
|
|
|
public OCCTProxy View { get; private set; }
|
|
|
|
private void PlasterBtn_Checked( object sender, RoutedEventArgs e )
|
|
{
|
|
View.SetMaterial( (int)Material.Plaster );
|
|
View.UpdateCurrentViewer();
|
|
}
|
|
|
|
private void BrassBtn_Checked( object sender, RoutedEventArgs e )
|
|
{
|
|
View.SetMaterial( (int)Material.Brass );
|
|
View.UpdateCurrentViewer();
|
|
}
|
|
|
|
private void BronzeBtn_Checked( object sender, RoutedEventArgs e )
|
|
{
|
|
View.SetMaterial( (int)Material.Bronze );
|
|
View.UpdateCurrentViewer();
|
|
}
|
|
|
|
private void CopperBtn_Checked( object sender, RoutedEventArgs e )
|
|
{
|
|
View.SetMaterial( (int)Material.Copper );
|
|
View.UpdateCurrentViewer();
|
|
}
|
|
|
|
private void GoldBtn_Checked( object sender, RoutedEventArgs e )
|
|
{
|
|
View.SetMaterial( (int)Material.Gold );
|
|
View.UpdateCurrentViewer();
|
|
}
|
|
|
|
private void PewterBtn_Checked( object sender, RoutedEventArgs e )
|
|
{
|
|
View.SetMaterial( (int)Material.Pewter );
|
|
View.UpdateCurrentViewer();
|
|
}
|
|
|
|
private void PlasticBtn_Checked( object sender, RoutedEventArgs e )
|
|
{
|
|
View.SetMaterial( (int)Material.Plastic );
|
|
View.UpdateCurrentViewer();
|
|
}
|
|
|
|
private void SilverBtn_Checked( object sender, RoutedEventArgs e )
|
|
{
|
|
View.SetMaterial( (int)Material.Silver );
|
|
View.UpdateCurrentViewer();
|
|
}
|
|
|
|
private void SetInitialState()
|
|
{
|
|
// TODO
|
|
}
|
|
}
|
|
} |