• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# TgcGeometry.TgcBoundingBox类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中TgcViewer.Utils.TgcGeometry.TgcBoundingBox的典型用法代码示例。如果您正苦于以下问题:C# TgcBoundingBox类的具体用法?C# TgcBoundingBox怎么用?C# TgcBoundingBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TgcBoundingBox类属于TgcViewer.Utils.TgcGeometry命名空间,在下文中一共展示了TgcBoundingBox类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: init

        public override void init()
        {
            Microsoft.DirectX.Direct3D.Device d3dDevice = GuiController.Instance.D3dDevice;

            //Cuerpo principal que se controla con el teclado
            box = TgcBox.fromSize(new Vector3(0, 10, 0), new Vector3(10, 10, 10), Color.Blue);

            //triangulo
            triangle = new CustomVertex.PositionColored[3];
            triangle[0] = new CustomVertex.PositionColored(-100, 0, 0, Color.Red.ToArgb());
            triangle[1] = new CustomVertex.PositionColored(0, 0, 50, Color.Green.ToArgb());
            triangle[2] = new CustomVertex.PositionColored(0, 100, 0, Color.Blue.ToArgb());
            triagleAABB = TgcBoundingBox.computeFromPoints(new Vector3[] { triangle[0].Position, triangle[1].Position, triangle[2].Position });

            //box2
            box2 = TgcBox.fromSize(new Vector3(-50, 10, -20), new Vector3(15, 15, 15), Color.Violet);

            //sphere
            sphere = new TgcBoundingSphere(new Vector3(30, 20, -20), 15);

            //OBB: computar OBB a partir del AABB del mesh.
            TgcSceneLoader loader = new TgcSceneLoader();
            TgcMesh meshObb = loader.loadSceneFromFile(GuiController.Instance.ExamplesMediaDir + "MeshCreator\\Meshes\\Vehiculos\\StarWars-ATST\\StarWars-ATST-TgcScene.xml").Meshes[0];
            obb = TgcObb.computeFromAABB(meshObb.BoundingBox);
            meshObb.dispose();
            obb.move(new Vector3(100, 0, 30));
            obb.setRotation(new Vector3(0, FastMath.PI / 4, 0));

            //Configurar camara en Tercer Persona
            GuiController.Instance.ThirdPersonCamera.Enable = true;
            GuiController.Instance.ThirdPersonCamera.setCamera(box.Position, 30, -75);
        }
开发者ID:JesusHerrera,项目名称:tgc-viewer,代码行数:32,代码来源:EjemploBoundingBoxTests.cs


示例2: crearOctree

        public OctreeNode crearOctree(List<TgcMesh> modelos, TgcBoundingBox sceneBounds)
        {
            OctreeNode rootNode = new OctreeNode();

            Vector3 pMax = sceneBounds.PMax;
            Vector3 pMin = sceneBounds.PMin;

            //Calcular punto medio y centro
            Vector3 midSize = sceneBounds.calculateAxisRadius();
            Vector3 center = sceneBounds.calculateBoxCenter();

            //iniciar generacion recursiva de octree
            doSectorOctreeX(rootNode, center, midSize, 0, modelos);

            //podar nodos innecesarios
            deleteEmptyNodes(rootNode.children);

            //eliminar hijos que subdividen sin necesidad
            //deleteSameMeshCountChilds(rootNode);

            //imprimir por consola el octree
            //printDebugOctree(rootNode);

            //imprimir estadisticas de debug
            //printEstadisticasOctree(rootNode);

            return rootNode;
        }
开发者ID:aniPerezG,项目名称:barbalpha,代码行数:28,代码来源:OctreeBuilder.cs


