Ejemplo n.º 1
0
        /// <summary>
        /// Modificador para valores Int.
        /// </summary>
        /// <param name="varName">Nombre del modificador.</param>
        /// <param name="minValue">Valor minimo.</param>
        /// <param name="maxValue">>Valor maximo.</param>
        /// <param name="defaultValue">Valor default.</param>
        /// <returns>Modificador que se agrego.</returns>
        public TGCIntModifier AddInt(string varName, int minValue, int maxValue, int defaultValue)
        {
            var intModifier = new TGCIntModifier(varName, minValue, maxValue, defaultValue);

            AddModifier(intModifier);
            return(intModifier);
        }
Ejemplo n.º 2
0
 private void InitializeModifiers()
 {
     sceneModifier       = AddBoolean("Scene", "Render scene", true);
     toneMappingModifier = AddBoolean("ToneMapping", "ToneMapping", true);
     bloomModifier       = AddBoolean("Bloom", "Add bloom", true);
     passesModifier      = AddInt("Cantidad de pasadas de blur", 1, 30, 10);
 }
Ejemplo n.º 3
0
        public override void Init()
        {
            cylinder = new TgcCylinder(TGCVector3.Empty, 2, 4);

            cylinder.AlphaBlendEnable = true;

            boundingCylinderModifier = AddBoolean("boundingCylinder", "boundingCylinder", false);
            colorModifier            = AddColor("color", Color.White);
            alphaModifier            = AddInt("alpha", 0, 255, 255);
            textureModifier          = AddTexture("texture", MediaDir + "\\Texturas\\madera.jpg");
            useTextureModifier       = AddBoolean("useTexture", "useTexture", true);

            sizeModifier     = AddVertex3f("size", new TGCVector3(-3, -3, 1), new TGCVector3(7, 7, 10), new TGCVector3(2, 2, 5));
            positionModifier = AddVertex3f("position", new TGCVector3(-20, -20, -20), new TGCVector3(20, 20, 20), TGCVector3.Empty);
            var angle = FastMath.TWO_PI;

            rotationModifier = AddVertex3f("rotation", new TGCVector3(-angle, -angle, -angle), new TGCVector3(angle, angle, angle), TGCVector3.Empty);

            Camara = new TgcRotationalCamera(Input);
        }
Ejemplo n.º 4
0
        public override void Init()
        {
            //Directorio de texturas
            texturePath = MediaDir + "Texturas\\Particles\\";

            //Texturas de particulas a utilizar
            textureNames = new[]
            {
                "pisada.png",
                "fuego.png",
                "humo.png",
                "hoja.png",
                "agua.png",
                "nieve.png"
            };

            //Modifiers
            textureModifier    = AddInterval("texture", textureNames, 0);
            cantidadModifier   = AddInt("cantidad", 1, 30, 10);
            minSizeModifier    = AddFloat("minSize", 0.25f, 10, 4);
            maxSizeModifier    = AddFloat("maxSize", 0.25f, 10, 6);
            timeToLiveModifier = AddFloat("timeToLive", 0.25f, 2, 1);
            frecuenciaModifier = AddFloat("frecuencia", 0.25f, 4, 1);
            dispersionModifier = AddInt("dispersion", 50, 400, 100);
            speedDirModifier   = AddVertex3f("speedDir", new TGCVector3(-50, -50, -50), new TGCVector3(50, 50, 50), new TGCVector3(30, 30, 30));

            //Crear emisor de particulas
            selectedTextureName   = textureNames[0];
            selectedParticleCount = 10;
            emitter          = new ParticleEmitter(texturePath + selectedTextureName, selectedParticleCount);
            emitter.Position = TGCVector3.Empty;

            box = TGCBox.fromSize(new TGCVector3(0, -30, 0), new TGCVector3(10, 10, 10), Color.Blue);

            Camara = new TgcRotationalCamera(TGCVector3.Empty, 300f, Input);
        }
Ejemplo n.º 5
0
        public override void Init()
        {
            var d3dDevice = D3DDevice.Instance.Device;

            MyShaderDir = ShadersDir + "WorkshopShaders\\";

            //Cargamos un escenario
            var loader = new TgcSceneLoader();
            var scene  = loader.loadSceneFromFile(MediaDir + "MeshCreator\\Scenes\\Deposito\\Deposito-TgcScene.xml");

            meshes = scene.Meshes;

            //Cargar Shader personalizado
            string compilationErrors;

            effect = Effect.FromFile(d3dDevice, MyShaderDir + "GaussianBlur.fx",
                                     null, null, ShaderFlags.PreferFlowControl, null, out compilationErrors);
            if (effect == null)
            {
                throw new Exception("Error al cargar shader. Errores: " + compilationErrors);
            }
            //Configurar Technique dentro del shader
            effect.Technique = "DefaultTechnique";

            //Camara en primera persona
            Camara = new TgcFpsCamera(new TGCVector3(250, 160, -570), Input);

            g_pDepthStencil = d3dDevice.CreateDepthStencilSurface(d3dDevice.PresentationParameters.BackBufferWidth,
                                                                  d3dDevice.PresentationParameters.BackBufferHeight,
                                                                  DepthFormat.D24S8, MultiSampleType.None, 0, true);

            // inicializo el render target
            g_pRenderTarget = new Texture(d3dDevice, d3dDevice.PresentationParameters.BackBufferWidth
                                          , d3dDevice.PresentationParameters.BackBufferHeight, 1, Usage.RenderTarget,
                                          Format.X8R8G8B8, Pool.Default);

            g_pRenderTarget4 = new Texture(d3dDevice, d3dDevice.PresentationParameters.BackBufferWidth / 4
                                           , d3dDevice.PresentationParameters.BackBufferHeight / 4, 1, Usage.RenderTarget,
                                           Format.X8R8G8B8, Pool.Default);

            g_pRenderTarget4Aux = new Texture(d3dDevice, d3dDevice.PresentationParameters.BackBufferWidth / 4
                                              , d3dDevice.PresentationParameters.BackBufferHeight / 4, 1, Usage.RenderTarget,
                                              Format.X8R8G8B8, Pool.Default);

            effect.SetValue("g_RenderTarget", g_pRenderTarget);

            // Resolucion de pantalla
            effect.SetValue("screen_dx", d3dDevice.PresentationParameters.BackBufferWidth);
            effect.SetValue("screen_dy", d3dDevice.PresentationParameters.BackBufferHeight);

            //Creamos un FullScreen Quad
            CustomVertex.PositionTextured[] vertices =
            {
                new CustomVertex.PositionTextured(-1,  1, 1, 0, 0),
                new CustomVertex.PositionTextured(1,   1, 1, 1, 0),
                new CustomVertex.PositionTextured(-1, -1, 1, 0, 1),
                new CustomVertex.PositionTextured(1,  -1, 1, 1, 1)
            };
            //vertex buffer de los triangulos
            g_pVBV3D = new VertexBuffer(typeof(CustomVertex.PositionTextured),
                                        4, d3dDevice, Usage.Dynamic | Usage.WriteOnly,
                                        CustomVertex.PositionTextured.Format, Pool.Default);
            g_pVBV3D.SetData(vertices, 0, LockFlags.None);

            activarEfectoModifier = AddBoolean("activar_efecto", "Activar efecto", true);
            separableModifier     = AddBoolean("separable", "Separable Blur", true);
            cantPasadasModifier   = AddInt("cant_pasadas", 1, 10, 1);
        }