private bool InitTextures(Application application, PixelFormat format, int width, int height)
        {
            bgTexture.Create(application, format, width, height, 0);
            uvTexture.Create(application, format, width, height, 1);
            vTexture.Create(application, format, width, height, 2);

            string shaderName = GetShaderName(format);

            // Update the material
            Technique technique = application.ResourceCache.GetTechnique("Techniques/Diff.xml");

            for (uint i = 0; i < technique.NumPasses; i++)
            {
                Pass pass = technique.GetPass(i);
                if (pass != null)
                {
                    pass.VertexShader = shaderName;
                    pass.PixelShader  = shaderName;
                }
            }
            Material.SetTechnique(0, technique);
            bgTexture.SetNameIfValid(Material, TextureUnit.Diffuse);
            uvTexture.SetNameIfValid(Material, TextureUnit.Normal);
            vTexture.SetNameIfValid(Material, TextureUnit.Specular);
            Material.CullMode = CullMode.None;

            this.initializedFormat = format;
            this.initializedWidth  = width;
            this.initializedHeight = height;

            return(true);
        }
    public void ApplyServerTechnique(Technique newTechnique)
    {
        technique = newTechnique;

        foreach (var x in new TechniqueServerController[] { PINPinTechnique, PatternPinTechnique, Pattern3DPinTechnique })
        {
            x.gameObject.SetActive(false);
        }
        TechniqueServerController controller;

        switch (technique)
        {
        case Technique.PIN: controller = PINPinTechnique; break;

        case Technique.Pattern: controller = PatternPinTechnique; break;

        case Technique.Pattern3D: controller = Pattern3DPinTechnique; break;

        default: throw new InvalidOperationException();
        }
        SetCurrentPin(currentPinTested);
        SetCurrentPinTrial(currentTrialForPin);
        controller.gameObject.SetActive(true);
        techniqueServerPointer.Controller = controller;

        // For instrumentation
        _controller = controller;
        _controller.OnEnteredNumbersChanged += x => DigitEntered();
    }
Exemplo n.º 3
0
    protected virtual void ActivateTechniques()
    {
        if (activatingTechniques.Count == 1)
        {
            TransitionTechnique(activatingTechniques[0], false);
            activatingTechniques.Clear();
        }
        else if (activatingTechniques.Count > 1)
        {
            Technique chosenTech      = null;
            int       longestSequence = 0;
            foreach (Technique tech in activatingTechniques)
            {
                if (tech.techTrigger.sequence.Length > longestSequence)
                {
                    chosenTech      = tech;
                    longestSequence = tech.techTrigger.sequence.Length;
                }
                else if (tech.techTrigger.sequence.Length == longestSequence)
                {
                    if (Array.IndexOf(chosenTech.techTrigger.states, State.Any) != -1 && Array.IndexOf(tech.techTrigger.states, State.Any) == -1)
                    {
                        chosenTech      = tech;
                        longestSequence = tech.techTrigger.sequence.Length;
                    }
                }
            }

            TransitionTechnique(chosenTech, false);
            activatingTechniques.Clear();
        }
    }
Exemplo n.º 4
0
        public MyEffectBlendLights()
            : base("Effects2\\Lights\\MyEffectBlendLights")
        {
            m_Diffuse = m_D3DEffect.GetParameter(null, "DiffuseTexture");
            m_Lights = m_D3DEffect.GetParameter(null, "LightTexture");
            m_LightsMod = m_D3DEffect.GetParameter(null, "LightTextureMod");
            m_LightsDiv = m_D3DEffect.GetParameter(null, "LightTextureDiv");
            m_Depth = m_D3DEffect.GetParameter(null, "DepthTexture");
            m_Normal = m_D3DEffect.GetParameter(null, "NormalsTexture");
            m_backgroundTexture = m_D3DEffect.GetParameter(null, "BackgroundTexture");
            m_halfPixel = m_D3DEffect.GetParameter(null, "HalfPixel");
            m_scale = m_D3DEffect.GetParameter(null, "Scale");
            m_AmbientColor = m_D3DEffect.GetParameter(null, "AmbientColor");

            m_basicTechnique = m_D3DEffect.GetTechnique("BasicTechnique");
            m_disableLightsTechnique = m_D3DEffect.GetTechnique("DisableLightsTechnique");
            m_onlyLightsTechnique = m_D3DEffect.GetTechnique("OnlyLightsTechnique");
            m_onlySpecularIntensityTechnique = m_D3DEffect.GetTechnique("OnlySpecularIntensity");
            m_onlySpecularPowerTechnique = m_D3DEffect.GetTechnique("OnlySpecularPower");
            m_onlyEmissivityTechnique = m_D3DEffect.GetTechnique("OnlyEmissivity");
            m_onlyReflectivityTechnique = m_D3DEffect.GetTechnique("OnlyReflectivity");
            m_copyEmissivity = m_D3DEffect.GetTechnique("CopyEmissivity");

            DefaultTechnique = Technique.LightsEnabled;
            CopyEmissivityTechnique = Technique.CopyEmissivity;
            SetTechnique(DefaultTechnique);
        }