示例3: Grid

        public Grid(MeshCreatorControl control)
        {
            this.control = control;

            //El bounding box del piso es bien grande para hacer colisiones
            boundingBox = new TgcBoundingBox(new Vector3(-BIG_VAL, -SMALL_VAL, -BIG_VAL), new Vector3(BIG_VAL, 0, BIG_VAL));

            //Planos para colision de picking
            pickingXZAabb = new TgcBoundingBox(new Vector3(-BIG_VAL, -SMALL_VAL, -BIG_VAL), new Vector3(BIG_VAL, 0, BIG_VAL));
            pickingXYAabb = new TgcBoundingBox(new Vector3(-BIG_VAL, -BIG_VAL, -SMALL_VAL), new Vector3(BIG_VAL, BIG_VAL, 0));
            pickingYZAabb = new TgcBoundingBox(new Vector3(-SMALL_VAL, -BIG_VAL, -BIG_VAL), new Vector3(0, BIG_VAL, BIG_VAL));

            vertices = new CustomVertex.PositionColored[12 * 2 * 2];
            int color = Color.FromArgb(76, 76, 76).ToArgb();

            //10 lineas horizontales en X
            for (int i = 0; i < 11; i++)
            {
                vertices[i * 2] = new CustomVertex.PositionColored(-GRID_RADIUS, 0, -GRID_RADIUS + LINE_SEPARATION * i, color);
                vertices[i * 2 + 1] = new CustomVertex.PositionColored(GRID_RADIUS, 0, -GRID_RADIUS + LINE_SEPARATION * i, color);
            }

            //10 lineas horizontales en Z
            for (int i = 11; i < 22; i++)
            {
                vertices[i * 2] = new CustomVertex.PositionColored(-GRID_RADIUS * 3 + LINE_SEPARATION * i - LINE_SEPARATION, 0, -GRID_RADIUS, color);
                vertices[i * 2 + 1] = new CustomVertex.PositionColored(-GRID_RADIUS * 3 + LINE_SEPARATION * i - LINE_SEPARATION, 0, GRID_RADIUS, color);
            }
        }
开发者ID:JesusHerrera,项目名称:tgc-viewer,代码行数:29,代码来源:Grid.cs


示例4: fromBoundingBox

 /// <summary>
 /// Crear Collider a partir de BoundingBox.
 /// Crea el BoundingSphere del Collider.
 /// </summary>
 /// <param name="mesh">BoundingBox</param>
 /// <returns>Collider creado</returns>
 public static BoundingBoxCollider fromBoundingBox(TgcBoundingBox aabb)
 {
     BoundingBoxCollider collider = new BoundingBoxCollider();
     collider.aabb = aabb;
     collider.BoundingSphere = TgcBoundingSphere.computeFromPoints(aabb.computeCorners()).toClass();
     return collider;
 }
开发者ID:JesusHerrera,项目名称:tgc-viewer,代码行数:13,代码来源:BoundingBoxCollider.cs


示例5: TgcBox

        /// <summary>
        /// Crea una caja vacia
        /// </summary>
        public TgcBox()
        {
            Device d3dDevice = GuiController.Instance.D3dDevice;

            vertices = new CustomVertex.PositionColoredTextured[36];
            vertexBuffer = new VertexBuffer(typeof(CustomVertex.PositionColoredTextured), vertices.Length, d3dDevice,
                Usage.Dynamic | Usage.WriteOnly, CustomVertex.PositionColoredTextured.Format, Pool.Default);

            this.autoTransformEnable = true;
            this.transform = Matrix.Identity;
            this.translation = new Vector3(0,0,0);
            this.rotation = new Vector3(0,0,0);
            this.enabled = true;
            this.color = Color.White;
            this.alphaBlendEnable = false;
            this.uvOffset = new Vector2(0, 0);
            this.uvTiling = new Vector2(1, 1);

            //BoundingBox
            boundingBox = new TgcBoundingBox();

            //Shader
            this.effect = GuiController.Instance.Shaders.VariosShader;
            this.technique = TgcShaders.T_POSITION_COLORED;
        }
开发者ID:JesusHerrera,项目名称:tgc-viewer,代码行数:28,代码来源:TgcBox.cs


示例6: EscenarioManager

        public EscenarioManager()
        {
            EscenarioManager.Instance = this;

            sonido = SoundManager.getInstance();
            arboles = new List<TgcMesh>();
            pasto = new List<TgcMesh>();
            barriles = new List<Barril>();
            loader = new TgcSceneLoader();

            casillasPorEje = 50;
            divisionesPiso = new Vector3[2500];
            _random = new Random();

            piso = new TgcBox();
            piso.UVTiling = new Vector2(300, 300);
            pisoSize = (int) tamanio;
            piso.setPositionSize(new Vector3(0, 0, 0), new Vector3(pisoSize*2, 0, pisoSize*2));
            piso.updateValues();

            piso.setTexture(TgcTexture.createTexture(GuiController.Instance.D3dDevice, GuiController.Instance.AlumnoEjemplosMediaDir + "\\RenderMan\\texturas\\nieve.png"));

            generarSkyBox();

            colisionables = new List<TgcBoundingCylinder>();

            limites = new TgcBoundingBox(new Vector3(-tamanio, 0, -tamanio), new Vector3(tamanio, 5000, tamanio));

            GuiController.Instance.Modifiers.addInt("Viento en X", 0, 30, 5);
            GuiController.Instance.Modifiers.addInt("Viento en Z", 0, 30, 5);
        }
