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


C# Coords.GetCoord方法代码示例

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


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

示例1: ProcSubtree

    private void ProcSubtree(float tx0, float ty0, float tz0, float tx1, float ty1, float tz1, INode node,
		bool insideSolidNode, int currentDepth, int? wantedDepth,
		Coords nodeCoords)
    {
        if (!_intersectMultiple && results.Count > 0) {
            return;
        }

        if (tx1 < 0.0 || ty1 < 0.0 || tz1 < 0.0) {
            return;
        }

        if (_debug) {
            var entryDistance = Mathf.Max(tx0, ty0, tz0);

            Debug.DrawLine(_ray.origin, _ray.GetPoint(entryDistance), Color.red, 0, false);
        }

        if (wantedDepth == null) {
            if (node == null) {
                return;
            }

            if (node.IsSolid()) {
                ProcessTerminal(node, tx0, ty0, tz0);
                if (results.Count > 0) {
                    return;
                }
            }
        } else {
            if (!insideSolidNode) {
                //didn't manage to get into a solid node
                if (node == null) {
                    return;
                }

                insideSolidNode = node.IsSolid();
            }

            if (insideSolidNode && currentDepth >= wantedDepth) {
                if (currentDepth == wantedDepth) {
                    ProcessTerminal(nodeCoords, tx0, ty0, tz0);
                } else {
                    //oops, went too deep!!!
                    //trace back to wanted depth

                    var newCoords = new OctreeChildCoords[wantedDepth.Value];

                    for (var i = 0; i < newCoords.Length; ++i) {
                        newCoords[i] = nodeCoords.GetCoord(i);
                    }

                    ProcessTerminal(new Coords(newCoords), tx0, ty0,
                        tz0);
                }

                if (results.Count > 0) {
                    return;
                }
            }
        }

        if (_debug) {
            if (node != null) {
                var bounds = node.GetBounds();
                DrawBounds(bounds, Color.white);
            } else {
                //inside solid node and still going strong baby!
                var bounds = _rootNode.GetChildBounds(nodeCoords);
                DrawBounds(bounds, Color.cyan);
            }
        }

        var txm = 0.5f * (tx0 + tx1);
        var tym = 0.5f * (ty0 + ty1);
        var tzm = 0.5f * (tz0 + tz1);

        var currNode = FirstNode(tx0, ty0, tz0, txm, tym, tzm);

        while (currNode < 8) {
            var childIndex = (OctreeNode.ChildIndex) (currNode ^ _dimensionFlipFlags);
            if (!_intersectMultiple && results.Count > 0) {
                return;
            }

            var nextDepth = currentDepth + 1;
            var childCoords = new Coords(nodeCoords,
                OctreeChildCoords.FromIndex(childIndex));

            INode childNode;

            if (insideSolidNode) {
                childNode = null;
            } else {
                childNode = node.GetChild(childIndex);
            }

            switch (currNode) {
                //0= none
                //1 = only x
//.........这里部分代码省略.........
开发者ID:toxicFork,项目名称:vox,代码行数:101,代码来源:RayIntersection.cs


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