Exemplo n.º 5
0
        public ActionResult Create(Technique technique)
        {
            string url = "TechniqueData/addTechnique";

            Debug.WriteLine(jss.Serialize(technique));
            HttpContent content = new StringContent(jss.Serialize(technique));

            content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            HttpResponseMessage response = client.PostAsync(url, content).Result;

            if (response.IsSuccessStatusCode)
            {
                int techniqueId = 0;
                try {
                    techniqueId = response.Content.ReadAsAsync <int>().Result;
                    return(RedirectToAction("Details", new {
                        id = techniqueId
                    }));
                } catch (Exception e) {
                    Debug.WriteLine(e);
                    return(RedirectToAction("List"));
                }
            }
            else
            {
                return(RedirectToAction("Error"));
            }
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Edit(int id, [Bind("TechniqueId,CategoryId,Name,PositionId")] Technique technique)
        {
            if (id != technique.TechniqueId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(technique);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TechniqueExists(technique.TechniqueId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["CategoryId"] = new SelectList(_context.Categories, "CategoryId", "CategoryId", technique.CategoryId);
            ViewData["PositionId"] = new SelectList(_context.Positions, "PositionId", "PositionId", technique.PositionId);
            return(View(technique));
        }
Exemplo n.º 7
0
        private void _updateAlgorithmsInTechnique(Technique value)
        {
            if (TechniqueAlgorithms != null)
            {
                TechniqueAlgorithms.Clear();
            }
            else
            {
                TechniqueAlgorithms = new ObservableCollection <AlgorithmViewModel>();
            }

            if (value != null)
            {
                IUnityContainer  c       = GlobalContainer.Instance.Container;
                IPipelineManager manager = c.Resolve <IPipelineManager>();

                var restoredPipeline = manager.RestorePipeline(value.xml);

                if (TechniqueAlgorithms != null)
                {
                    TechniqueAlgorithms.Clear();
                }

                foreach (var process in restoredPipeline)
                {
                    if (process != null)
                    {
                        AlgorithmViewModel algVM = new AlgorithmViewModel(process);
                        algVM.IsRemovable = false;
                        TechniqueAlgorithms.Add(algVM);
                    }
                }
            }
        }
Exemplo n.º 8
0
    public static Technique GetTech(int techId)
    {
        string[][] strs  = ReadTxt.ReadText("techniques");
        Technique  techs = new Technique();

        for (int i = 0; i < strs.Length - 1; i++)
        {
            techs.id = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 0));
            if (techs.id != techId)
            {
                continue;
            }
            techs.name  = ReadTxt.GetDataByRowAndCol(strs, i + 1, 1);
            techs.type  = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 2));
            techs.lv    = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 3));
            techs.maxLv = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 4));
            techs.req   = new Dictionary <int, int> ();
            string[][] ss = ReadTxt.GetRequire(ReadTxt.GetDataByRowAndCol(strs, i + 1, 5));
            if (ss != null)
            {
                for (int j = 0; j < ss.Length; j++)
                {
                    techs.req.Add(int.Parse(ss [j] [0]), int.Parse(ss [j] [1]));
                }
            }
            techs.timeCost = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 6));
            techs.desc     = ReadTxt.GetDataByRowAndCol(strs, i + 1, 7);
            return(techs);
        }
        Debug.Log("没有找到科技--" + techId);
        return(new Technique());
    }
Exemplo n.º 9
0
        public void AddHydraxDepthTechnique(String materialName)
        {
            if (hydrax == null || !hydrax.IsCreated)
            {
                return;
            }

            MaterialPtr m = MaterialManager.Singleton.GetByName(materialName);

            if (m != null && m.GetTechnique("_Hydrax_Depth_Technique") == null)
            {
                hydraxDepthMaterialsMap[materialName] = ((MaterialPtr)m).NumTechniques;
                hydraxDepthMaterials.Add(materialName);

                Technique t = m.CreateTechnique();

                hydrax.MaterialManager.AddDepthTechnique(t);

                m = null;
            }

            foreach (Technique t in hydrax.MaterialManager.DepthTechniques)
            {
                t.SetFog(true, FogMode.FOG_NONE);
            }
        }