开发者ID:nicolasazrak,项目名称:RenderMan,代码行数:31,代码来源:EscenarioManager.cs


示例7: TgcSkeletalAnimation

 public TgcSkeletalAnimation(string name, int frameRate, int framesCount, List<TgcSkeletalAnimationFrame>[] boneFrames, TgcBoundingBox boundingBox)
 {
     this.name = name;
     this.frameRate = frameRate;
     this.framesCount = framesCount;
     this.boneFrames = boneFrames;
     this.boundingBox = boundingBox;
 }
开发者ID:aniPerezG,项目名称:barbalpha,代码行数:8,代码来源:TgcSkeletalAnimation.cs


示例8: TgcPlaneWall

 /// <summary>
 /// Crea una pared vacia.
 /// </summary>
 public TgcPlaneWall()
 {
     this.vertices = new CustomVertex.PositionTextured[6];
     this.autoAdjustUv = false;
     this.enabled = true;
     this.boundingBox = new TgcBoundingBox();
     this.uTile = 1;
     this.vTile = 1;
     this.alphaBlendEnable = false;
     this.uvOffset = new Vector2(0, 0);
 }
开发者ID:faloi,项目名称:tegece,代码行数:14,代码来源:TgcPlaneWall.cs


示例9: SmartTerrain

        public SmartTerrain()
        {
            enabled = true;
            alphaBlendEnable = false;

            //Shader
            Effect = TgcShaders.loadEffect(GuiController.Instance.ExamplesDir + "TerrainEditor\\Shaders\\EditableTerrain.fx");
            Technique = "PositionColoredTextured";

            aabb = new TgcBoundingBox();
        }
开发者ID:RenderGroup,项目名称:PirateShip,代码行数:11,代码来源:SmartTerrain.cs


示例10: SmartTerrain

        public SmartTerrain()
        {
            enabled = true;
            alphaBlendEnable = false;

            //Shader
            //Effect = TgcShaders.loadEffect(GuiController.Instance.ExamplesDir + "TerrainEditor\\Shaders\\EditableTerrain.fx");
            //Effect = TgcShaders.loadEffect(GuiController.Instance.AlumnoEjemplosMediaDir + "shader_agua.fx");
            //Technique = "RenderAgua";//"PositionColoredTextured";

            aabb = new TgcBoundingBox();
        }
开发者ID:FunnyBoxification,项目名称:TGC,代码行数:12,代码来源:SmartTerrain.cs


示例11: SimpleTerrain

        public SimpleTerrain()
        {
            enabled = true;
            alphaBlendEnable = false;

            //BoundingBox
            boundingBox = new TgcBoundingBox();

            //Shader
            this.effect = GuiController.Instance.Shaders.VariosShader;
            this.technique = TgcShaders.T_POSITION_TEXTURED;
        }
开发者ID:javs,项目名称:Snipers-CEGA,代码行数:12,代码来源:SimpleTerrain.cs


示例12: init

        public override void init()
        {
            collider = new TgcFixedYBoundingCylinder(new Vector3(0, 0, 0), 3, 3);
            collisionableSphere = new TgcBoundingSphere(new Vector3(-6, 0, 0), 3);
            collisionableAABB = new TgcBoundingBox(new Vector3(4, 0, -1), new Vector3(6, 2, 1));
            collisionableCylinder = new TgcFixedYBoundingCylinder(new Vector3(0, 0, -6), 2, 2);

            GuiController.Instance.Modifiers.addVertex2f("size", new Vector2(1, 1), new Vector2(5, 10), new Vector2(2, 5));
            GuiController.Instance.Modifiers.addVertex3f("position", new Vector3(-20, -20, -20), new Vector3(20, 20, 20), new Vector3(0, 0, 0));

            collider.setRenderColor(Color.LimeGreen);
        }
开发者ID:JesusHerrera,项目名称:tgc-viewer,代码行数:12,代码来源:EjemploFixedYCylinder.cs


