/// <summary> /// Actually create this GraphicsResource resources. /// </summary> /// <param name="ctx"> /// A <see cref="GraphicsContext"/> used for allocating resources. /// </param> /// <remarks> /// All resources linked with <see cref="LinkResource(IGraphicsResource)"/> will be automatically created. /// </remarks> protected override void CreateObject(GraphicsContext ctx) { // Create object state ObjectState.Create(ctx, null); // Base implementation base.CreateObject(ctx); }
/// <summary> /// Actually create this GraphicsResource resources. /// </summary> /// <param name="ctx"> /// A <see cref="GraphicsContext"/> used for allocating resources. /// </param> /// <remarks> /// All resources linked with <see cref="LinkResource(IGraphicsResource)"/> will be automatically created. /// </remarks> protected override void CreateObject(GraphicsContext ctx) { // Create object state ObjectState.Create(ctx, null); // Base implementation base.CreateObject(ctx); // Propagate creation to hierarchy foreach (SceneObject sceneGraphObject in _Children) { sceneGraphObject.Create(ctx); } }
/// <summary> /// Traverse delegate for creating resources. /// </summary> /// <param name="ctx"> /// The <see cref="GraphicsContext"/> used for creating resources. /// </param> /// <param name="ctxScene"></param> /// <param name="sceneObject"></param> /// <param name="data"></param> /// <returns></returns> private static bool CreateDelegate(GraphicsContext ctx, SceneGraphContext ctxScene, SceneObject sceneObject, object data) { SceneObjectGeometry sceneGeometry = sceneObject as SceneObjectGeometry; if (sceneGeometry != null) { GraphicsStateSet sceneGeometryState = ctxScene.GraphicsStateStack.Current; sceneGeometry.Create(ctx); sceneGeometryState.Create(ctx, sceneGeometry.Program); } return(true); }