Exemplo n.º 10
0
 public Technique(Material parent, Technique oth) : this(OgrePINVOKE.new_Technique__SWIG_1(Material.getCPtr(parent), Technique.getCPtr(oth)), true)
 {
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
        protected override void OnShow(Node node, Asset asset)
        {
            var material = ResourceCache.GetMaterial(asset.RelativePathToAsset);

            var modelNode = node.CreateChild();

            modelNode.SetScale(2f);
            modelNode.Rotate(new Quaternion(30, 30, 30), TransformSpace.Local);
            staticModel = modelNode.CreateComponent <StaticModel>();

            //NOTE: this code went to Urho, will be replaced with the next Nuget update
            Technique[] result = new Technique[material.NumTechniques];
            for (uint i = 0; i < material.NumTechniques; i++)
            {
                result[i] = material.GetTechnique(i);
            }

            if (result.Any(t => t.Name.Contains(nameof(CoreAssets.Techniques.DiffSkybox))))
            {
                var skyNode = node.CreateChild();
                var skybox  = skyNode.CreateComponent <Skybox>();
                skybox.Model = CoreAssets.Models.Box;
                skybox.SetMaterial(ResourceCache.GetMaterial(asset.RelativePathToAsset));
                staticModel.Model = CoreAssets.Models.Box;
            }
            else
            {
                staticModel.Model = CoreAssets.Models.Sphere;
            }
            staticModel.SetMaterial(material);
            App.Input.KeyDown += OnKeyDown;
        }
Exemplo n.º 12
0
    public void SetupList()
    {
        IEnumerable <TechniqueMetaData> metaDataCollection = TechniqueFileHelper.GetAllTechniquesMeta();

        foreach (Transform child in TechniqueLayout.transform)
        {
            if (!metaDataCollection.Any(t => t.TechniqueName == child.name))
            {
                Destroy(child.gameObject);
            }
        }

        foreach (TechniqueMetaData meta in metaDataCollection)
        {
            GameObject techniqueGameObject = GameObject.Find(meta.TechniqueName);
            if (techniqueGameObject == null)
            {
                techniqueGameObject      = Instantiate(ButtonPrefab);
                techniqueGameObject.name = meta.TechniqueName;
                techniqueGameObject.transform.SetParent(TechniqueLayout.transform, false);
            }

            Button            button = techniqueGameObject.GetComponent <Button>();
            TextMeshProUGUI[] texts  = button.GetComponentsInChildren <TextMeshProUGUI>();

            foreach (TextMeshProUGUI text in texts)
            {
                if (text.name == "TechniqueDataText")
                {
                    text.text = $"Name: {meta.TechniqueName}\n" +
                                $"Recorded by: {meta.UserName}";
                }
                else if (text.name == "UserStatsText")
                {
                    bool   shouldDisplayDefault = !meta.HasBeenAttempted;
                    string date = shouldDisplayDefault ? "N/A" : meta.LastAttemptedDateTime.ToShortDateString();
                    text.text = $"Last attempted: {date}\n" +
                                $"Last Score: {(shouldDisplayDefault ? "N/A" : (int) meta.LastScorePercent + "%")}\n" +
                                $"Best Score: {(shouldDisplayDefault ? "N/A" : (int) meta.BestScorePercent + "%")}";
                }
            }

            if (techniqueGameObject.GetComponent <ClickListener>() == null)
            {
                ClickListener clickListener = techniqueGameObject.AddComponent <ClickListener>();

                clickListener.OnRightClick += delegate {
                    promptToDelete.text = string.Format(DELETE, meta.TechniqueName);
                    VariableHolder.TechniqueToDelete = meta.TechniqueName;

                    MenuControl.OnStateChanged(MenuStates.DeleteTechnique, false);
                };
                clickListener.OnLeftClick += delegate {
                    Technique loadedTechnique = TechniqueFileHelper.Load(meta.TechniqueName);
                    TrainingActions.Init(loadedTechnique);
                    MenuControl.OnStateChanged(MenuStates.TrainingPreview);
                };
            }
        }
    }
Exemplo n.º 13
0
    public static void Save(Technique t)
    {
        if (!Directory.Exists(SaveFolder))
        {
            Directory.CreateDirectory(SaveFolder);
        }

        if (!Directory.Exists(MetaDataFolder))
        {
            Directory.CreateDirectory(MetaDataFolder);
        }

        t.ownerArtistId = VariableHolder.User.UserID;

        string techniqueJson     = JsonUtility.ToJson(t);
        string techniqueMetaJson = JsonUtility.ToJson((TechniqueMetaData)t);

        string techniquePath = $"{SaveFolder}/{t.TechniqueName}.ma";

        File.WriteAllText(techniquePath, techniqueJson);

        string metaDataPath = $"{MetaDataFolder}/{t.TechniqueName}.me";

        File.WriteAllText(metaDataPath, techniqueMetaJson);
    }
Exemplo n.º 14
0
        public ChunkRenderer(GraphicsDevice device, ContentManager content, Technique optimization)
        {
            Device  = device;
            Content = content;

            Optimization = optimization;

            Chunks       = new XChunk[SIZE * SIZE];
            TextureAtlas = new Dictionary <string, Vector2>();

            // TODO: AUTOMATED
            TEXTURE_RATIO_X = 63.85f / 256.0f;
            TEXTURE_RATIO_Y = 63.85f / 256.0f;


            TextureAtlas.Add("Top_Grass", new Vector2(1, 0));
            TextureAtlas.Add("Side_Dirt", new Vector2(2, 0));

            textureAtlas   = Content.Load <Texture2D>("atlas");
            internalEffect = new BasicEffect(Device)
            {
                Texture        = textureAtlas,
                TextureEnabled = true
            };
        }
Exemplo n.º 15
0
        private string BuildInstancedMaterial(string originalMaterialName)
        {
            // already instanced ?
            if (originalMaterialName.EndsWith("/instanced"))
            {
                return(originalMaterialName);
            }

            var originalMaterial = (Material)MaterialManager.Instance.GetByName(originalMaterialName);

            // if originalMat doesn't exists use "Instancing" material name
            string instancedMaterialName = (null == originalMaterial ? "Instancing" : originalMaterialName + "/Instanced");
            var    instancedMaterial     = (Material)MaterialManager.Instance.GetByName(instancedMaterialName);

            // already exists ?
            if (null == instancedMaterial)
            {
                instancedMaterial = originalMaterial.Clone(instancedMaterialName);
                instancedMaterial.Load();
                Technique t = instancedMaterial.GetBestTechnique();
                for (int pItr = 0; pItr < t.PassCount; pItr++)
                {
                    Pass p = t.GetPass(pItr);
                    p.SetVertexProgram("Instancing", false);
                    p.SetShadowCasterVertexProgram("InstancingShadowCaster");
                }
            }
            instancedMaterial.Load();
            return(instancedMaterialName);
        }
Exemplo n.º 16
0
        public MyEffectBlendLights()
            : base("Effects2\\Lights\\MyEffectBlendLights")
        {
            m_Diffuse           = m_D3DEffect.GetParameter(null, "DiffuseTexture");
            m_Lights            = m_D3DEffect.GetParameter(null, "LightTexture");
            m_LightsMod         = m_D3DEffect.GetParameter(null, "LightTextureMod");
            m_LightsDiv         = m_D3DEffect.GetParameter(null, "LightTextureDiv");
            m_Depth             = m_D3DEffect.GetParameter(null, "DepthTexture");
            m_Normal            = m_D3DEffect.GetParameter(null, "NormalsTexture");
            m_backgroundTexture = m_D3DEffect.GetParameter(null, "BackgroundTexture");
            m_halfPixel         = m_D3DEffect.GetParameter(null, "HalfPixel");
            m_scale             = m_D3DEffect.GetParameter(null, "Scale");
            m_AmbientColor      = m_D3DEffect.GetParameter(null, "AmbientColor");

            m_basicTechnique                 = m_D3DEffect.GetTechnique("BasicTechnique");
            m_disableLightsTechnique         = m_D3DEffect.GetTechnique("DisableLightsTechnique");
            m_onlyLightsTechnique            = m_D3DEffect.GetTechnique("OnlyLightsTechnique");
            m_onlySpecularIntensityTechnique = m_D3DEffect.GetTechnique("OnlySpecularIntensity");
            m_onlySpecularPowerTechnique     = m_D3DEffect.GetTechnique("OnlySpecularPower");
            m_onlyEmissivityTechnique        = m_D3DEffect.GetTechnique("OnlyEmissivity");
            m_onlyReflectivityTechnique      = m_D3DEffect.GetTechnique("OnlyReflectivity");
            m_copyEmissivity                 = m_D3DEffect.GetTechnique("CopyEmissivity");

            DefaultTechnique        = Technique.LightsEnabled;
            CopyEmissivityTechnique = Technique.CopyEmissivity;
            SetTechnique(DefaultTechnique);
        }
Exemplo n.º 17
0
 public void AddEntity(Technique technique, Model model, IEntity entity)
 {
     Contract.Requires <ArgumentNullException>(technique != null, "effect");
     Contract.Requires <ArgumentNullException>(model != null, "model");
     Contract.Requires <ArgumentNullException>(entity != null, "entity");
     tuples.Add(new Tuple <Technique, Model, IEntity>(technique, model, entity));
 }
Exemplo n.º 18
0
        public IHttpActionResult updateTechnique(int id, [FromBody] Technique technique)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != technique.techniqueId)
            {
                return(BadRequest());
            }

            db.Entry(technique).State = EntityState.Modified;

            try {
                db.SaveChanges();
            } catch (DbUpdateConcurrencyException) {
                if (!TechniqueExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 19
0
 public static Technique[] GetTechList()
 {
     string[][]  strs  = ReadTxt.ReadText("techniques");
     Technique[] techs = new Technique[strs.Length - 1];
     for (int i = 0; i < techs.Length; i++)
     {
         techs [i]      = new Technique();
         techs[i].id    = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 0));
         techs[i].name  = ReadTxt.GetDataByRowAndCol(strs, i + 1, 1);
         techs[i].type  = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 2));
         techs[i].lv    = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 3));
         techs[i].maxLv = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 4));
         techs [i].req  = new Dictionary <int, int> ();
         string[][] ss = ReadTxt.GetRequire(ReadTxt.GetDataByRowAndCol(strs, i + 1, 5));
         if (ss != null)
         {
             for (int j = 0; j < ss.Length; j++)
             {
                 techs [i].req.Add(int.Parse(ss [j] [0]), int.Parse(ss [j] [1]));
             }
         }
         techs[i].timeCost = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 6));
         techs[i].desc     = ReadTxt.GetDataByRowAndCol(strs, i + 1, 7);
     }
     return(techs);
 }