示例13: LightData

 public LightData(TgcMeshData meshData)
 {
     this.color = parserColor(meshData.userProperties["color"]);
             this.aabb = new TgcBoundingBox(TgcParserUtils.float3ArrayToVector3(meshData.pMin), TgcParserUtils.float3ArrayToVector3(meshData.pMax));
             this.pos = this.aabb.calculateBoxCenter();
             this.spot = meshData.userProperties["esSpot"].Equals("SI");
             this.direccion = convertirDireccion(meshData.userProperties["dir"]);
             this.intencidad = float.Parse(meshData.userProperties["inten"]);
             this.atenuacion = float.Parse(meshData.userProperties["atenua"])/10;
             this.angleCos = float.Parse(meshData.userProperties["angleCos"]);
             this.exp = float.Parse(meshData.userProperties["exp"]);
 }
开发者ID:pablitar,项目名称:tgc-mirrorball,代码行数:12,代码来源:LightData.cs


示例14: createDebugQuadtreeMeshes

        /// <summary>
        /// Dibujar meshes que representan los sectores del Quadtree
        /// </summary>
        public List<TgcDebugBox> createDebugQuadtreeMeshes(QuadtreeNode rootNode, TgcBoundingBox sceneBounds)
        {
            Vector3 pMax = sceneBounds.PMax;
            Vector3 pMin = sceneBounds.PMin;

            List<TgcDebugBox> debugBoxes = new List<TgcDebugBox>();
            doCreateQuadtreeDebugBox(rootNode, debugBoxes,
                pMin.X, pMin.Y, pMin.Z,
                pMax.X, pMax.Y, pMax.Z, 0);

            return debugBoxes;
        }
开发者ID:JesusHerrera,项目名称:tgc-viewer,代码行数:15,代码来源:QuadtreeBuilder.cs


示例15: create

        /// <summary>
        /// Crear una nueva grilla
        /// </summary>
        /// <param name="modelos">Modelos a contemplar</param>
        /// <param name="sceneBounds">Límites del escenario</param>
        public void create(List<TgcMesh> modelos, TgcBoundingBox sceneBounds)
        {
            this.modelos = modelos;
            this.sceneBounds = sceneBounds;

            //build
            grid = buildGrid(modelos, sceneBounds, new Vector3(CELL_WIDTH, CELL_HEIGHT, CELL_LENGTH));

            foreach (TgcMesh mesh in modelos)
            {
                mesh.Enabled = false;
            }
        }
开发者ID:aniPerezG,项目名称:barbalpha,代码行数:18,代码来源:GrillaRegular.cs


示例16: create

        /// <summary>
        /// Crear nuevo Quadtree
        /// </summary>
        /// <param name="modelos">Modelos a optimizar</param>
        /// <param name="sceneBounds">Límites del escenario</param>
        public void create(List<TgcMesh> modelos, TgcBoundingBox sceneBounds)
        {
            this.modelos = modelos;
            this.sceneBounds = sceneBounds;

            //Crear Quadtree
            this.quadtreeRootNode = builder.crearQuadtree(modelos, sceneBounds);

            //Deshabilitar todos los mesh inicialmente
            foreach (TgcMesh mesh in modelos)
            {
                mesh.Enabled = false;
            }
        }
开发者ID:julisalis,项目名称:2015-tgc-fps,代码行数:19,代码来源:Quadtree.cs


示例17: TerrainPatch

        public TerrainPatch(DivisibleTerrain father, CustomVertex.PositionTextured[] data, TgcBoundingBox bb)
        {
            this.father = father;
            totalVertices = data.Length;
            this.BoundingBox = bb;
            this.vbTerrainPatch  = new VertexBuffer(typeof(CustomVertex.PositionTextured), data.Length, GuiController.Instance.D3dDevice, Usage.Dynamic | Usage.WriteOnly, CustomVertex.PositionTextured.Format, Pool.Default);
            this.Effect = father.Effect;
            this.Technique = father.Technique;
            this.Enabled = father.Enabled;
            this.RenderBB = false;
            vbTerrainPatch.SetData(data, 0, LockFlags.None);

            
        }
开发者ID:Dkazarian,项目名称:TP-TGC-Commandos-ValePorUnNombreGeek,代码行数:14,代码来源:TerrainPatch.cs


