本文整理汇总了C#中TgcViewer.Utils.TgcGeometry.TgcBoundingBox类的典型用法代码示例。如果您正苦于以下问题:C# TgcBoundingBox类的具体用法?C# TgcBoundingBox怎么用?C# TgcBoundingBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TgcBoundingBox类属于TgcViewer.Utils.TgcGeometry命名空间,在下文中一共展示了TgcBoundingBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例9: SmartTerrain
public SmartTerrain()
{
enabled = true;
alphaBlendEnable = false;
//Shader
Effect = TgcShaders.loadEffect(GuiController.Instance.ExamplesDir + "TerrainEditor\\Shaders\\EditableTerrain.fx");
Technique = "PositionColoredTextured";
aabb = new TgcBoundingBox();
}
示例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();
}
示例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;
}
示例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);
}
示例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"]);
}
示例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;
}
示例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;
}
}