Exemplo n.º 20
0
        public override void Build()
        {
            mBatch.Build();

            foreach (BatchedGeometry.SubBatch it in mBatch.SubBatches.Values)
            {
                BatchedGeometry.SubBatch subBatch = it;
                Material mat = subBatch.Material;

                //Disable specular unless a custom shader is being used.
                //This is done because the default shader applied by BatchPage
                //doesn't support specular, and fixed-function needs to look
                //the same as the shader (for computers with no shader support)
                for (int t = 0; t < mat.TechniqueCount; t++)
                {
                    Technique tech = mat.GetTechnique(t);
                    for (int p = 0; p < tech.PassCount; p++)
                    {
                        Pass pass = tech.GetPass(p);
                        if (pass.VertexProgramName == "")
                        {
                            pass.Specular = new ColorEx(1, 0, 0, 0);
                        }
                    }
                }

                //store the original materials
                mUnfadedMaterials.Add(mat);
            }

            UpdateShaders();
        }
Exemplo n.º 21
0
        public void SetTechnique(Technique technique)
        {
            switch (technique)
            {
            case Technique.Lit:
                m_D3DEffect.Technique = m_litBasicTechnique;
                break;

            case Technique.Unlit:
                m_D3DEffect.Technique = m_unlitBasicTechnique;
                break;

            case Technique.UnlitForward:
                m_D3DEffect.Technique = m_unlitBasicForwardTechnique;
                break;

            case Technique.IgnoreDepth:
                m_D3DEffect.Technique = m_ignoreDepthBasicTechnique;
                break;

            case Technique.ColorizeHeight:
                m_D3DEffect.Technique = m_colorizeTechnique;
                break;

            case Technique.VisualizeOverdraw:
                m_D3DEffect.Technique = m_visualizeOverdrawTechnique;
                break;

            default:
                throw new MyMwcExceptionApplicationShouldNotGetHere();
                break;
            }
        }
Exemplo n.º 22
0
 public InitializerParameters(long entityId, Technique technique, IServiceRegistry services, SelectorDelegate selector)
 {
     EntityId  = entityId;
     Technique = technique;
     Services  = services;
     Selector  = selector;
 }
Exemplo n.º 23
0
    public void ApplyClientTechnique(Technique newTechnique)
    {
        technique = newTechnique;
        foreach (var x in new TechniqueClientController[] { PINPinTechnique, PatternPinTechnique, Pattern3DPinTechnique })
        {
            x.gameObject.SetActive(false);
        }
        TechniqueClientController controller;

        switch (technique)
        {
        case Technique.PIN: controller = PINPinTechnique; break;

        case Technique.Pattern: controller = PatternPinTechnique;  break;

        case Technique.Pattern3D: controller = Pattern3DPinTechnique; break;

        default: throw new System.InvalidOperationException();
        }
        controller.gameObject.SetActive(true);
        techniqueClientPointer.Controller = controller;
        OnClientReady?.Invoke();
#if UNITY_ANDROID
        Handheld.Vibrate(); // to add permissions to manifest
#endif
    }
Exemplo n.º 24
0
        void SaveState(Technique technique)
        {
            PreferredRasterizerState   preferredRasterizerState   = technique.Mapping.Key.RasterizerState;
            PreferredBlendState        preferredBlendState        = technique.Mapping.Key.BlendState;
            PreferredDepthStencilState preferredDepthStencilState = technique.Mapping.Key.DepthStencilState;

            if (CheckRasterizerState(technique))
            {
                AddNewCommand(new RasterizerStateChangeCommand(services, device.RasterizerStates[preferredRasterizerState.ToString()]));
            }

            if (CheckBlendState(technique))
            {
                AddNewCommand(new BlendStateChangeCommand(services, device.BlendStates[preferredBlendState.ToString()]));
            }

            if (CheckDepthStencilState(technique))
            {
                AddNewCommand(new DepthStencilStateChangeCommand(services, device.DepthStencilStates[preferredDepthStencilState.ToString()]));
            }

            rasterizerState   = preferredRasterizerState;
            blendState        = preferredBlendState;
            depthStencilState = preferredDepthStencilState;
        }
Exemplo n.º 25
0
        public static string[] GetTextureNames(Entity entity)
        {
            List <string> textures = new List <string>();
            //string[] textures = new string[];
            SubEntity e;

            for (uint i = 0; i < entity.NumSubEntities; i++)
            {
                e = entity.GetSubEntity(i);
                MaterialPtr ptr = MaterialManager.Singleton.GetByName(e.MaterialName);
                if (!ptr.IsLoaded)
                {
                    ptr.Load(false);
                }
                Technique t = ptr.GetBestTechnique();
                Technique.PassIterator iterator = t.GetPassIterator();
                foreach (Pass pass in iterator)
                {
                    Pass.TextureUnitStateIterator iterator2 = pass.GetTextureUnitStateIterator();
                    foreach (TextureUnitState unit in iterator2)
                    {
                        if (unit.GetContentType() == TextureUnitState.ContentType.CONTENT_NAMED)
                        {
                            if (unit.TextureName.Length > 0 && !textures.Contains(unit.TextureName))
                            {
                                textures.Add(unit.TextureName);
                            }
                        }
                    }
                }
            }

            return(textures.ToArray());
        }
Exemplo n.º 26
0
        public async Task<IActionResult> Edit(int id, [Bind("TechniqueId,Name,Description,UserId")] Technique technique)
        {
            //Get current user's UserId.
            var currentUser = await GetCurrentUserAsync();

            if (id != technique.TechniqueId)
            {
                return NotFound();
            }

            if (ModelState.IsValid)
            {
                try
                {
                    technique.User = currentUser;
                    _context.Update(technique);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TechniqueExists(technique.TechniqueId))
                    {
                        return NotFound();
                    }
                    else
                    {
                        throw;
                    }
                }
                return RedirectToAction(nameof(Index));
            }
            return View(technique);
        }
Exemplo n.º 27
0
 public ShaderInitializer(IServiceRegistry services, Technique technique)
 {
     this.services  = services;
     this.technique = technique;
     Device         = services.GetService <IGraphicsDeviceService>().DirectXDevice;
     FindRequiredInitializers();
 }
Exemplo n.º 28
0
 public Assay(string shortname, Technique technique, string token)
 {
     Id        = Guid.NewGuid();
     Shortname = shortname;
     Technique = technique;
     Token     = token;
 }
Exemplo n.º 29
0
 public DrinkInfo(JsonNode json)
 {
     this.menuDrinkId = json["menu_drink_id"].Get <int>();
     this.language    = (SessionManager.Language)json["language"].Get <int>();
     json             = json["drink"];
     this.minDegree   = json["min_degree"].Get <int>();
     this.maxDegree   = json["max_degree"].Get <int>();
     this.imageUrl    = json["image_url"].Get <string>();
     this.shopUrl     = json["shop_url"].Get <string>();
     this.primaryName = json["primary_name"].Get <string>();
     this.names       = new string[json["names"].Count];
     for (int i = 0; i < this.names.Length; i++)
     {
         this.names[i] = json["names"][i].Get <string>();
     }
     this.taste       = json["taste"].Get <string>();
     this.description = json["description"].Get <string>();
     this.recipe      = json["recipe"].Get <string>();
     this.color       = json["color"].Get <string>();
     this.location    = json["location"].Get <string>();
     this.company     = json["company"].Get <string>();
     this.technique   = new Technique(json["technique"]);
     this.glass       = new Glass(json["grass"]);
     this.drinkBase   = new DrinkBase(json["base"]);
     this.category    = new Category(json["category"]);
     this.source      = new Source(json["source"]);
     this.compornents = new Compornent[json["compornents"].Count];
     for (int i = 0; i < this.compornents.Length; i++)
     {
         this.compornents[i] = new Compornent(json["compornents"][i]);
     }
 }
Exemplo n.º 30
0
        /// <summary>
        /// Sets character technique fields for selected technique
        /// </summary>
        private void SetTechniqueFields()
        {
            if (!HasData)
            {
                return;
            }

            ObjectID  item      = cbCharacterTechniques.SelectedItem as ObjectID;
            Technique technique = MainForm.RomData.Techniques.Find(x => x.ID == item.ID);

            _selectedObject = (technique as ObjectID);
            MainForm.SetSelectedInformation(this, SelectedInformation);
            txtCharacterTechniqueName.Text                      = technique.Name;
            cbCharacterTechniqueEffect.SelectedIndex            = MainForm.GetIndexByValue(cbCharacterTechniqueEffect, (int)technique.Effect);
            numCharacterTechniqueCost.Text                      = technique.TPCost.ToString();
            numCharacterTechniqueEffectAmount.Text              = technique.EffectAmount.ToString();
            cbCharacterTechniqueTargetDefenseStat.SelectedIndex = MainForm.GetIndexByValue(cbCharacterTechniqueTargetDefenseStat, (int)technique.Defense);
            cbCharacterTechniqueEffectArea.SelectedIndex        = MainForm.GetIndexByValue(cbCharacterTechniqueEffectArea, (int)technique.EffectArea);
            cbCharacterTechniqueTarget.SelectedIndex            = MainForm.GetIndexByValue(cbCharacterTechniqueTarget, (int)technique.Target);
            cbCharacterTechniqueElement.SelectedIndex           = MainForm.GetIndexByValue(cbCharacterTechniqueElement, (int)technique.Element);
            lstCharacterTechniqueAnalyze.Items.Clear();
            foreach (Character character in MainForm.RomData.Characters)
            {
                foreach (int characterTechnique in character.TechniqueIDs)
                {
                    if (characterTechnique == item.ID && !lstCharacterTechniqueAnalyze.Items.Contains(character.CustomName))
                    {
                        lstCharacterTechniqueAnalyze.Items.Add(character.CustomName);
                    }
                }
            }
            int count = lstCharacterTechniqueAnalyze.Items.Count;

            lblCharacterTechniqueAnalyze.Text = (count < 1 ? "No" : count.ToString()) + " character" + (count == 1 ? "" : "s") + " use" + (count == 1 ? "s" : "") + " this technique:";
        }
Exemplo n.º 31
0
        public ViewResult Cv(int id)
        {
            CvViewModel CompleteCv      = new CvViewModel();
            Assigment   assigment       = new Assigment();
            Assigment   focusassingment = new Assigment();
            Employee    employee        = new Employee();

            Expertise  expertise  = new Expertise();
            Middleware middelware = new Middleware();
            Training   training   = new Training();
            Trade      trade      = new Trade();
            Technique  tech       = new Technique();

            var emp = EmployeeService.Get(id);

            CompleteCv.Employee        = employee.GetEmployeeView(emp);
            CompleteCv.Expertises      = expertise.GetExpertiseView(id);
            CompleteCv.Middlewares     = middelware.GetMiddlewareView(id);
            CompleteCv.Techniques      = tech.GetTechniqueView(id);
            CompleteCv.Trades          = trade.GetTradeView(id);
            CompleteCv.DegreeTraining  = training.GetDegreeTrainingView(id);
            CompleteCv.Trainings       = training.GetTrainingView(id);
            CompleteCv.Assigments      = assigment.GetAllNonFocusAssignments(id);
            CompleteCv.FocusAssigments = focusassingment.GetAllFocusAssignments(id);

            return(View(CompleteCv));
        }
        public void SetTechnique(Technique technique)
        {
            switch (technique)
            {
                case Technique.PositionColor:
                    m_D3DEffect.Technique = m_positionColorTechnique;
                    break;
                case Technique.Position:
                    m_D3DEffect.Technique = m_positionTechnique;
                    break;

                default:
                    System.Diagnostics.Debug.Assert(false);
                    break;
            }
        }
        public void SetTechnique(Technique technique)
        {
            switch (technique)
            {
                case Technique.DepthTestEnabled:
                    m_D3DEffect.Technique = m_depthTestTechnique;
                    break;

                case Technique.DepthTestDisabled:
                    m_D3DEffect.Technique = m_noDepthTestTechnique;
                    break;

                case Technique.DepthTestEnabledNonMRT:
                    m_D3DEffect.Technique = m_depthTestTechniqueNonMRT;
                    break;

                case Technique.DepthTestDisabledNonMRT:
                    m_D3DEffect.Technique = m_noDepthTestTechniqueNonMRT;
                    break;
            }
        }
Exemplo n.º 34
0
        public void SetTechnique(Technique technique)
        {
            switch (technique)
            {
                case Technique.HWScale:
                    m_D3DEffect.Technique = m_HWScale;
                    break;

                case Technique.HWScalePrefabPreviews:
                    m_D3DEffect.Technique = m_HWScalePrefabPreviews;
                    break;

                case Technique.Downscale4:
                    m_D3DEffect.Technique = m_downscale4;
                    break;

                case Technique.Downscale8:
                    m_D3DEffect.Technique = m_downscale8;
                    break;
            }
        }
        public void SetTechnique(Technique technique)
        {
            switch (technique)
            {
                case Technique.Sprite:
                    m_D3DEffect.Technique = spriteTechnique;
                    break;

                case Technique.SpriteBatchCube0:
                    m_D3DEffect.Technique = spriteTechniqueCube0;
                    break;

                case Technique.SpriteBatchCube1:
                    m_D3DEffect.Technique = spriteTechniqueCube1;
                    break;

                case Technique.SpriteBatchCube2:
                    m_D3DEffect.Technique = spriteTechniqueCube2;
                    break;

                case Technique.SpriteBatchCube3:
                    m_D3DEffect.Technique = spriteTechniqueCube3;
                    break;

                case Technique.SpriteBatchCube4:
                    m_D3DEffect.Technique = spriteTechniqueCube4;
                    break;

                case Technique.SpriteBatchCube5:
                    m_D3DEffect.Technique = spriteTechniqueCube5;
                    break;

                default:
                    System.Diagnostics.Debug.Assert(false);
                    break;
            }
        }