示例18: ManejadorColisiones

        public ManejadorColisiones(Camara camara, List<TgcBoundingBox> obstEscenario)
        {
            this.fpsCamara = camara;

            velSalto = 80.0f;
            gravedad = 80.0f;

            velocidad = new Vector3();
            antCamPos = Vector3.Empty;
            time = 0;
            firstTime = true;
            jugadorPriPers = new TgcBoundingBox(new Vector3(-20, -60, -20), new Vector3(20, 20, 20));

            obstaculos = obstEscenario;
        }
开发者ID:JesusHerrera,项目名称:tgc-2015-2c-manaos-games,代码行数:15,代码来源:ManejadorColisiones.cs


示例19: TgcPlaneWall

        /// <summary>
        /// Crea una pared vacia.
        /// </summary>
        public TgcPlaneWall()
        {
            this.vertices = new CustomVertex.PositionTextured[6];
            this.autoAdjustUv = false;
            this.enabled = true;
            this.boundingBox = new TgcBoundingBox();
            this.uTile = 1;
            this.vTile = 1;
            this.alphaBlendEnable = false;
            this.uvOffset = new Vector2(0, 0);

            //Shader
            this.effect = GuiController.Instance.Shaders.VariosShader;
            this.technique = TgcShaders.T_POSITION_TEXTURED;
        }
开发者ID:JesusHerrera,项目名称:tgc-viewer,代码行数:18,代码来源:TgcPlaneWall.cs


示例20: Init

        public override void Init()
        {
            //seteamos atributos particulares de las naves
            health = 50;
            score = 2;
            tiempoMuerte = 5f;
            Device d3dDevice = GuiController.Instance.D3dDevice;
            MESH_SCALE = 0.5f;
            attackDamage = 50;
            MOVEMENT_SPEED = 225f;
            //cargamos el mesh
            //las naves no tienen skeletalMesh
            this.mesh = GameManager.Instance.ModeloNave.clone("Nave");

            SPAWN_HEIGHT = 1000f;
            giroInicial = Matrix.RotationY(0);

            //realizamos el init() comun a todos los enemigos
            base.Init();

            mesh.Effect = GameManager.Instance.envMap;
            mesh.Technique = "SimpleEnvironmentMapTechnique";
            mesh.Effect.SetValue("lightColor", ColorValue.FromColor(Color.White));
            mesh.Effect.SetValue("lightPosition", TgcParserUtils.vector3ToFloat4Array(new Vector3(0,1400,0)));
            mesh.Effect.SetValue("eyePosition", TgcParserUtils.vector3ToFloat4Array(CustomFpsCamera.Instance.getPosition()));
            mesh.Effect.SetValue("lightIntensity", 0.3f);
            mesh.Effect.SetValue("lightAttenuation", 1.0f);
            mesh.Effect.SetValue("reflection", 0.65f);

            //Cargar variables de shader de Material. El Material en realidad deberia ser propio de cada mesh. Pero en este ejemplo se simplifica con uno comun para todos
            mesh.Effect.SetValue("materialEmissiveColor", ColorValue.FromColor(Color.Black));
            mesh.Effect.SetValue("materialAmbientColor", ColorValue.FromColor(Color.White));
            mesh.Effect.SetValue("materialDiffuseColor", ColorValue.FromColor(Color.White));
            mesh.Effect.SetValue("materialSpecularColor", ColorValue.FromColor(Color.White));
            mesh.Effect.SetValue("materialSpecularExp", 9);

            mesh.Effect.SetValue("texCubeMap", GameManager.Instance.cubeMap);

            //creamos las boundingbox
            //a pesar de que las naves no tienen legs ni head, le seteamos boxes "vacias" para no tener problemas con Excepciones de null
            HEADSHOT_BOUNDINGBOX = new TgcBoundingBox();
            CHEST_BOUNDINGBOX = this.mesh.BoundingBox.clone();
            LEGS_BOUNDINGBOX = new TgcBoundingBox();
            //carga de sonido
            SonidoMovimiento = new Tgc3dSound(GuiController.Instance.AlumnoEjemplosMediaDir + "Los_Borbotones\\Audio\\Robot\\ufoHum.wav", getPosicionActual());
            SonidoMovimiento.MinDistance = 130f;
            SonidoMovimiento.play(true);
        }
开发者ID:SantiagoFoster,项目名称:AlumnoEjemplos,代码行数:48,代码来源:Enemy_lvl_2.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TgcSceneLoader.TgcMesh类代码示例发布时间:2022-05-26
下一篇:
C# Quest.Element类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap