コード例 #1
0
        public EscenaControles(TgcCamera Camera, string MediaDir, string ShadersDir, TgcText2D DrawText, float TimeBetweenUpdates, TgcD3dInput Input) : base(Camera, MediaDir, ShadersDir, DrawText, TimeBetweenUpdates, Input)
        {
            TgcScene escena = new TgcSceneLoader().loadSceneFromFile(MediaDir + "Cancha-TgcScene.xml");

            pasto   = new Pasto(escena.Meshes[0], TGCShaders.Instance.LoadEffect(ShadersDir + "CustomShaders.fx"), 32, .5f);
            paredes = escena.getMeshByName("Box_5");
            Camera.SetCamera(new TGCVector3(20, 10, -20), new TGCVector3(0, 5, -7));

            skyBox        = new TgcSkyBox();
            skyBox.Center = new TGCVector3(0, 500, 0);
            skyBox.Size   = new TGCVector3(10000, 10000, 10000);
            var texturesPath = MediaDir + "Textures\\SkyBox LostAtSeaDay\\";

            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "lostatseaday_up.jpg");
            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "lostatseaday_dn.jpg");
            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "lostatseaday_lf.jpg");
            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "lostatseaday_rt.jpg");
            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + "lostatseaday_bk.jpg");
            skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "lostatseaday_ft.jpg");
            skyBox.Init();

            unSprite        = new CustomSprite();
            unSprite.Bitmap = new CustomBitmap(MediaDir + "Textures\\Controles2.png", D3DDevice.Instance.Device);

            //unSprite.Scaling = new TGCVector2(unSprite.Bitmap.Width, unSprite.Bitmap.Height);
            unSprite.Position = new TGCVector2((float)D3DDevice.Instance.Width / 2 - unSprite.Bitmap.Width / 2, (float)D3DDevice.Instance.Height / 2 - unSprite.Bitmap.Height / 2);
        }
コード例 #2
0
        public FPSCamara(TgcCamera Camara, TgcD3dInput Input)
        {
            this.Camara = Camara;
            this.Input  = Input;

            this.ray = new TgcPickingRay(Input);
        }
コード例 #3
0
 public void init(string mediaDir, string shaderDir, TgcCamera camara)
 {
     inicio = new Boton("INICIO", 0f, 0.8f, () => AdministradorDeEscenarios.getSingleton().agregarEscenario(new nivelF1(), camara));
     //inicio = new Boton("INICIO", 0f, 0.8f, () => AdministradorDeEscenarios.getSingleton().agregarEscenario(new nivelPDP(), camara));
     sprite  = new Sprite(D3DDevice.Instance.Device);
     trustMe = TgcTexture.createTexture(D3DDevice.Instance.Device, mediaDir + "imgMenu.png");
 }
コード例 #4
0
 public void agregarEscenario(Escenario escenario, TgcCamera camara)
 {
     escenario.init(mediaDir, shaderDir, camara);
     escenarios.Add(escenario);
     escenarioSiguiente = escenarios.IndexOf(escenario);
     //proxima = scene;
 }
コード例 #5
0
 public BulletSharpManager(TGCVector3 initialPosition, TgcD3dInput input, TgcCamera camera, PlayerModel playerModel)
 {
     this.initialPosition = initialPosition;
     Input       = input;
     Camera      = camera;
     PlayerModel = playerModel;
 }
コード例 #6
0
        public LucesAuto(Auto auto, Ruedas r1, Ruedas r2, TgcCamera cam)
        {
            camara    = cam;
            lightMesh = TgcBox.fromSize(new Vector3(10, 10, 10), Color.Red);

            //lista para todos los meshes
            lstMeshes = new List <TgcMesh>();
            var scene = auto.ciudadScene;

            //agrego meshes del scene a la lista
            foreach (var mesh in scene.Meshes)
            {
                lstMeshes.Add(mesh);
            }

            //agrego auto
            //lstMeshes.Add(auto);


            //agrego ruedas
            lstMeshes.Add(r1.RuedaMeshDer);
            lstMeshes.Add(r1.RuedaMeshIzq);
            lstMeshes.Add(r2.RuedaMeshIzq);
            lstMeshes.Add(r2.RuedaMeshDer);
        }