Exemplo n.º 36
0
        public void SetTechnique(Technique technique)
        {
            switch (technique)
            {
                case Technique.LightsEnabled:
                    m_D3DEffect.Technique = m_basicTechnique;
                    break;

                case Technique.LightsDisabled:
                    m_D3DEffect.Technique = m_disableLightsTechnique;
                    break;

                case Technique.OnlyLights:
                    m_D3DEffect.Technique = m_onlyLightsTechnique;
                    break;

                case Technique.OnlySpecularIntensity:
                    m_D3DEffect.Technique = m_onlySpecularIntensityTechnique;
                    break;

                case Technique.OnlySpecularPower:
                    m_D3DEffect.Technique = m_onlySpecularPowerTechnique;
                    break;

                case Technique.OnlyEmissivity:
                    m_D3DEffect.Technique = m_onlyEmissivityTechnique;
                    break;

                case Technique.OnlyReflectivity:
                    m_D3DEffect.Technique = m_onlyReflectivityTechnique;
                    break;

                case Technique.CopyEmissivity:
                    m_D3DEffect.Technique = m_copyEmissivity;
                    break;
            }
        }
        public void SetTechnique(Technique technique)
        {
            switch(technique)
            {
                case Technique.Colored:
                    m_D3DEffect.Technique = m_coloredTechnique;
                    break;

                case Technique.ColoredLit:
                    m_D3DEffect.Technique = m_coloredLitTechnique;
                    break;

                case Technique.Textured3D:
                    m_D3DEffect.Technique = m_textured3DTechnique;
                    break;

                default:
                    m_D3DEffect.Technique = m_defaultTechnique;
                    break;
            }
        }
Exemplo n.º 38
0
        public Profile_COMMON(XPathNodeIterator iterator, string uri)
        {
            _newParamList = new XmlColladaList();

            XPathNodeIterator nodesIterator = iterator.Current.SelectChildren(XmlCollada.Technique.root, uri);
            if (nodesIterator.Count > 0)
            {
                nodesIterator.MoveNext();
                _technique = new Technique(nodesIterator, uri);
            }

            nodesIterator = iterator.Current.SelectChildren(XmlCollada.NewParam.root, uri);
            while (nodesIterator.MoveNext())
            {
                _newParamList.Add(new NewParam(nodesIterator, uri));
            }
        }
Exemplo n.º 39
0
 public Profile_COMMON(Technique technique, XmlColladaList newParamList)
 {
     _technique = technique;
     _newParamList = newParamList;
     if (null == _newParamList)
     {
         _newParamList = new XmlColladaList();
     }
 }
        public void SetTechnique(Technique technique)
        {
            switch (technique)
            {
                case Technique.Lit:
                    m_D3DEffect.Technique = m_litBasicTechnique;
                    break;
                case Technique.Unlit:
                    m_D3DEffect.Technique = m_unlitBasicTechnique;
                    break;
                case Technique.UnlitForward:
                    m_D3DEffect.Technique = m_unlitBasicForwardTechnique;
                    break;
                case Technique.IgnoreDepth:
                    m_D3DEffect.Technique = m_ignoreDepthBasicTechnique;
                    break;
                case Technique.ColorizeHeight:
                    m_D3DEffect.Technique = m_colorizeTechnique;
                    break;

                case Technique.VisualizeOverdraw:
                    m_D3DEffect.Technique = m_visualizeOverdrawTechnique;
                    break;

                default:
                    throw new MyMwcExceptionApplicationShouldNotGetHere();
                    break;

            }
        }
Exemplo n.º 41
0
		/// <summary>
		/// Actually create this GraphicsResource resources.
		/// </summary>
		/// <param name="ctx">
		/// A <see cref="GraphicsContext"/> used for allocating resources.
		/// </param>
		protected override void CreateObject(GraphicsContext ctx)
		{
			if (ctx == null)
				throw new ArgumentNullException("ctx");

			// Bind this texture
			Bind(ctx);

			// In the case of no technique, texture will exists but it will be undefined

			if (_Technique != null) {
				// Create texture using technique
				_Technique.Create(ctx);
				// Technique no more useful: dispose it
				_Technique.Dispose();
				_Technique = null;
			
				// Generate mipmaps, if requested
				if (_RequiresMipMaps)
					GenerateMipmaps(ctx);
			}

			// Clear binding point
			Unbind(ctx);
		}
        public MyEffectDirectionalLight()
            : base("Effects2\\Lights\\MyEffectDirectionalLight")
        {
            m_normalsRT = m_D3DEffect.GetParameter(null, "NormalsRT");
            m_diffuseRT = m_D3DEffect.GetParameter(null, "DiffuseRT");
            m_depthsRT = m_D3DEffect.GetParameter(null, "DepthsRT");
            m_halfPixelAndScale = m_D3DEffect.GetParameter(null, "HalfPixelAndScale");
            m_shadowHalfPixel = m_D3DEffect.GetParameter(null, "ShadowHalfPixel");

            m_lightDirection = m_D3DEffect.GetParameter(null, "LightDirection");
            m_lightColorAndIntensity = m_D3DEffect.GetParameter(null, "LightColorAndIntensity");
            m_lightSpecularColor = m_D3DEffect.GetParameter(null, "LightSpecularColor");
            m_backlightColorAndIntensity = m_D3DEffect.GetParameter(null, "BacklightColorAndIntensity");

            m_worldViewProjMatrix = m_D3DEffect.GetParameter(null, "WorldViewProjMatrix");
            m_cameraMatrix = m_D3DEffect.GetParameter(null, "CameraMatrix");

            m_frustumCorners = m_D3DEffect.GetParameter(null, "FrustumCorners");
            m_enableCascadeBlending = m_D3DEffect.GetParameter(null, "EnableCascadeBlending");

            m_textureEnvironmentMain = m_D3DEffect.GetParameter(null, "TextureEnvironmentMain");
            m_textureEnvironmentAux = m_D3DEffect.GetParameter(null, "TextureEnvironmentAux");
            m_textureAmbientMain = m_D3DEffect.GetParameter(null, "TextureAmbientMain");
            m_textureAmbientAux = m_D3DEffect.GetParameter(null, "TextureAmbientAux");
            m_textureEnvironmentBlendFactor = m_D3DEffect.GetParameter(null, "TextureEnvironmentBlendFactor");
            m_cameraPosition = m_D3DEffect.GetParameter(null, "CameraPosition");

            m_enableAmbientEnvironment = m_D3DEffect.GetParameter(null, "EnableAmbientEnv");
            m_enableReflectionEnvironment = m_D3DEffect.GetParameter(null, "EnableReflectionEnv");
            m_ambientMinimumAndIntensity = m_D3DEffect.GetParameter(null, "AmbientMinimumAndIntensity");

            m_nearSlopeBiasDistance = m_D3DEffect.GetParameter(null, "NearSlopeBiasDistance");

            DefaultTechnique = Technique.Default;
            DefaultWithoutShadowsTechnique= Technique.WithoutShadows;
            DefaultNoLightingTechnique = Technique.NoLighting;

            m_lightingTechnique = m_D3DEffect.GetTechnique("Technique_Lighting");
            m_lightingWOShadowsTechnique = m_D3DEffect.GetTechnique("Technique_LightingWithoutShadows");
            m_noLightingTechnique = m_D3DEffect.GetTechnique("Technique_NoLighting");

            SetTechnique(DefaultTechnique);

        }
        public void SetTechnique(Technique technique)
        {
            switch (technique)
            {
                case Technique.Default:
                    m_D3DEffect.Technique = m_lightingTechnique;
                    break;

                case Technique.WithoutShadows:
                    m_D3DEffect.Technique = m_lightingWOShadowsTechnique;
                    break;

                case Technique.NoLighting:
                    m_D3DEffect.Technique = m_noLightingTechnique;
                    break;
                    
                default:
                    throw new InvalidBranchException();
            }
        }
