当前位置: 首页>>代码示例>>C#>>正文


C# Vector3d.Add方法代码示例

本文整理汇总了C#中TerraViewer.Vector3d.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3d.Add方法的具体用法?C# Vector3d.Add怎么用?C# Vector3d.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TerraViewer.Vector3d的用法示例。


在下文中一共展示了Vector3d.Add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SkyLabel

        public SkyLabel(RenderContext11 renderContext, double ra, double dec, string text, LabelSytle style, double distance)
        {
            RA = ra;
            Dec = dec;
            Text = text;
            Style = style;

            Distance = distance;

            if (texture == null)
            {
                texture = Texture11.FromBitmap(Resources.circle, 0);
            }

            var up = new Vector3d();
            var textPos = new Vector3d();
            if (Earth3d.MainWindow.SolarSystemMode)
            {
                pos = Coordinates.RADecTo3d(ra, -dec, distance);
                up = Coordinates.RADecTo3d(ra, -dec + 90, distance);

                pos.RotateX(Coordinates.MeanObliquityOfEcliptic(SpaceTimeController.JNow) / 180.0 * Math.PI);
                pos.Add(Planets.GetPlanet3dLocation(SolarSystemObjects.Earth));

                up.RotateX(Coordinates.MeanObliquityOfEcliptic(SpaceTimeController.JNow) / 180.0 * Math.PI);
                up.Add(Planets.GetPlanet3dLocation(SolarSystemObjects.Earth));
               }
            else
            {
                pos = Coordinates.RADecTo3d(ra+12, dec, distance);
                textPos = Coordinates.RADecTo3d(ra + 12, dec + 2, distance);
                up = Coordinates.RADecTo3d(ra+12, dec + 92, distance);

            }
            center = new Vector3(9, 9, 0);

            textBatch = new Text3dBatch(24);
            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
            {
                up.Normalize();
                textPos.Normalize();
                textBatch.Add(new Text3d(textPos, up, text, 20, .0005));
            }
        }
开发者ID:bluephoton,项目名称:wwt-windows-client,代码行数:51,代码来源:Label.cs

示例2: InitLineBuffer

        void InitLineBuffer()
        {
            if (lineBuffers.Count == 0)
            {
                int count = linePoints.Count;

                TimeSeriesLineVertexBuffer11 lineBuffer = null;

                TimeSeriesLineVertex[] linePointList = null;
                localCenter = new Vector3d();
                if (DepthBuffered)
                {
                    // compute the local center..
                    foreach (Vector3d point in linePoints)
                    {
                        localCenter.Add(point);

                    }
                    localCenter.X /= count;
                    localCenter.Y /= count;
                    localCenter.Z /= count;
                }

                int countLeft = count;
                int index = 0;
                int counter = 0;
                Vector3d temp;

                foreach (Vector3d point in linePoints)
                {
                    if (counter >= 100000 || linePointList == null)
                    {
                        if (lineBuffer != null)
                        {
                            lineBuffer.Unlock();
                        }
                        int thisCount = Math.Min(100000, countLeft);

                        countLeft -= thisCount;
                        lineBuffer = new TimeSeriesLineVertexBuffer11(thisCount, RenderContext11.PrepDevice);

                        linePointList = (TimeSeriesLineVertex[])lineBuffer.Lock(0, 0); // Lock the buffer (which will return our structs)

                        lineBuffers.Add(lineBuffer);
                        lineBufferCounts.Add(thisCount);
                        counter = 0;
                    }

                    temp = point - localCenter;
                    linePointList[counter].Position = temp.Vector311;
                    linePointList[counter].Normal = point.Vector311;
                    linePointList[counter].Tu = (float)lineDates[index / 2].StartDate;
                    linePointList[counter].Tv = (float)lineDates[index / 2].EndDate;
                    linePointList[counter].Color = lineColors[index / 2];
                    index++;
                    counter++;
                }

                lineBuffer.Unlock();

            }
        }
开发者ID:china-vo,项目名称:wwt-windows-client,代码行数:62,代码来源:Primitives3d.cs

示例3: CreateGeometry


//.........这里部分代码省略.........
            {
                if (PreCreateGeometry(renderContext))
                {
                    ReadyToRender = true;
                    TextureReady = true;
                    blendMode = false;
                    if (DemEnabled && DemReady && DemData == null)
                    {
                        if (!LoadDemData())
                        {
                            if (Earth3d.Logging) { Earth3d.WriteLogMessage("Tile:CreateGeometry:Loading Dem Failed"); }
                            return false;
                        }
                    }
                    return true;
                }

                blendMode = (dataset.DataSetType == ImageSetType.Sky || dataset.DataSetType == ImageSetType.Panorama) && !Settings.DomeView;
                //blendMode = false;
                if (this.texture == null)
                {
                    if (TextureReady)
                    {
                        iTileBuildCount++;

                        string localFilename = FileName;
                        if (GrayscaleStyle)
                        {
                            localFilename = UiTools.MakeGrayScaleImage(localFilename);
                        }

                        if (FileExists)
                        {
                            if (Earth3d.Logging) { Earth3d.WriteLogMessage("Tile:CreateGeometry:Loading Texture"); }
                            texture = BufferPool11.GetTexture(localFilename);
                            if (texture == null)
                            {
                                try
                                {
                                    // bad texture
                                    TextureReady = false;
                                    File.Delete(localFilename);
                                }
                                catch
                                {
                                    if (Earth3d.Logging) { Earth3d.WriteLogMessage("Tile:CreateGeometry:Loading Texture: Exception"); }
                                    errored = true;
                                }
                                return false;
                            }
                        }
                        else
                        {
                            return false;
                        }

                        TexturesLoaded++;

                    }
                    else
                    {
                        return false;
                    }
                }

                if (DemEnabled  && DemReady && DemData == null)
                {
                    if (!LoadDemData())
                    {
                        if (Earth3d.Logging) { Earth3d.WriteLogMessage("Tile:CreateGeometry:Loading Dem Failed"); }
                        return false;
                    }
                }

                if (DemEnabled && DemData == null)
                {
                    return false;
                }
            }

            if (vertexBuffer == null)
            {
                vertexBuffer = BufferPool11.GetPNTX2VertexBuffer(VertexCount);
                vertexBuffer.ComputeSphereOnUnlock = true;
                indexBuffer = new IndexBuffer11[4];

                if (vertexBuffer != null)
                {
                    this.OnCreateVertexBuffer(vertexBuffer);

                    sphereRadius = vertexBuffer.SphereRadius;
                    sphereCenter = vertexBuffer.SphereCenter;
                    sphereCenter.Add(localCenter);
                }

            }

            ReadyToRender = true;
            return true;
        }
开发者ID:china-vo,项目名称:wwt-windows-client,代码行数:101,代码来源:Tile.cs


注:本文中的TerraViewer.Vector3d.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。