コード例 #7
0
        public void Render(TgcCamera camera, TgcFrustum frustum)
        {
            var toRender = ToRender(camera.Position, frustum);
            var elements = new List <Element>();

            elements.AddRange(elementsToUpdate.FindAll(entity => entity.asCube().isIn(frustum)));

            elements.ForEach(element => {
                if (element.Mesh != null)
                {
                    if (!element.HasDefaultShader())
                    {
                        element.Mesh.Effect    = ShaderRepository.WorldWaterFog;
                        element.Mesh.Technique = "WorldWaterFog";
                    }
                }
                element.Render();
            });

            elementsRendered = elements.Count;

            toRender.ForEach(chunk => chunk.Render());

            shark.Mesh.Effect    = ShaderRepository.WorldWaterFog;
            shark.Mesh.Technique = "WorldWaterFog";
            shark.Render();

            //waterSurface.Render(camera.Position);
            //Floor.Render();
        }
コード例 #8
0
ファイル: CrearFlecha.cs プロジェクト: juanisierra/tgc-viewer
 public CrearFlecha(string mediaDir, string shadersDir, TgcUserVars userVars, TgcModifiers modifiers,
                    TgcAxisLines axisLines, TgcCamera camara)
     : base(mediaDir, shadersDir, userVars, modifiers, axisLines, camara)
 {
     Category    = "GeometryBasics";
     Name        = "Flecha 3D";
     Description = "Muestra como crear una flecha 3D, utilizando la herramienta TgcArrow. Movimiento con mouse.";
 }
コード例 #9
0
 public EjemploBatchPrimitives(string mediaDir, string shadersDir, TgcUserVars userVars, TgcModifiers modifiers,
                               TgcAxisLines axisLines, TgcCamera camara)
     : base(mediaDir, shadersDir, userVars, modifiers, axisLines, camara)
 {
     Category    = "Others";
     Name        = "BatchPrimitives";
     Description = "BatchPrimitives";
 }
コード例 #10
0
ファイル: Lighting.cs プロジェクト: juanisierra/tgc-viewer
 public Lighting(string mediaDir, string shadersDir, TgcUserVars userVars, TgcModifiers modifiers,
                 TgcAxisLines axisLines, TgcCamera camara)
     : base(mediaDir, shadersDir, userVars, modifiers, axisLines, camara)
 {
     Category    = "DirectX";
     Name        = "Lighting";
     Description = "Permite modificar varios parametros del modelo de iluminacion de DirectX.";
 }
コード例 #11
0
 public PlayMp3(string mediaDir, string shadersDir, TgcUserVars userVars, TgcModifiers modifiers,
                TgcAxisLines axisLines, TgcCamera camara)
     : base(mediaDir, shadersDir, userVars, modifiers, axisLines, camara)
 {
     Category    = "Sound";
     Name        = "Play Mp3";
     Description = "Muestra como reproducir un archivo de sonido en formato MP3.";
 }
コード例 #12
0
 public EjemploMeshInstance(string mediaDir, string shadersDir, TgcUserVars userVars, TgcModifiers modifiers,
                            TgcAxisLines axisLines, TgcCamera camara)
     : base(mediaDir, shadersDir, userVars, modifiers, axisLines, camara)
 {
     Category    = "SceneLoader";
     Name        = "MeshInstance";
     Description = "Cargar una malla original y dos instancias de esta.";
 }
コード例 #13
0
 public SeleccionMultiplePicking(string mediaDir, string shadersDir, TgcUserVars userVars, TgcModifiers modifiers,
                                 TgcAxisLines axisLines, TgcCamera camara)
     : base(mediaDir, shadersDir, userVars, modifiers, axisLines, camara)
 {
     Category    = "Collision";
     Name        = "Seleccion Multiple";
     Description = "Muestra como seleccionar un objeto con el Mouse creando un rectángulo de selección.";
 }
コード例 #14
0
 public Tutorial2(string mediaDir, string shadersDir, TgcUserVars userVars, TgcModifiers modifiers,
                  TgcAxisLines axisLines, TgcCamera camara)
     : base(mediaDir, shadersDir, userVars, modifiers, axisLines, camara)
 {
     Category    = "Tutorial";
     Name        = "Tutorial 2";
     Description = "Muestra como crear una caja 3D con una imagen 2D como textura para darle color.";
 }
