/// <summary> /// Iniciar shaders comunes /// </summary> public void loadCommonShaders() { Device d3dDevice = GuiController.Instance.D3dDevice; //Cargar shaders genericos para todo el framework string shadersPath = GuiController.Instance.ExamplesMediaDir + "Shaders\\TgcViewer\\"; this.tgcMeshShader = TgcShaders.loadEffect(shadersPath + "TgcMeshShader.fx"); this.tgcMeshPhongShader = TgcShaders.loadEffect(shadersPath + "TgcMeshPhongShader.fx"); this.tgcMeshPointLightShader = TgcShaders.loadEffect(shadersPath + "TgcMeshPointLightShader.fx"); this.tgcMeshSpotLightShader = TgcShaders.loadEffect(shadersPath + "TgcMeshSpotLightShader.fx"); this.tgcSkeletalMeshShader = TgcShaders.loadEffect(shadersPath + "TgcSkeletalMeshShader.fx"); this.tgcSkeletalMeshPointLightShader = TgcShaders.loadEffect(shadersPath + "TgcSkeletalMeshPointLightShader.fx"); this.tgcKeyFrameMeshShader = TgcShaders.loadEffect(shadersPath + "TgcKeyFrameMeshShader.fx"); this.variosShader = TgcShaders.loadEffect(shadersPath + "Varios.fx"); //Crear vertexDeclaration comunes this.vdecPositionColoredTextured = new VertexDeclaration(d3dDevice, TgcShaders.PositionColoredTextured_VertexElements); this.vdecPositionTextured = new VertexDeclaration(d3dDevice, TgcShaders.PositionTextured_VertexElements); this.vdecPositionColored = new VertexDeclaration(d3dDevice, TgcShaders.PositionColored_VertexElements); }
/// <summary> /// Crea todos los modulos necesarios de la aplicacion /// </summary> internal void initGraphics(MainForm mainForm, Control panel3d) { this.mainForm = mainForm; this.panel3d = panel3d; this.fullScreenPanel = new FullScreenPanel(); panel3d.Focus(); //Iniciar graficos this.tgcD3dDevice = new TgcD3dDevice(panel3d); this.texturesManager = new TgcTexture.Manager(); this.tgcD3dDevice.OnResetDevice(tgcD3dDevice.D3dDevice, null); //Iniciar otras herramientas this.texturesPool = new TgcTexture.Pool(); this.logger = new Logger(mainForm.LogConsole); this.text3d = new TgcDrawText(tgcD3dDevice.D3dDevice); this.tgcD3dInput = new TgcD3dInput(mainForm, panel3d); this.fpsCamera = new TgcFpsCamera(); this.rotCamera = new TgcRotationalCamera(); this.thirdPersonCamera = new TgcThirdPersonCamera(); this.axisLines = new TgcAxisLines(tgcD3dDevice.D3dDevice); this.userVars = new TgcUserVars(mainForm.getDataGridUserVars()); this.modifiers = new TgcModifiers(mainForm.getModifiersPanel()); this.elapsedTime = -1; this.frustum = new TgcFrustum(); this.mp3Player = new TgcMp3Player(); this.directSound = new TgcDirectSound(); this.fog = new TgcFog(); this.currentCamera = this.rotCamera; this.customRenderEnabled = false; this.drawer2D = new TgcDrawer2D(); this.shaders = new TgcShaders(); //toogles this.rotCamera.Enable = true; this.fpsCamera.Enable = false; this.thirdPersonCamera.Enable = false; this.fpsCounterEnable = true; this.axisLines.Enable = true; //Cargar algoritmos exampleLoader = new ExampleLoader(); examplesDir = System.Environment.CurrentDirectory + "\\" + ExampleLoader.EXAMPLES_DIR + "\\"; examplesMediaDir = examplesDir + "Media" + "\\"; alumnoEjemplosDir = System.Environment.CurrentDirectory + "\\" + "AlumnoEjemplos" + "\\"; alumnoEjemplosMediaDir = alumnoEjemplosDir + "AlumnoMedia" + "\\"; exampleLoader.loadExamplesInGui(mainForm.TreeViewExamples, new string[] { examplesDir, alumnoEjemplosDir }); //Cargar shaders del framework this.shaders.loadCommonShaders(); //Cargar ejemplo default TgcExample defaultExample = exampleLoader.getExampleByName(mainForm.Config.defaultExampleName, mainForm.Config.defaultExampleCategory); executeExample(defaultExample); }