本文整理汇总了C#中TerraViewer.RenderContext11类的典型用法代码示例。如果您正苦于以下问题:C# RenderContext11类的具体用法?C# RenderContext11怎么用?C# RenderContext11使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RenderContext11类属于TerraViewer命名空间,在下文中一共展示了RenderContext11类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Draw3D
public override bool Draw3D(RenderContext11 renderContext, float transparancy, Tile parent)
{
RenderedGeneration = CurrentRenderGeneration;
TilesTouched++;
InViewFrustum = true;
if (!ReadyToRender)
{
TileCache.AddTileToQueue(this);
return false;
}
TilesInView++;
if (!CreateGeometry(renderContext, true))
{
return false;
}
renderContext.SetVertexBuffer(vertexBuffer);
renderContext.MainTexture = texture;
renderContext.SetIndexBuffer( indexBuffer[0]);
int partCount = this.TriangleCount;
TrianglesRendered += partCount;
renderContext.devContext.DrawIndexed(indexBuffer[0].Count, 0, 0);
return true;
}
开发者ID:ngonzalezromero,项目名称:wwt-windows-client,代码行数:34,代码来源:SphericalTile.cs
示例2: DrawEllipse
// Draw an ellipse with the specified semi-major axis and eccentricity. The orbit is drawn over a single period,
// fading from full brightness at the given eccentric anomaly.
//
// In order to match exactly the position at which a planet is drawn, the planet's position at the current time
// must be passed as a parameter. positionNow is in the current coordinate system of the render context, not the
// translated and rotated system of the orbital plane.
public static void DrawEllipse(RenderContext11 renderContext, double semiMajorAxis, double eccentricity, double eccentricAnomaly, Color color, Matrix3d worldMatrix, Vector3d positionNow)
{
if (ellipseShader == null)
{
ellipseShader = new EllipseShader11();
}
if (ellipseVertexBuffer == null)
{
ellipseVertexBuffer = CreateEllipseVertexBuffer( 500);
}
Matrix3d savedWorld = renderContext.World;
renderContext.World = worldMatrix;
renderContext.devContext.InputAssembler.PrimitiveTopology = SharpDX.Direct3D.PrimitiveTopology.LineStrip;
renderContext.SetVertexBuffer(ellipseVertexBuffer);
ellipseShader.UseShader(renderContext, semiMajorAxis, eccentricity, eccentricAnomaly, new SharpDX.Color(color.R, color.G, color.B, color.A), savedWorld, positionNow);
renderContext.devContext.Draw(ellipseVertexBuffer.Count, 0);
renderContext.World = savedWorld;
}
开发者ID:china-vo,项目名称:wwt-windows-client,代码行数:31,代码来源:Orbit.cs
示例3: CreateGeometry
public override bool CreateGeometry(RenderContext11 renderContext, bool uiThread)
{
InitializeStarDB();
ReadyToRender = true;
return true;
}
开发者ID:bluephoton,项目名称:wwt-windows-client,代码行数:7,代码来源:PlotTile.cs
示例4: Draw
public static void Draw(RenderContext11 renderContext, PositionColoredTextured[] points, int count, Matrix mat, bool triangleStrip)
{
if (VertexBuffer == null)
{
VertexBuffer = new Buffer(renderContext.Device, System.Runtime.InteropServices.Marshal.SizeOf(points[0]) * 2500, ResourceUsage.Dynamic, BindFlags.VertexBuffer, CpuAccessFlags.Write, ResourceOptionFlags.None, System.Runtime.InteropServices.Marshal.SizeOf(points[0]));
VertexBufferBinding = new VertexBufferBinding(VertexBuffer, System.Runtime.InteropServices.Marshal.SizeOf((points[0])), 0);
}
renderContext.devContext.InputAssembler.PrimitiveTopology = triangleStrip ? SharpDX.Direct3D.PrimitiveTopology.TriangleStrip : SharpDX.Direct3D.PrimitiveTopology.TriangleList;
renderContext.BlendMode = BlendMode.Alpha;
renderContext.setRasterizerState(TriangleCullMode.Off);
mat.Transpose();
WarpOutputShader.MatWVP = mat;
WarpOutputShader.Use(renderContext.devContext, false);
renderContext.SetVertexBuffer(VertexBufferBinding);
DataBox box = renderContext.devContext.MapSubresource(VertexBuffer, 0, MapMode.WriteDiscard, MapFlags.None);
Utilities.Write(box.DataPointer, points, 0, count);
renderContext.devContext.UnmapSubresource(VertexBuffer, 0);
renderContext.devContext.PixelShader.SetShaderResource(0, null);
renderContext.devContext.Draw(count, 0);
}
开发者ID:china-vo,项目名称:wwt-windows-client,代码行数:29,代码来源:Sprite2d.cs
示例5: Draw3D
public void Draw3D(RenderContext11 renderContext, float transparancy)
{
ratio = 1116f / Earth3d.MainWindow.RenderWindow.ClientRectangle.Height;
if (SingleSelectHandles == null)
{
SingleSelectHandles = Texture11.FromBitmap(RenderContext11.PrepDevice, Resources.Selhand);
}
if (MultiSelectHandles == null)
{
MultiSelectHandles = Texture11.FromBitmap(RenderContext11.PrepDevice, Resources.MultiSelhand);
}
if (FocusHandles == null)
{
FocusHandles = Texture11.FromBitmap(RenderContext11.PrepDevice, Resources.FocusHandles);
}
if (selectionSet.Count > 1)
{
foreach (var overlay in selectionSet)
{
if (overlay == focus)
{
DrawSelectionHandles(renderContext, overlay, FocusHandles);
}
else
{
DrawSelectionHandles(renderContext, overlay, MultiSelectHandles);
}
}
}
else
{
foreach (var overlay in selectionSet)
{
DrawSelectionHandles(renderContext, overlay, SingleSelectHandles);
}
}
}
开发者ID:bluephoton,项目名称:wwt-windows-client,代码行数:43,代码来源:Selection.cs
示例6: CreateGeometry
public override bool CreateGeometry(RenderContext11 renderContext, bool uiThread)
{
if (texture == null)
{
if (this.texture == null)
{
if (TextureReady)
{
texture = BufferPool11.GetTexture(FileName);
double aspect = (double)texture.Width / (double)texture.Height;
if (aspect < 1.5)
{
domeMaster = true;
}
}
else
{
return false;
}
}
iTileBuildCount++;
if (vertexBuffer == null)
{
vertexBuffer = new VertexBuffer11(typeof(PositionNormalTexturedX2), VertexCount, RenderContext11.PrepDevice);
indexBuffer = new IndexBuffer11[4];
OnCreateVertexBuffer(vertexBuffer);
sphereRadius = 1;
sphereCenter = new Vector3d(0, 0, 0);
}
}
ReadyToRender = true;
return true;
}
开发者ID:ngonzalezromero,项目名称:wwt-windows-client,代码行数:40,代码来源:SphericalTile.cs
示例7: DrawSelectionHandles
private void DrawSelectionHandles(RenderContext11 renderContext, Overlay overlay, Texture11 handleTexture)
{
var handles = MakeHandles(overlay);
var angle = overlay.RotationAngle;
var i = 0;
var j = 0;
foreach (var handle in handles)
{
points[i + 0].Position = overlay.MakePosition(centerX, centerY, handle.Left - centerX, handle.Top - centerY, angle).Vector4;
points[i + 0].Tu = j * (1f / 9f);
points[i + 0].Tv = 0;
points[i + 0].Color = Color.White;
points[i + 1].Position = overlay.MakePosition(centerX, centerY, handle.Right - centerX, handle.Top - centerY, angle).Vector4;
points[i + 1].Tu = (j + 1) * (1f / 9f);
points[i + 1].Tv = 0;
points[i + 1].Color = Color.White;
points[i + 2].Position = overlay.MakePosition(centerX, centerY, handle.Left - centerX, handle.Bottom - centerY, angle).Vector4;
points[i + 2].Tu = j * (1f / 9f);
points[i + 2].Tv = 1;
points[i + 2].Color = Color.White;
points[i + 3].Position = overlay.MakePosition(centerX, centerY, handle.Right - centerX, handle.Top - centerY, angle).Vector4;
points[i + 3].Tu = (j + 1) * (1f / 9f);
points[i + 3].Tv = 0;
points[i + 3].Color = Color.White;
points[i + 4].Position = overlay.MakePosition(centerX, centerY, handle.Right - centerX, handle.Bottom - centerY, angle).Vector4;
points[i + 4].Tu = (j + 1) * (1f / 9f);
points[i + 4].Tv = 1;
points[i + 4].Color = Color.White;
points[i + 5].Position = overlay.MakePosition(centerX, centerY, handle.Left - centerX, handle.Bottom - centerY, angle).Vector4;
points[i + 5].Tu = j * (1f / 9f);
points[i + 5].Tv = 1;
points[i + 5].Color = Color.White;
i += 6;
j++;
}
if (MultiSelect)
{
Sprite2d.Draw(renderContext, points, points.Length - 6, handleTexture, PrimitiveTopology.TriangleList);
}
else
{
Sprite2d.Draw(renderContext, points, points.Length, handleTexture, PrimitiveTopology.TriangleList);
}
}
开发者ID:bluephoton,项目名称:wwt-windows-client,代码行数:52,代码来源:Selection.cs
示例8: Draw
public void Draw(RenderContext11 renderContext, float opacity, Color color)
{
if (glyphCache == null || glyphCache.Version > glyphVersion)
{
PrepareBatch();
}
Color col = Color.FromArgb((int)(color.A * opacity), (int)(color.R * opacity), (int)(color.G * opacity), (int)(color.B * opacity));
SimpleGeometryShader11.Color = col;
SharpDX.Matrix mat = (renderContext.World * renderContext.View * renderContext.Projection).Matrix11;
mat.Transpose();
SimpleGeometryShader11.WVPMatrix = mat;
renderContext.setRasterizerState(TriangleCullMode.CullCounterClockwise);
BlendMode bm = renderContext.BlendMode;
DepthStencilMode dm = renderContext.DepthStencilMode;
//renderContext.DepthStencilMode = DepthStencilMode.ZReadOnly;
renderContext.BlendMode = BlendMode.Alpha;
SimpleGeometryShader11.Use(renderContext.devContext);
renderContext.MainTexture = glyphCache.Texture;
// Debug to get Glyhph textures and caches
// SharpDX.Direct3D11.Texture2D.ToFile(renderContext.devContext, glyphCache.Texture.Texture, SharpDX.Direct3D11.ImageFileFormat.Png, "c:\\temp\\texture2.png");
renderContext.devContext.InputAssembler.PrimitiveTopology = SharpDX.Direct3D.PrimitiveTopology.TriangleList;
renderContext.SetVertexBuffer(vertexBuffer);
renderContext.devContext.Draw(vertexBuffer.Count, 0);
renderContext.DepthStencilMode = dm;
renderContext.BlendMode = bm;
//dump cache
// glyphCache.SaveToXML("c:\\temp\\glyphCache.xml");
}
开发者ID:china-vo,项目名称:wwt-windows-client,代码行数:43,代码来源:SkyText.cs
示例9: Draw
public override bool Draw(RenderContext11 renderContext, float opacity, bool flat)
{
var matSaved = renderContext.World;
renderContext.World = renderContext.WorldBaseNonRotating;
foreach (var frame in frames)
{
if (frame.ShowOrbitPath)
{
if (frame.Orbit == null)
{
frame.Orbit = new Orbit(frame.Elements, 360, Color, 1, (float)renderContext.NominalRadius);
}
frame.Orbit.Draw3D(renderContext, opacity * Opacity, new Vector3d(0, 0, 0));
}
}
renderContext.World = matSaved;
return true;
}
开发者ID:bluephoton,项目名称:wwt-windows-client,代码行数:19,代码来源:OrbitLayer.cs
示例10: DrawLabels
public void DrawLabels(RenderContext11 renderContext)
{
if (positions.Count < 1)
{
return;
}
InitLabelBuffer();
renderContext.SetVertexBuffer(labelBuffer);
renderContext.BlendMode = BlendMode.Alpha;
renderContext.DepthStencilMode = DepthStencilMode.Off;
renderContext.setRasterizerState(TriangleCullMode.Off);
var mvp = (renderContext.World * renderContext.View * renderContext.Projection).Matrix11;
mvp.Transpose();
PointSpriteShader11.WVPMatrix = mvp;
PointSpriteShader11.Color = SharpDX.Color.White;
var adjustedScale = .01f; // (float)(1 / (Earth3d.MainWindow.ZoomFactor / 360));
PointSpriteShader11.ViewportScale = new Vector2((2.0f / renderContext.ViewPort.Width) * adjustedScale, (2.0f / renderContext.ViewPort.Height) * adjustedScale);
PointSpriteShader11.PointScaleFactors = new Vector3(0.0f, 0.0f, 10000.0f);
PointSpriteShader11.Use(renderContext.Device.ImmediateContext);
renderContext.Device.ImmediateContext.PixelShader.SetShaderResource(0, texture.ResourceView);
renderContext.devContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.PointList;
renderContext.devContext.Draw(labelBuffer.Count, 0);
renderContext.Device.ImmediateContext.GeometryShader.Set(null);
}
开发者ID:bluephoton,项目名称:wwt-windows-client,代码行数:30,代码来源:Label.cs
示例11: Draw
internal void Draw(RenderContext11 renderContext)
{
if (reticleImage == null)
{
reticleImage = Texture11.FromBitmap(Properties.Resources.Reticle);
}
ComputePoints();
Sprite2d.Draw(renderContext, points, 4, reticleImage, SharpDX.Direct3D.PrimitiveTopology.TriangleStrip);
}
开发者ID:ngonzalezromero,项目名称:wwt-windows-client,代码行数:11,代码来源:Reticle.cs
示例12: RenderPart
public override void RenderPart(RenderContext11 renderContext, int part, float opacity, bool combine)
{
if (dsm != null && dsm.DsmIndex != null)
{
renderContext.SetIndexBuffer(dsm.DsmIndex);
renderContext.SetVertexBuffer(dsm.VertexBuffer);
if (dsm.Subsets.Length > 4)
{
switch (part)
{
case 0:
part = 2;
break;
case 1:
part = 3;
// return;
break;
case 2:
part = 0;
break;
case 3:
part = 1;
break;
}
renderContext.devContext.DrawIndexed(dsm.Subsets[part + 1] - dsm.Subsets[part], dsm.Subsets[part], 0);
}
else
{
if (dsm.Subsets.Length > 0)
{
renderContext.devContext.DrawIndexed(dsm.Subsets[0] , 0, 0);
}
}
}
else
{
base.RenderPart(renderContext, part, opacity, combine);
}
}
开发者ID:bluephoton,项目名称:wwt-windows-client,代码行数:44,代码来源:MercatorTile.cs
示例13: Draw2D
public static void Draw2D(RenderContext11 renderContext, Texture11 srcTexture, SizeF size, PointF rotationCenter, float rotationAngle, PointF position, System.Drawing.Color color)
{
cornerPoints[0].Position = MakePosition(position.X, position.Y, -size.Width / 2, -size.Height / 2, rotationAngle).Vector4;
cornerPoints[0].Tu = 0;
cornerPoints[0].Tv = 0;
cornerPoints[0].Color = color;
cornerPoints[1].Position = MakePosition(position.X, position.Y, size.Width / 2, -size.Height / 2, rotationAngle).Vector4;
cornerPoints[1].Tu = 1;
cornerPoints[1].Tv = 0;
cornerPoints[1].Color = color;
cornerPoints[2].Position = MakePosition(position.X, position.Y, -size.Width / 2, size.Height / 2, rotationAngle).Vector4;
cornerPoints[2].Tu = 0;
cornerPoints[2].Tv = 1;
cornerPoints[2].Color = color;
cornerPoints[3].Position = MakePosition(position.X, position.Y, size.Width / 2, size.Height / 2, rotationAngle).Vector4;
cornerPoints[3].Tu = 1;
cornerPoints[3].Tv = 1;
cornerPoints[3].Color = color;
renderContext.setRasterizerState(TriangleCullMode.Off);
renderContext.DepthStencilMode = DepthStencilMode.Off;
DrawForScreen(renderContext, cornerPoints, 4, srcTexture, SharpDX.Direct3D.PrimitiveTopology.TriangleStrip);
}
开发者ID:china-vo,项目名称:wwt-windows-client,代码行数:26,代码来源:Sprite2d.cs
示例14: Draw
public void Draw(RenderContext11 renderContext, bool space3d)
{
var cam = Vector3d.TransformCoordinate(Earth3d.MainWindow.RenderContext11.CameraPosition, Matrix3d.Invert(Earth3d.WorldMatrix));
if (!space3d)
{
if (Vector3d.Dot(cam, pos) < 0)
{
return;
}
}
var temp = pos;
if (Earth3d.MainWindow.SolarSystemMode)
{
temp.Add( Earth3d.MainWindow.viewCamera.ViewTarget);
}
var wvp = renderContext.World * renderContext.View * renderContext.Projection;
var screenPos = Vector3.Project(temp.Vector311, renderContext.ViewPort.TopLeftX, renderContext.ViewPort.TopLeftY,renderContext.ViewPort.Width,renderContext.ViewPort.Height, 0, 1, wvp.Matrix11);
// Get the w component of the transformed object position; if it's negative the
// object is behind the viewer.
var w = wvp.M14 * temp.X + wvp.M24 * temp.Y + wvp.M34 * temp.Z + wvp.M44;
if (w < 0.0 && Earth3d.MainWindow.SolarSystemMode)
{
// Don't show labels that are behind the viewer
return;
}
screenPos = new Vector3((int)screenPos.X, (int)screenPos.Y, 1);
Sprite2d.Draw2D(renderContext, texture, new SizeF(20, 20), new PointF(0, 0), 0, new PointF(screenPos.X, screenPos.Y), Color.White);
if (Earth3d.MainWindow.SolarSystemMode || Style == LabelSytle.Telrad)
{
var worldMatrix = renderContext.World;
var viewMatrix = renderContext.View;
var projectionMatrix = renderContext.Projection;
var labelScale = Earth3d.MainWindow.SolarSystemMode ? 8.0 : 30.0;
renderContext.World =
Matrix3d.Scaling(labelScale, labelScale, 1.0) *
Matrix3d.Translation(screenPos.X + 10.0, -screenPos.Y, 0.0) *
Matrix3d.Translation(-renderContext.ViewPort.Width / 2, renderContext.ViewPort.Height / 2, 0);
renderContext.View = Matrix3d.Identity;
renderContext.Projection = Matrix3d.OrthoLH(renderContext.ViewPort.Width, renderContext.ViewPort.Height, 1, -1);
renderContext.BlendMode = BlendMode.PremultipliedAlpha;
textBatch.Draw(renderContext, 1, Color.White);
renderContext.World = worldMatrix;
renderContext.View = viewMatrix;
renderContext.Projection = projectionMatrix;
}
else
{
renderContext.BlendMode = BlendMode.PremultipliedAlpha;
textBatch.Draw(renderContext, 1, Color.White);
}
//todo11 Implement this
//sprite.Begin(SpriteFlags.AlphaBlend | SpriteFlags.SortTexture);
//sprite.Draw(texture, rect, center, screenPos, Color.White);
//Rectangle recttext = new Rectangle((int)(screenPos.X + 15), (int)(screenPos.Y - 8), 0, 0);
//Earth3d.MainWindow.labelFont.DrawText(sprite, Text, recttext,
//DrawTextFormat.NoClip, System.Drawing.Color.White);
//sprite.End();
}
开发者ID:bluephoton,项目名称:wwt-windows-client,代码行数:72,代码来源:Label.cs
示例15: SkyLabel
public SkyLabel(RenderContext11 renderContext, Vector3d point, string text, LabelSytle style)
{
Text = text;
Style = style;
if (texture == null)
{
texture = Texture11.FromBitmap(Resources.circle, 0);
}
pos = point;
center = new Vector3(9, 9, 0);
textBatch = new Text3dBatch(80);
if (style == LabelSytle.Telrad)
{
// Telrad-style labels are always screen-aligned
var t3 = new Text3d(new Vector3d(0, 0, 0.1), new Vector3d(0, 1, 0), text, 20, .01);
t3.alignment = Text3d.Alignment.Left;
textBatch.Add(t3);
}
else
{
// This will produce sky or orbit aligned text
textBatch.Add(new Text3d(pos, new Vector3d(0,1,0), text, 20, .01));
}
}
开发者ID:bluephoton,项目名称:wwt-windows-client,代码行数:29,代码来源:Label.cs
示例16: SetupGroundOverlays
// Set up render context state required for drawing ground overlays when shaders
// are enabled.
public void SetupGroundOverlays(RenderContext11 renderContext)
{
// A shader should be set up already
if (renderContext.Shader == null)
{
renderContext.SetupBasicEffect(BasicEffect.TextureOnly, 1.0f, Color.White);
}
// Count the number of overlays so that we can choose the appropriate shader
var overlayCount = 0;
foreach (var overlay in GroundOverlays)
{
if (overlay.Icon.Texture != null)
{
++overlayCount;
}
}
overlayCount = Math.Min(PlanetShader11.MaxOverlayTextures, overlayCount);
if (overlayCount == 0)
{
// No work to do
return;
}
// Get a shader identical to the one currently in use, but which supports
// the required number of overlays.
var key = renderContext.Shader.Key;
key.overlayTextureCount = overlayCount;
var overlayShader = PlanetShader11.GetPlanetShader(renderContext.Device, key);
renderContext.Shader = overlayShader;
renderContext.Shader.DiffuseColor = new Vector4(1.0f, 1.0f, 1.0f, 1.0f);
var devContext = renderContext.Device.ImmediateContext;
var overlayIndex = 0;
foreach (var overlay in GroundOverlays)
{
var texture = overlay.Icon.Texture;
if ( texture != null)
{
if (overlayIndex < PlanetShader11.MaxOverlayTextures)
{
renderContext.Shader.SetOverlayTextureMatrix(overlayIndex, overlay.GetMatrix().Matrix11);
renderContext.Shader.SetOverlayTextureColor(overlayIndex, overlay.color);
renderContext.Shader.SetOverlayTexture(overlayIndex, texture.ResourceView);
}
++overlayIndex;
}
}
}
开发者ID:bluephoton,项目名称:wwt-windows-client,代码行数:51,代码来源:Label.cs
示例17: PreCreateGeometry
public override bool PreCreateGeometry(RenderContext11 renderContext)
{
if (Properties.Settings.Default.Show3dCities)
{
// Conditionalsupport for 3d Cities based on settings
dsm = new DSMTile();
var center = new Vector3d();
double radius = 0;
if (dsm != null)
{
texture = dsm.LoadMeshFile(filename, localCenter, out center, out radius);
}
if (texture != null)
{
sphereCenter = center;
sphereRadius = radius;
return true;
}
}
return false;
}
开发者ID:bluephoton,项目名称:wwt-windows-client,代码行数:22,代码来源:MercatorTile.cs
示例18: Draw
public override bool Draw(RenderContext11 renderContext, float opacity, bool flat)
{
if (RetainedVisualsDirty)
{
UpdateRetainedVisuals();
RetainedVisualsDirty = false;
}
triangles.Draw(renderContext, opacity, TriangleList.CullMode.Clockwise);
lines.DrawLines(renderContext, opacity);
DrawPlaceMarks();
DrawScreenOverlays(renderContext);
return true;
}
开发者ID:ngonzalezromero,项目名称:wwt-windows-client,代码行数:14,代码来源:KmlLayer.cs
示例19: DrawAll
internal static void DrawAll(RenderContext11 rendercontext)
{
foreach (Reticle reticle in Reticles.Values)
{
if (reticle.Visible.State)
{
reticle.Draw(rendercontext);
}
}
}
开发者ID:ngonzalezromero,项目名称:wwt-windows-client,代码行数:10,代码来源:Reticle.cs
示例20: PreDraw
public override bool PreDraw(RenderContext11 renderContext, float opacity)
{
SetupGroundOverlays(renderContext);
return true;
}
开发者ID:ngonzalezromero,项目名称:wwt-windows-client,代码行数:5,代码来源:KmlLayer.cs
注:本文中的TerraViewer.RenderContext11类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论