コード例 #15
0
 public EjemploKeyFrameLoader(string mediaDir, string shadersDir, TgcUserVars userVars, TgcModifiers modifiers,
                              TgcAxisLines axisLines, TgcCamera camara)
     : base(mediaDir, shadersDir, userVars, modifiers, axisLines, camara)
 {
     Category    = "KeyFrameAnimation";
     Name        = "MeshLoader";
     Description = "Muestra como cargar un personaje con animaciones, en formato TGC.";
 }
コード例 #16
0
 public EjemploQuaternions(string mediaDir, string shadersDir, TgcUserVars userVars, TgcModifiers modifiers,
                           TgcAxisLines axisLines, TgcCamera camara)
     : base(mediaDir, shadersDir, userVars, modifiers, axisLines, camara)
 {
     Category    = "Transformations";
     Name        = "Euler vs Quaternion";
     Description = "Euler vs Quaternion";
 }
コード例 #17
0
ファイル: ShadowMap.cs プロジェクト: juanisierra/tgc-viewer
 public ShadowMap(string mediaDir, string shadersDir, TgcUserVars userVars, TgcModifiers modifiers,
                  TgcAxisLines axisLines, TgcCamera camara)
     : base(mediaDir, shadersDir, userVars, modifiers, axisLines, camara)
 {
     Category    = "Shaders";
     Name        = "Workshop-ShadowMap";
     Description = "Image Space Shadows con Shadow Map.";
 }
コード例 #18
0
 public EjemploBumpMapping(string mediaDir, string shadersDir, TgcUserVars userVars, TgcModifiers modifiers,
                           TgcAxisLines axisLines, TgcCamera camara)
     : base(mediaDir, shadersDir, userVars, modifiers, axisLines, camara)
 {
     Category    = "Lights";
     Name        = "Bump Mapping";
     Description = "Efecto de Bump Mapping utilizando una textura de NormalMap en TangentSpace.";
 }
コード例 #19
0
 public EjemploVerticalWall(string mediaDir, string shadersDir, TgcUserVars userVars, TgcModifiers modifiers,
                            TgcAxisLines axisLines, TgcCamera camara)
     : base(mediaDir, shadersDir, userVars, modifiers, axisLines, camara)
 {
     Category    = "GeometryBasics";
     Name        = "EjemploVerticalWall";
     Description = "EjemploVerticalWall";
 }
コード例 #20
0
 public EjemploCrearTeapot(string mediaDir, string shadersDir, TgcUserVars userVars, TgcModifiers modifiers,
                           TgcAxisLines axisLines, TgcCamera camara)
     : base(mediaDir, shadersDir, userVars, modifiers, axisLines, camara)
 {
     Category    = "DirectX";
     Name        = "Teapot + Light";
     Description = "Crea un Teapot de DirectX con iluminación dinámica que gira sobre los tres ejes.";
 }
コード例 #21
0
 public Tutorial7(string mediaDir, string shadersDir, TgcUserVars userVars, TgcModifiers modifiers,
                  TgcAxisLines axisLines, TgcCamera camara)
     : base(mediaDir, shadersDir, userVars, modifiers, axisLines, camara)
 {
     Category    = "Tutorial";
     Name        = "Tutorial 7";
     Description = "Muestra como cargar una escena 3D y como mover un modelo dentra de ella con el teclado.";
 }
コード例 #22
0
 public EjemploExportarMesh(string mediaDir, string shadersDir, TgcUserVars userVars, TgcModifiers modifiers,
                            TgcAxisLines axisLines, TgcCamera camara)
     : base(mediaDir, shadersDir, userVars, modifiers, axisLines, camara)
 {
     Category    = "SceneLoader";
     Name        = "MeshExporter";
     Description = "Exportar una malla a XML.";
 }
コード例 #23
0
 public TrianguloVertexBuffer(string mediaDir, string shadersDir, TgcUserVars userVars, TgcModifiers modifiers,
                              TgcAxisLines axisLines, TgcCamera camara)
     : base(mediaDir, shadersDir, userVars, modifiers, axisLines, camara)
 {
     Category    = "GeometryBasics";
     Name        = "Triangulo VertexBuffer";
     Description = "Crea un triangulo 3D con color, utilizando Vertex Buffer. Movimiento con mouse.";
 }
