Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Core / CSharp / System / Windows / Media3D / Model3DGroup.cs / 1 / Model3DGroup.cs
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
//
// Description: 3D model collection.
//
// See spec at http://avalon/medialayer/Specifications/Avalon3D%20API%20Spec.mht
//
// History:
// 06/28/2003 : t-gregr - Created
//
//---------------------------------------------------------------------------
using System;
using System.Collections;
using System.Diagnostics;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Media3D;
using System.Windows.Markup;
using MS.Internal;
using MS.Internal.Media3D;
using SR=MS.Internal.PresentationCore.SR;
using SRID=MS.Internal.PresentationCore.SRID;
namespace System.Windows.Media.Media3D
{
///
/// 3D model group.
///
[ContentProperty("Children")]
public sealed partial class Model3DGroup : Model3D
{
//-----------------------------------------------------
//
// Constructors
//
//-----------------------------------------------------
#region Constructors
///
/// Default constructor.
///
public Model3DGroup() {}
#endregion Constructors
//------------------------------------------------------
//
// Public Methods
//
//-----------------------------------------------------
#region Public Methods
#endregion Public Methods
///
/// Override of OnChanged that propagates an internal dirty bit up the tree
///
protected override void OnChanged()
{
base.OnChanged();
// It's possible that...
// 1) A child just changed
// 2) A child was just inserted/removed
// 3) The Children collection changed
// ...so we need to update our dirty flag
bool dirtyForPreCompute = false;
Model3DCollection children = Children;
if (children != null)
{
int count = children.Count;
for (int i = 0; i < count; i++)
{
dirtyForPreCompute |= children.Internal_GetItem(i)._flags[DirtyForPreComputeFlag];
}
}
_flags[DirtyForPreComputeFlag] = dirtyForPreCompute;
}
//------------------------------------------------------
//
// Internal Methods
//
//------------------------------------------------------
#region Internal Methods
internal override void RayHitTestCore(
RayHitTestParameters rayParams)
{
Model3DCollection children = Children;
if (children == null)
{
return;
}
for (int i = children.Count - 1; i >= 0; i--)
{
Model3D child = children.Internal_GetItem(i);
// Perform the hit-test against the child.
child.RayHitTest(rayParams);
}
}
internal override Rect3D CalculateSubgraphBoundsInnerSpace()
{
Model3DCollection children = Children;
if (children == null)
{
return Rect3D.Empty;
}
Rect3D bounds = Rect3D.Empty;
for (int i = 0, count = children.Count; i < count; i++)
{
Model3D child = children.Internal_GetItem(i);
// Calls CSBOS rather than Bounds to avoid ReadPreamble.
bounds.Union(child.CalculateSubgraphBoundsOuterSpace());
}
return bounds;
}
internal override void PreCompute()
{
Debug.Assert(_flags[DirtyForPreComputeFlag]);
Model3DCollection children = Children;
bool requiresRealization = false;
if (children != null)
{
int count = children.Count;
for (int i = 0; i < count; i++)
{
Model3D child = children.Internal_GetItem(i);
if (child._flags[DirtyForPreComputeFlag])
{
child.PreCompute();
}
requiresRealization |= child._flags[RequiresRealizationFlag];
}
}
_flags[RequiresRealizationFlag] = requiresRealization;
_flags[DirtyForPreComputeFlag] = false;
}
///
/// Traverses the model group to mark all realizations.
///
internal override void MarkVisibleRealizations(RealizationContext rc)
{
Debug.Assert(_flags[RequiresRealizationFlag]);
Transform3D transform3D = Transform;
Matrix3DStack stack3D = rc.Transform3DStack;
if (transform3D != null)
{
stack3D.Push(transform3D.Value);
}
Model3DCollection children = Children;
if (children != null)
{
int count = children.Count;
for (int i = 0; i < count; i++)
{
Model3D child = children.Internal_GetItem(i);
if (child._flags[RequiresRealizationFlag])
{
child.MarkVisibleRealizations(rc);
}
}
}
if (transform3D != null)
{
stack3D.Pop();
}
}
#endregion Internal Methods
//-----------------------------------------------------
//
// Internal Properties
//
//------------------------------------------------------
#region Internal Properties
// named EmptyGroup not to collide with public Model3D.Empty
internal static Model3DGroup EmptyGroup
{
get
{
if (s_empty == null)
{
s_empty = new Model3DGroup();
s_empty.Freeze();
}
return s_empty;
}
}
#endregion Internal Properties
//-----------------------------------------------------
//
// Private Fields
//
//-----------------------------------------------------
#region Private Fields
private static Model3DGroup s_empty;
#endregion Private Fields
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
//
// Description: 3D model collection.
//
// See spec at http://avalon/medialayer/Specifications/Avalon3D%20API%20Spec.mht
//
// History:
// 06/28/2003 : t-gregr - Created
//
//---------------------------------------------------------------------------
using System;
using System.Collections;
using System.Diagnostics;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Media3D;
using System.Windows.Markup;
using MS.Internal;
using MS.Internal.Media3D;
using SR=MS.Internal.PresentationCore.SR;
using SRID=MS.Internal.PresentationCore.SRID;
namespace System.Windows.Media.Media3D
{
///
/// 3D model group.
///
[ContentProperty("Children")]
public sealed partial class Model3DGroup : Model3D
{
//-----------------------------------------------------
//
// Constructors
//
//-----------------------------------------------------
#region Constructors
///
/// Default constructor.
///
public Model3DGroup() {}
#endregion Constructors
//------------------------------------------------------
//
// Public Methods
//
//-----------------------------------------------------
#region Public Methods
#endregion Public Methods
///
/// Override of OnChanged that propagates an internal dirty bit up the tree
///
protected override void OnChanged()
{
base.OnChanged();
// It's possible that...
// 1) A child just changed
// 2) A child was just inserted/removed
// 3) The Children collection changed
// ...so we need to update our dirty flag
bool dirtyForPreCompute = false;
Model3DCollection children = Children;
if (children != null)
{
int count = children.Count;
for (int i = 0; i < count; i++)
{
dirtyForPreCompute |= children.Internal_GetItem(i)._flags[DirtyForPreComputeFlag];
}
}
_flags[DirtyForPreComputeFlag] = dirtyForPreCompute;
}
//------------------------------------------------------
//
// Internal Methods
//
//------------------------------------------------------
#region Internal Methods
internal override void RayHitTestCore(
RayHitTestParameters rayParams)
{
Model3DCollection children = Children;
if (children == null)
{
return;
}
for (int i = children.Count - 1; i >= 0; i--)
{
Model3D child = children.Internal_GetItem(i);
// Perform the hit-test against the child.
child.RayHitTest(rayParams);
}
}
internal override Rect3D CalculateSubgraphBoundsInnerSpace()
{
Model3DCollection children = Children;
if (children == null)
{
return Rect3D.Empty;
}
Rect3D bounds = Rect3D.Empty;
for (int i = 0, count = children.Count; i < count; i++)
{
Model3D child = children.Internal_GetItem(i);
// Calls CSBOS rather than Bounds to avoid ReadPreamble.
bounds.Union(child.CalculateSubgraphBoundsOuterSpace());
}
return bounds;
}
internal override void PreCompute()
{
Debug.Assert(_flags[DirtyForPreComputeFlag]);
Model3DCollection children = Children;
bool requiresRealization = false;
if (children != null)
{
int count = children.Count;
for (int i = 0; i < count; i++)
{
Model3D child = children.Internal_GetItem(i);
if (child._flags[DirtyForPreComputeFlag])
{
child.PreCompute();
}
requiresRealization |= child._flags[RequiresRealizationFlag];
}
}
_flags[RequiresRealizationFlag] = requiresRealization;
_flags[DirtyForPreComputeFlag] = false;
}
///
/// Traverses the model group to mark all realizations.
///
internal override void MarkVisibleRealizations(RealizationContext rc)
{
Debug.Assert(_flags[RequiresRealizationFlag]);
Transform3D transform3D = Transform;
Matrix3DStack stack3D = rc.Transform3DStack;
if (transform3D != null)
{
stack3D.Push(transform3D.Value);
}
Model3DCollection children = Children;
if (children != null)
{
int count = children.Count;
for (int i = 0; i < count; i++)
{
Model3D child = children.Internal_GetItem(i);
if (child._flags[RequiresRealizationFlag])
{
child.MarkVisibleRealizations(rc);
}
}
}
if (transform3D != null)
{
stack3D.Pop();
}
}
#endregion Internal Methods
//-----------------------------------------------------
//
// Internal Properties
//
//------------------------------------------------------
#region Internal Properties
// named EmptyGroup not to collide with public Model3D.Empty
internal static Model3DGroup EmptyGroup
{
get
{
if (s_empty == null)
{
s_empty = new Model3DGroup();
s_empty.Freeze();
}
return s_empty;
}
}
#endregion Internal Properties
//-----------------------------------------------------
//
// Private Fields
//
//-----------------------------------------------------
#region Private Fields
private static Model3DGroup s_empty;
#endregion Private Fields
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- StylusDevice.cs
- CustomServiceCredentials.cs
- SByte.cs
- IconHelper.cs
- JapaneseCalendar.cs
- ICollection.cs
- Html32TextWriter.cs
- CngAlgorithmGroup.cs
- Separator.cs
- GridViewColumnCollection.cs
- RequestResizeEvent.cs
- keycontainerpermission.cs
- odbcmetadatacollectionnames.cs
- Perspective.cs
- ControlValuePropertyAttribute.cs
- wgx_exports.cs
- Int32AnimationUsingKeyFrames.cs
- SqlClientWrapperSmiStream.cs
- ServiceBuildProvider.cs
- Ref.cs
- FlowNode.cs
- SHA256.cs
- ProxySimple.cs
- XmlSerializerFactory.cs
- XmlEntityReference.cs
- BamlStream.cs
- DoubleAnimationUsingPath.cs
- DeviceFilterDictionary.cs
- MetaType.cs
- FontUnitConverter.cs
- ParagraphVisual.cs
- NamespaceEmitter.cs
- MappingException.cs
- RegexMatch.cs
- Parser.cs
- PropertyGridEditorPart.cs
- DbModificationClause.cs
- TemplateColumn.cs
- GlyphShapingProperties.cs
- BindingCollection.cs
- XmlNodeList.cs
- WindowsButton.cs
- HttpCachePolicyBase.cs
- InkCanvasSelection.cs
- TextTreeExtractElementUndoUnit.cs
- PageSetupDialog.cs
- SettingsContext.cs
- GridItem.cs
- ListItem.cs
- PeerNameRegistration.cs
- CompilerState.cs
- XmlMtomWriter.cs
- HtmlLink.cs
- DesignerObject.cs
- XPathCompileException.cs
- CalendarAutoFormat.cs
- CompositeFontParser.cs
- RegisteredArrayDeclaration.cs
- EqualityComparer.cs
- Pair.cs
- DispatcherObject.cs
- IisTraceListener.cs
- OleStrCAMarshaler.cs
- CompilerHelpers.cs
- SamlSecurityTokenAuthenticator.cs
- ProcessStartInfo.cs
- Trigger.cs
- HtmlInputControl.cs
- PointAnimationUsingKeyFrames.cs
- InfoCardRSAPKCS1SignatureDeformatter.cs
- WebColorConverter.cs
- connectionpool.cs
- ObjectAssociationEndMapping.cs
- InputProviderSite.cs
- ToolbarAUtomationPeer.cs
- HtmlAnchor.cs
- SystemUdpStatistics.cs
- BitStream.cs
- TextLine.cs
- DocumentViewer.cs
- CodeTypeReferenceExpression.cs
- Parser.cs
- AppSettingsExpressionBuilder.cs
- AssemblyCollection.cs
- DiagnosticTrace.cs
- FontFamilyValueSerializer.cs
- DependencyProperty.cs
- OwnerDrawPropertyBag.cs
- XmlElementAttributes.cs
- TextStore.cs
- CapacityStreamGeometryContext.cs
- Win32Exception.cs
- AppDomainEvidenceFactory.cs
- CodeAttributeDeclarationCollection.cs
- ClientViaElement.cs
- StyleReferenceConverter.cs
- DoubleConverter.cs
- XmlSchemaResource.cs
- RoutedEventArgs.cs
- PrivateFontCollection.cs