Exemplo n.º 44
0
            /// <summary>
            /// 
            /// </summary>
            /// <param name="queue"></param>
            /// <param name="group"></param>
            public void AddSelfToRenderQueue(RenderQueue queue, RenderQueueGroupID group) {
                if (mBuild) {
                    //Update material technique based on camera distance
                    Debug.Assert(material != null);
#warning missing function getLodIndexSquaredDepth
                    mBestTechnique = material.GetBestTechnique(material.GetLodIndex(mParent.MinDistanceSquared));

                    //Add to render queue
                    queue.AddRenderable(this, group);
                }
            }
Exemplo n.º 45
0
 //        Effect currEffect;
 void setTechnique(Technique technique)
 {
     if (currTechnique == technique) return;
     currTechnique = technique;
     currTechnique.MakeDirty();
 }
Exemplo n.º 46
0
        public void SetTechnique(Technique technique)
        {
            switch (technique)
            {
                case Technique.Voxels:
                     m_D3DEffect.Technique = m_techniqueVoxelDecals;
                    break;
                case Technique.Model:
                     m_D3DEffect.Technique = m_techniqueModelDecals;
                    break;

                case Technique.VoxelsForward:
                    m_D3DEffect.Technique = m_techniqueVoxelDecalsForward;
                    break;
                case Technique.ModelForward:
                    m_D3DEffect.Technique = m_techniqueModelDecalsForward;
                    break;

                default:
                    throw new MyMwcExceptionApplicationShouldNotGetHere();
                    break;
            }
        }
        public void SetTechnique(Technique technique)
        {
            switch (technique)
            {
                case Technique.Default:
                    m_D3DEffect.Technique = m_lightingTechnique;
                    break;

                case Technique.WithoutShadows:
                    m_D3DEffect.Technique = m_lightingWOShadowsTechnique;
                    break;

                case Technique.NoLighting:
                    m_D3DEffect.Technique = m_noLightingTechnique;
                    break;
                    
                default:
                    throw new MyMwcExceptionApplicationShouldNotGetHere();
            }
        }
Exemplo n.º 48
0
		/// <summary>
		/// Set the technique used for creating this Texture.
		/// </summary>
		/// <param name="technique">
		/// 
		/// </param>
		protected void SetTechnique(Technique technique)
		{
			if (technique == null)
				throw new ArgumentNullException("technique");

			// Dispose previous technique, if any
			if (_Technique != null)
				_Technique.Dispose();
			// Replace technique
			_Technique = technique;
		}
        public void SetTechnique(Technique technique)
        {
            switch (technique)
            {
                case Technique.Voxels:
                     m_D3DEffect.Technique = m_techniqueVoxelDecals;
                    break;
                case Technique.Model:
                     m_D3DEffect.Technique = m_techniqueModelDecals;
                    break;

                default:
                    throw new InvalidBranchException();
            }
        }
        public void SetTechnique(Technique technique)
        {
            switch (technique)
            {
                case Technique.Lit:
                    m_D3DEffect.Technique = m_litBasicTechnique;
                    break;
                case Technique.Unlit:
                    m_D3DEffect.Technique = m_unlitBasicTechnique;
                    break;
                case Technique.UnlitForward:
                    m_D3DEffect.Technique = m_unlitBasicForwardTechnique;
                    break;
                case Technique.IgnoreDepth:
                    m_D3DEffect.Technique = m_ignoreDepthBasicTechnique;
                    break;
                case Technique.ColorizeHeight:
                    m_D3DEffect.Technique = m_colorizeTechnique;
                    break;

                case Technique.Reflection:
                    m_D3DEffect.Technique = m_reflectionTechnique;
                    break;

                case Technique.VisualizeOverdraw:
                    m_D3DEffect.Technique = m_visualizeOverdrawTechnique;
                    break;

                default:
                    throw new InvalidBranchException();
            }
        }
Exemplo n.º 51
0
 public void SetTechnique(Technique technique)
 {
     CurrentTechnique = Techniques[(int)technique];
 }