コード例 #24
0
 public MotionBlur(string mediaDir, string shadersDir, TgcUserVars userVars, TgcModifiers modifiers,
                   TgcAxisLines axisLines, TgcCamera camara)
     : base(mediaDir, shadersDir, userVars, modifiers, axisLines, camara)
 {
     Category    = "Shaders";
     Name        = "Workshop-MotionBlur";
     Description = "Motion Effect";
 }
コード例 #25
0
ファイル: FullQuad.cs プロジェクト: juanisierra/tgc-viewer
 public FullScreenQuad(string mediaDir, string shadersDir, TgcUserVars userVars, TgcModifiers modifiers,
                       TgcAxisLines axisLines, TgcCamera camara)
     : base(mediaDir, shadersDir, userVars, modifiers, axisLines, camara)
 {
     Category    = "Shaders";
     Name        = "Workshop-FullScreenQuad";
     Description = "Full screen quad";
 }
コード例 #26
0
 public EfectoAlarma(string mediaDir, string shadersDir, TgcUserVars userVars, TgcModifiers modifiers,
                     TgcAxisLines axisLines, TgcCamera camara)
     : base(mediaDir, shadersDir, userVars, modifiers, axisLines, camara)
 {
     Category    = "PostProcess";
     Name        = "Efecto Alarma";
     Description = "Graba la escena a un Render Target y luego la combina con una textura de efecto de alarma.";
 }
コード例 #27
0
 public EjemploVideoPostProcess(string mediaDir, string shadersDir, TgcUserVars userVars, TgcModifiers modifiers,
                                TgcAxisLines axisLines, TgcCamera camara)
     : base(mediaDir, shadersDir, userVars, modifiers, axisLines, camara)
 {
     Category    = "Shaders";
     Name        = "Workshop-VideoPostProcess";
     Description = "Procesamiento de imagenes";
 }
コード例 #28
0
 public GaussianBlur(string mediaDir, string shadersDir, TgcUserVars userVars, TgcModifiers modifiers,
                     TgcAxisLines axisLines, TgcCamera camara)
     : base(mediaDir, shadersDir, userVars, modifiers, axisLines, camara)
 {
     Category    = "Shaders";
     Name        = "Workshop-GaussianBlur";
     Description = "Gaussin blur filter.";
 }
コード例 #29
0
 public EjemploDisposeMesh(string mediaDir, string shadersDir, TgcUserVars userVars, TgcModifiers modifiers,
                           TgcAxisLines axisLines, TgcCamera camara)
     : base(mediaDir, shadersDir, userVars, modifiers, axisLines, camara)
 {
     Category    = "Others";
     Name        = "Dispose Mesh";
     Description = "Dispose Mesh";
 }
コード例 #30
0
 public AlphaBlendingFramework(string mediaDir, string shadersDir, TgcUserVars userVars, TgcModifiers modifiers,
                               TgcAxisLines axisLines, TgcCamera camara)
     : base(mediaDir, shadersDir, userVars, modifiers, axisLines, camara)
 {
     Category    = "AlphaBlending";
     Name        = "AlphaBlending Framework";
     Description = "AlphaBlending Framework";
 }
 public TgcCameraAdapter(TgcCamera _camera)
 {
     this.camera = _camera;
 }
コード例 #32
0
 /// <summary>
 /// Vuelve la configuracion de render y otras cosas a la configuracion inicial
 /// </summary>
 internal void resetDefaultConfig()
 {
     mainForm.resetMenuOptions();
     this.axisLines.Enable = true;
     this.fpsCamera.Enable = false;
     this.rotCamera.Enable = true;
     this.currentCamera = this.rotCamera;
     this.thirdPersonCamera.Enable = false;
     this.fpsCounterEnable = true;
     tgcD3dDevice.setDefaultValues();
     this.mp3Player.closeFile();
     this.fog.resetValues();
     customRenderEnabled = false;
 }
コード例 #33
0
        /// <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);
        }