override public void initData(Mesh d3dMesh, string meshName, TgcMesh.MeshRenderType renderType) { normalDibujable = new TgcArrow(); normalDibujable.BodyColor = Color.Red; normalDibujable.HeadColor = Color.Yellow; normalDibujable.Thickness = 1f; normalDibujable.HeadSize = new Vector2(2, 5); base.initData(d3dMesh, meshName, renderType); }
/// <summary> /// Obtener technique default para un TgcMesh según su MeshRenderType /// </summary> /// <param name="renderType">MeshRenderType</param> /// <returns>Nombre del Technique que le corresponde</returns> public string getTgcMeshTechnique(TgcMesh.MeshRenderType renderType) { switch (renderType) { case TgcMesh.MeshRenderType.VERTEX_COLOR: return("VERTEX_COLOR"); case TgcMesh.MeshRenderType.DIFFUSE_MAP: return("DIFFUSE_MAP"); case TgcMesh.MeshRenderType.DIFFUSE_MAP_AND_LIGHTMAP: return("DIFFUSE_MAP_AND_LIGHTMAP"); } throw new Exception("RenderType incorrecto"); }
//metodo que usan los factory de TgcMesh new virtual public void initData(Mesh d3dMesh, string meshName, TgcMesh.MeshRenderType renderType) { base.initData(d3dMesh, meshName, renderType); }
public TgcMesh createNewMesh(Mesh d3dMesh, string meshName, TgcMesh.MeshRenderType renderType) { return(new MyCustomMesh(d3dMesh, meshName, renderType)); }
public TgcMesh createNewMesh(Mesh d3dMesh, string meshName, TgcMesh.MeshRenderType renderType) { return(new TgcMeshBumpMapping(d3dMesh, meshName, renderType)); }
/// <summary> /// Adaptar mesh de DirectX a mesh de TGC /// </summary> public TgcMesh CreateTgcMesh(BspMap bspMap, Mesh mesh, int surfaceId) { QSurface surface = bspMap.Data.drawSurfaces[surfaceId]; TgcTexture lightmap = surface.lightmapNum >= 0 ? lightMaps[surface.lightmapNum] : null; var texture = textures[surface.shaderNum]; //asigno el shader si es que tiene bspMap.Data.shaderXSurface[surfaceId] = shaderXTextura[surface.shaderNum]; if (bspMap.Data.shaderXSurface[surfaceId] != null) { bspMap.Data.shaderXSurface[surfaceId].BuildFx(); } if (texture == null && bspMap.Data.shaderXSurface[surfaceId] != null) { foreach (QShaderStage stage in bspMap.Data.shaderXSurface[surfaceId].Stages) { if (stage.Textures.Count > 0) { texture = stage.Textures[0]; break; } } } //Cargar lightMap TgcTexture tgcLightMap = lightmap; if (lightmap == null) { tgcLightMap = emptyLightMap; } TgcTexture[] meshTextures = new TgcTexture[1]; if (texture != null) { meshTextures[0] = texture; } else { meshTextures[0] = emptyTexture; } TgcMesh.MeshRenderType renderType = TgcMesh.MeshRenderType.DIFFUSE_MAP_AND_LIGHTMAP; Material mat = new Material(); mat.Ambient = Color.White; //Crear mesh de TGC TgcMesh tgcMesh = new TgcMesh(mesh, "mesh" + surfaceId, renderType); tgcMesh.Materials = new Material[] { mat }; tgcMesh.DiffuseMaps = meshTextures; tgcMesh.LightMap = tgcLightMap; tgcMesh.Enabled = true; tgcMesh.createBoundingBox(); return(tgcMesh); }
TgcMesh TgcSceneLoader.IMeshFactory.createNewMesh(Mesh d3dMesh, string meshName, TgcMesh.MeshRenderType renderType) { Colisionable mesh; switch (this.tipo) { case TipoElemento.BarcoProtagonista: mesh = new BarcoProtagonista(); break; case TipoElemento.BarcoEnemigo: mesh = new BarcoEnemigo(); break; case TipoElemento.BolaCanion: mesh = new BolaDeCanion(); break; default: throw new Exception("No existe ningun barco del tipo pedido"); //hacer esta excepcion mas espefica? } mesh.initData(d3dMesh, meshName, renderType); return((TgcMesh)mesh); }