public override void Update(float fRealTime)
    {
        base.Update(fRealTime);
        if (!EffectContainer.CheckEffectavailable(uint.Parse(m_FrameConfig.InstanceId)))
        {
            m_bIsRunning = false;
        }

        if (m_bIsRunning)
        {
            float currentTime = TimeManager.Instance.GetTime();
            float yDeltaTime  = currentTime - m_fInitTime;

            m_fDeltaTime = currentTime - m_fLastTime;
            m_fLastTime  = currentTime;
            m_fLeftTime -= m_fDeltaTime;

            m_vDeltaSpace = m_fDeltaTime * m_fLastVx * m_vDir.normalized;
            m_EffectObj.transform.position += m_vDeltaSpace;

            m_vDeltaSpace   = m_EffectObj.transform.position;
            m_vDeltaSpace.y = yDeltaTime * m_fLastVy - 0.5f * 9.8f * yDeltaTime * yDeltaTime;
            m_EffectObj.transform.position = m_vDeltaSpace;

            m_vTargetPos = m_TargetObj.transform.position;
            m_fLastVx    = Vector3.Distance(m_EffectObj.transform.position, m_vTargetPos) / m_fLeftTime;


            Debuger.Log("vy " + m_EffectObj.transform.position.y);
            if (m_fLeftTime <= 0.0f)
            {
                m_bIsRunning = false;
            }
        }
    }
Example #2
0
        public static EffectContainer DrawSharedEffect(EffectContainer _effect, string _help)
        {
            _effect.Enabled = ICEEditorLayout.ToggleLeft("Effect", "", _effect.Enabled, true, _help);

            if (_effect.Enabled)
            {
                EditorGUI.indentLevel++;

                _effect.ReferenceObject = (GameObject)EditorGUILayout.ObjectField("Reference", _effect.ReferenceObject, typeof(GameObject), false);


                _effect.OffsetType = (RandomOffsetType)ICEEditorLayout.EnumPopup("Offset Type", "", _effect.OffsetType);

                EditorGUI.indentLevel++;

                if (_effect.OffsetType == RandomOffsetType.EXACT)
                {
                    _effect.Offset = EditorGUILayout.Vector3Field("Offset", _effect.Offset);
                }
                else
                {
                    _effect.OffsetRadius = ICEEditorLayout.Slider("Offset Radius", "", _effect.OffsetRadius, 0.25f, 0, 100);
                }

                EditorGUI.indentLevel--;

                _effect.Detach = EditorGUILayout.Toggle("Detach", _effect.Detach);
                EditorGUI.indentLevel--;
            }

            return(_effect);
        }
Example #3
0
        public bool Init()
        {
            if (m_inited)
            {
                return(false);
            }
            if (particleSystemPrefabs.Length == 0 || capacity <= 0)
            {
                m_inited = false;
                return(false);
            }

            m_pool = new EffectContainer[capacity];
            int prefabIndex = 0;

            for (int i = 0; i < capacity; i++)
            {
                var p = Instantiate(particleSystemPrefabs[prefabIndex]);
                p.playOnAwake = false;
                p.loop        = false;
                m_pool[i]     = new EffectContainer(p);
                prefabIndex++;
                if (prefabIndex >= particleSystemPrefabs.Length)
                {
                    prefabIndex = 0;
                }
            }
            m_inited = true;
            return(m_inited);
        }
Example #4
0
    private void OnTrigger()
    {
        //try get target
        var param = m_ActionPlayer.GetActionParam();

        if (null != param && null != param.Object && param.Object is FuncContext)
        {
            FuncContext context = param.Object as FuncContext;



            var userInstance = (EFuncTarget)(m_FrameConfig.TargetType) == EFuncTarget.EFT_Target
                ? (context.Get(FuncContext.ContextKey.Target) as Ilife)
                : (context.Get(FuncContext.ContextKey.User) as Ilife);

            if (null == userInstance)
            {
                //target is null
                return;
            }

            var        obj         = ((CharTransformData)(((ITransformBehaviour)(userInstance)).GetTransformData())).GetGameObject();
            uint       id          = uint.Parse(m_FrameConfig.InstanceId);
            GameObject objInstance = EffectContainer.EffectFactory(m_FrameConfig.EffectName, id);
            objInstance.transform.position    = obj.transform.position + m_FrameConfig.Pos.GetVector3();
            objInstance.transform.eulerAngles = obj.transform.eulerAngles + m_FrameConfig.Rot.GetVector3();
        }
    }
    public override EFuncRet FuncExecHandler(HandleTarget Target, FuncData funcdata, FuncContext context)
    {
        try
        {
            ThriftVector3 pos = new ThriftVector3();
            pos.X = funcdata.ParamIntList[0];
            pos.Y = funcdata.ParamIntList[1];
            pos.Z = funcdata.ParamIntList[2];

            ThriftVector3 rot = new ThriftVector3();
            rot.X = 0;
            rot.Y = funcdata.ParamIntList[3];
            rot.Z = 0;

            ThriftVector3 scal = new ThriftVector3();
            scal.X = funcdata.ParamIntList[4];
            scal.Y = funcdata.ParamIntList[4];
            scal.Z = funcdata.ParamIntList[4];
            GameObject elem = EffectContainer.EffectFactory(funcdata.ParamStringList[0]);
            elem.transform.position    = pos.GetVector3();
            elem.transform.eulerAngles = rot.GetVector3();
            elem.transform.localScale  = scal.GetVector3();
        }
        catch
        {
        }

        return(EFuncRet.Continue);
    }
Example #6
0
        public void render()
        {
            //just needed if shader effect
            EffectContainer.updateMutable(landscape);
            EffectContainer.drawMutable();
            foreach (EffectPass pass in EffectContainer.getEffect().CurrentTechnique.Passes)
            {
                pass.Apply();
                //just needed if BasicEffect
                if (EffectContainer.getEffect().GetType() == typeof(BasicEffect))
                {
                    ((BasicEffect)EffectContainer.getEffect()).EnableDefaultLighting();
                    ((BasicEffect)EffectContainer.getEffect()).LightingEnabled        = true;
                    ((BasicEffect)EffectContainer.getEffect()).PreferPerPixelLighting = true;

                    ((BasicEffect)EffectContainer.getEffect()).DirectionalLight0.Enabled       = true;
                    ((BasicEffect)EffectContainer.getEffect()).DirectionalLight0.DiffuseColor  = new Vector3(0.5f, 0, 0);
                    ((BasicEffect)EffectContainer.getEffect()).DirectionalLight0.SpecularColor = new Vector3(0, 1, 0);
                    ((BasicEffect)EffectContainer.getEffect()).DirectionalLight0.Direction     = new Vector3(1, -1, -1);
                    ((BasicEffect)EffectContainer.getEffect()).AmbientLightColor = new Vector3(0.5f, 0.7f, 0.7f);
                    ((BasicEffect)EffectContainer.getEffect()).EmissiveColor     = new Vector3(1, 0, 0);

                    landscape.Scene.Game.GraphicsDevice.Textures[0] = landscape.Scene.TextureManager.getTexture("base");
                }
                landscape.Scene.Game.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, (patchSize / mapDetail) * (patchSize / mapDetail) * 6 * patchIndex, ((patchSize / mapDetail) + 1) * ((patchSize / mapDetail) + 1), (patchSize / mapDetail) * (patchSize / mapDetail) * 6 * patchIndex, (patchSize / mapDetail) * (patchSize / mapDetail) * 2);
                //device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, (patchSize / mapDetail) * (patchSize / mapDetail) * 6, ((patchSize / mapDetail) + 1) * ((patchSize / mapDetail) + 1), (patchSize / mapDetail) * (patchSize / mapDetail) * 6, (patchSize / mapDetail) * (patchSize / mapDetail) * 2);
            }
        }
    private void OnTrigger()
    {
        //try get target
        var param = m_ActionPlayer.GetActionParam();

        if (null != param && null != param.Object && param.Object is FuncContext)
        {
            FuncContext context = param.Object as FuncContext;

            Ilife userInstance = context.Get(FuncContext.ContextKey.Target) as Ilife;
            if (null == userInstance)
            {
                return;
            }
            m_TargetObj  = ((CharTransformData)(((ITransformBehaviour)(userInstance)).GetTransformData())).GetGameObject();
            m_EffectObj  = EffectContainer.GetInstance(uint.Parse(m_FrameConfig.InstanceId));
            m_vTargetPos = m_TargetObj.transform.position;
            m_fLeftTime  = (float)(m_FrameConfig.Time);
            m_fHigh      = (float)(m_FrameConfig.High);

            m_fInitTime = TimeManager.Instance.GetTime();
            m_fLastTime = m_fInitTime;
            m_fLastVx   = Vector3.Distance(m_EffectObj.transform.position, m_vTargetPos) / m_fLeftTime;
            m_fLastVy   = (float)(0.5f * 9.8 * m_fLeftTime);
            m_vInitPos  = m_EffectObj.transform.position;
            m_vDir      = m_vTargetPos - m_vInitPos;

            m_vDeltaSpace.Normalize();

            m_bIsRunning = true;
        }
    }
Example #8
0
        private void OnLayerDragDrop(object sender, DragEventArgs e)
        {
            if (e.Effect != DragDropEffects.Copy)
            {
                return;
            }

            var fmts = e.Data.GetFormats();

            if (fmts == null || fmts.Length != 1)
            {
                return;
            }

            LayerEffect effect = e.Data.GetData(fmts[0]) as LayerEffect;

            CurrentDragLayer = true;
            CurrentDrag      = this;
            if (effect != null)
            {
                //effect.Layer = this._layer.Shape
                switch (effect.Type)
                {
                case EffectType.Entry:
                    effect.Duration = this.ctlEntryEffect.Width == 0 ? 2 : ctlEntryEffect.Effect.Duration;
                    break;

                case EffectType.Exit:
                    effect.Duration = this.ctlExitEffect.Width == 0 ? 2 : ctlExitEffect.Effect.Duration;
                    break;

                default:
                    effect.Duration = this.ctlEmphasis.Width == 0 ? 8 : ctlEmphasis.Effect.Duration;
                    break;
                }
                //if (effect.Duration == 0)
                //    effect.Duration = 2;//ControlService.SignCombo.Current.Template.Message. 2;
                ////else
                ////    effect.Duration++;
                UndoService.BeginTransaction(String.Format("Add a {0} effect", effect.Type));
                UndoService.AddLayerEffectAddedAction(effect);

                AddEffectFromDragDrop(effect);

                UndoService.Commit();
                ControlService.RefreshPropertyGrid(_layer);
                CurrentDragLayer = false;
                return;
            }

            LayerControl frameLayer = e.Data.GetData(typeof(LayerControl)) as LayerControl;

            if (frameLayer != null)
            {
                OnDragLayer(frameLayer);
            }

            EffectContainer.Invalidate();
        }
Example #9
0
    private void OnTrigger()
    {
        GameObject objInstance = EffectContainer.GetInstance(uint.Parse(m_FrameConfig.InstanceId));

        if (null != objInstance)
        {
            GameObject.Destroy(objInstance);
        }
    }
    private GameObject CreateEffect()
    {
        //try get target
        uint       id          = (uint)(m_FrameConfig.InstanceId);
        GameObject objInstance = EffectContainer.EffectFactory(m_FrameConfig.EffectName, id);


        return(objInstance);
    }
Example #11
0
 public void setAllPatchesEffect(EffectContainer effect)
 {
     for (int j = 0; j < numPatchesPerSide; j++)
     {
         for (int i = 0; i < numPatchesPerSide; i++)
         {
             m_Patches[i, j].setEffect(effect);
         }
     }
 }
    public override void Destory()
    {
        uint       id          = (uint)(m_FrameConfig.InstanceId);
        GameObject objInstance = EffectContainer.GetInstance(id);

        if (null != objInstance)
        {
            GameObject.Destroy(objInstance);
        }
    }
Example #13
0
    private void CreateEffect()
    {
        //check name
        var source = ResourceManager.Instance.LoadBuildInResource <GameObject>(m_strResourceName, AssetType.Effect);

        if (null == source)
        {
            // log error
            EditorUtility.DisplayDialog("", "特效文件读取失败", "ok");
        }
        else
        {
            m_instanceId = EffectContainer.CreateInstanceId();
            Debuger.Log(m_instanceId);
        }
    }
Example #14
0
 public override void setEffect(EffectContainer effectContainer)
 {
     base.setEffect(effectContainer);
     foreach (ModelMesh mesh in model.Meshes)
     {
         foreach (ModelMeshPart meshPart in mesh.MeshParts)
         {
             if (effectContainer.getEffect().GetType() != typeof(BasicEffect))
             {
                 meshPart.Effect = effectContainer.getEffect();
             }
             else
             {
             }
         }
     }
 }
Example #15
0
    public static GameObject EffectFactory(string name, uint id = 0)
    {
        GameObject source = ResourceManager.Instance.LoadBuildInResource <GameObject>(name, AssetType.Effect);

        if (null == source)
        {
            Debuger.LogWarning("can't load effect " + name);
            return(null);
        }

        GameObject      instance  = GameObject.Instantiate(source);
        EffectContainer container = instance.AddComponent <EffectContainer>();

        container.Initialize(id);

        // create effect
        return(instance);
    }
Example #16
0
        public Control()
        {
            // Asettaa vakio alingmentin.
            alingment = new Alingment()
            {
                Horizontal = HorizontalAlingment.None,
                Vertical   = VerticalAlingment.None
            };
            // Asettaa vakio värit.
            colors = new Colors()
            {
                Foreground = Color.Black,
                Background = Color.White
            };
            FocusIndex = Index.Empty;

            size     = ControlSize.Default();
            position = ControlPosition.Default();

            updateActions = new List <Action <Control> >();
            Effects       = new EffectContainer();

            MakeDispatchers();
        }
    public bool Fire(string effectName, Color color)
    {
        if (EffectContainer.GetEffectCount() > 5)
        {
            Debuger.LogWarning("system busy");
            return(false);
        }

        m_strEffectName = effectName;

        GameObject effect = EffectContainer.EffectFactory(m_strEffectName);

        if (effect == null)
        {
            Debuger.LogWarning("can't load target effect " + m_strEffectName);
            return(false);
        }
        effect.transform.position = m_EffectPos;
        m_EffectObj = effect;

        SetEffectColor(m_EffectObj, color);
        m_Window.Reset();
        return(true);
    }
Example #18
0
 public void AddEffect(EffectContainer cont)
 {
     _effectList.Add(cont);
 }
Example #19
0
 protected override void OnPlay()
 {
     GameObject obj = EffectContainer.EffectFactory("");
 }
Example #20
0
 public virtual void setEffect(EffectContainer effectContainer)
 {
     this.effectContainer = effectContainer;
     this.effectContainer.updateUniform(this);
     this.effectContainer.drawUniform();
 }
Example #21
0
 public bool Equals(EffectContainer obj)
 {
     return(id == obj.id);
 }
Example #22
0
        /// <summary>
        /// here we do text parsing of console and if we have a function
        /// we compile it and assign the function value to y coordinate
        /// of wave
        /// </summary>
        /// <param name="funDef">definition of function, source code or command</param>
        public void compile(String funDef)
        {
            //text parsing
            // first own commands
            bool ownCommandExecuted = false;

            /*
             * if (obj.getCurrentEffect() != null)
             * {
             *  foreach (DictionaryEntry de in engine.getCurrentEffect().getContainer().getCommands())
             *  {
             *      try
             *      {
             *          if (funDef.StartsWith((String)de.Key))
             *          {
             *              obj.getCurrentEffect().updateUniformData((String)de.Value, funDef.Substring(((String)de.Key).Length + 1));
             *              ownCommandExecuted = true;
             *          }
             *      }
             *      catch (Exception e)
             *      {
             *          statusWindow.loadString(e.Message);
             *          statusWindow.showStatusWindow();
             *      }
             *  }
             * }
             */
            if (!ownCommandExecuted)
            {
                // then build in commands
                if (funDef.StartsWith("help"))
                {
                    RenderEngine.Status.loadText("Readme.txt");
                    RenderEngine.Status.IsVisible = true;
                }

                /*
                 * insert own command code here
                 */
                /* for exercise
                 * else if (funDef.StartsWith("landscape"))
                 * {
                 *      if (funDef.Length > 9)
                 *      {
                 *              if (funDef.Substring(10).Equals("on"))
                 *              {
                 *                      engine.showLandscape(true);
                 *              }
                 *              else if (funDef.Substring(10).Equals("off"))
                 *              {
                 *                      engine.showLandscape(false);
                 *              }
                 *              else
                 *              {
                 *                      statusWindow.loadString("Error: not a valid command");
                 *                      statusWindow.showStatusWindow();
                 *              }
                 *      }
                 * }*/
                else if (funDef.StartsWith("fullscreen"))
                {
                    if (funDef.Length > 10)
                    {
                        if (funDef.Substring(11).Equals("on"))
                        {
                            engine.fullscreen(true);
                        }
                        else if (funDef.Substring(11).Equals("off"))
                        {
                            engine.fullscreen(false);
                        }
                        else
                        {
                            RenderEngine.Status.loadString("Error: not a valid command");
                            RenderEngine.Status.IsVisible = true;
                        }
                    }
                }
                else if (funDef.StartsWith("time"))
                {
                    if (funDef.Length > 4)
                    {
                        if (funDef.Substring(5).Equals("on"))
                        {
                            water.changeTimerProperty(true);
                        }
                        else if (funDef.Substring(5).Equals("off"))
                        {
                            water.changeTimerProperty(false);
                        }
                        else
                        {
                            RenderEngine.Status.loadString("Error: not a valid command");
                            RenderEngine.Status.IsVisible = true;
                        }
                    }
                }
                else if (funDef.StartsWith("quads"))
                {
                    try
                    {
                        water.changeQuadNumber(Convert.ToUInt16(funDef.Substring(6)));
                    }
                    catch (Exception e)
                    {
                        RenderEngine.Status.loadString(e.Message);
                        RenderEngine.Status.IsVisible = true;
                    }
                }
                else if (funDef.StartsWith("xgrid"))
                {
                    try
                    {
                        water.changeXGrid(Convert.ToSingle(funDef.Substring(6)));
                    }
                    catch (Exception e)
                    {
                        RenderEngine.Status.loadString(e.Message);
                        RenderEngine.Status.IsVisible = true;
                    }
                }
                else if (funDef.StartsWith("zgrid"))
                {
                    try
                    {
                        water.changeZGrid(Convert.ToSingle(funDef.Substring(6)));
                    }
                    catch (Exception e)
                    {
                        RenderEngine.Status.loadString(e.Message);
                        RenderEngine.Status.IsVisible = true;
                    }
                }
                else if (funDef.StartsWith("xstep"))
                {
                    try
                    {
                        water.changeXStep(Convert.ToSingle(funDef.Substring(6)));
                    }
                    catch (Exception e)
                    {
                        RenderEngine.Status.loadString(e.Message);
                        RenderEngine.Status.IsVisible = true;
                    }
                }
                else if (funDef.StartsWith("zstep"))
                {
                    try
                    {
                        water.changeZStep(Convert.ToSingle(funDef.Substring(6)));
                    }
                    catch (Exception e)
                    {
                        RenderEngine.Status.loadString(e.Message);
                        RenderEngine.Status.IsVisible = true;
                    }
                }
                else if (funDef.StartsWith("loadEffect"))
                {
                    try
                    {
                        String[]        paramLoadEffect = funDef.Split(' ');
                        Object3D        obj             = (Object3D)RenderEngine.ObjectList[paramLoadEffect[1]];
                        EffectContainer ec = new EffectContainer(RenderEngine.Game, engine.TextureManager, paramLoadEffect[2], true);
                        obj.setEffect(ec);
                        updateEffectStatus();
                    }
                    catch (Exception e)
                    {
                        RenderEngine.Status.loadString(e.Message);
                        RenderEngine.Status.IsVisible = true;
                    }
                }
                else if (funDef.StartsWith("deleteEffect"))
                {
                    try
                    {
                        String[] paramLoadEffect = funDef.Split(' ');
                        Object3D obj             = (Object3D)RenderEngine.ObjectList[paramLoadEffect[1]];
                        obj.setEffect(null);
                        updateEffectStatus();
                    }
                    catch (Exception e)
                    {
                        RenderEngine.Status.loadString(e.Message);
                        RenderEngine.Status.IsVisible = true;
                    }
                }
                else if (funDef.StartsWith("status"))
                {
                    if (funDef.Length > 6)
                    {
                        if (funDef.Substring(7).Equals("effects"))
                        {
                            updateEffectStatus();
                            RenderEngine.Status.IsVisible = true;
                        }
                        else if (funDef.Substring(7).Equals("functions"))
                        {
                            RenderEngine.Status.loadList(funString, funShort);
                            RenderEngine.Status.IsVisible = true;
                        }
                    }
                }
                else if (funDef.StartsWith("remove"))
                {
                    if (funDef.Length > 6)
                    {
                        if (funDef.Substring(7).Equals("all"))
                        {
                            funActive.Clear();
                            funString.Clear();
                            RenderEngine.Status.loadList(funString, funShort);
                        }
                        else if (funDef.Substring(7, 1).Equals("A"))
                        {
                            try
                            {
                                funActive.RemoveAt(Convert.ToInt32(funDef.Substring(8)));
                                funString.RemoveAt(Convert.ToInt32(funDef.Substring(8)));
                                RenderEngine.Status.loadList(funString, funShort);
                            }
                            catch (Exception e)
                            {
                                RenderEngine.Status.loadString(e.Message);
                                RenderEngine.Status.IsVisible = true;
                            }
                        }
                        else
                        {
                            RenderEngine.Status.loadString("Error: not a valid command");
                            RenderEngine.Status.IsVisible = true;
                        }
                    }
                }
                else
                {
                    String sourceCode = "";
                    // code for function compiling
                    if (funDef.Contains("F")) // replace shortkeys with real function name
                    {
                        String help = funDef;
                        while (help.Contains("F"))
                        {
                            if ((String)funShort[help.Substring(help.IndexOf("F"), 2)] != null) // F - String is real shortcut
                            {
                                funDef = funDef.Replace(help.Substring(help.IndexOf("F"), 2), (String)funShort[help.Substring(help.IndexOf("F"), 2)]);
                                help   = help.Substring(help.IndexOf("F") + 1);
                            }
                            else
                            {
                                help = help.Substring(help.IndexOf("F") + 1);
                            }
                        }
                    }
                    // code for source compiling
                    if (funDef.Contains("C")) // replace shortkeys with real function name
                    {
                        int    codeCount = 0;
                        String help      = funDef;
                        while (help.Contains("C"))
                        {
                            if ((String)funShort[help.Substring(help.IndexOf("C"), 2)] != null) // C - String is real shortcut
                            {
                                funDef = funDef.Replace(help.Substring(help.IndexOf("C"), 2), (String)funShort[help.Substring(help.IndexOf("C"), 2)]);
                                help   = help.Substring(help.IndexOf("C") + 1);
                                codeCount++;
                            }
                            else
                            {
                                help = help.Substring(help.IndexOf("C") + 1);
                            }
                        }
                        // String contains shortkey for source code
                        if (codeCount > 0)
                        {
                            sourceCode = funDef;
                            funDef     = "0.0";
                        }
                    }

                    if (funDef.Equals("compile"))
                    {
                        sourceCode = RenderEngine.Code.getSourceCode();
                        funDef     = "0.0"; // indicates that we must compile source code
                    }
                    // remove whitespaces for functions, so Math.Sin(x) is the same as Math.Sin( x )
                    funDef = funDef.Replace(" ", "");

                    // Chapter 4.6, Listing 4.6.2
                    // code for function and source compiling
                    //funTable cant contain "" or "0.0" so this is allowed
                    if (!funTable.ContainsKey(funDef) && !funTable.ContainsKey(sourceCode))
                    {
                        // Template code including dummies for function and code string
                        String source = "using System; using OwnFunctions; namespace Water3D {public class CompiledExpression {public static double f(double x, double z, double t) {###s###; return ###f###;}}}";

                        // replace dummy with function
                        source = source.Replace("###s###", sourceCode);
                        source = source.Replace("###f###", funDef);

                        // generate c# code provider to create the compiler
                        CSharpCodeProvider provider = new CSharpCodeProvider();

                        // set compiler parameters
                        CompilerParameters cps = new CompilerParameters();
                        cps.GenerateInMemory = true;
                        cps.ReferencedAssemblies.Add("System.dll");
                        cps.ReferencedAssemblies.Add("OwnFunctions.dll");

                        //compile code
                        CompilerResults cr = provider.CompileAssemblyFromSource(cps, source);

                        //look for compile errors
                        if (cr.Errors.Count > 0)
                        {
                            String text = "Compile Errors:\n";
                            for (int i = 0; i < cr.Errors.Count; i++)
                            {
                                text += cr.Errors[i].ErrorText + "\n";
                            }

                            RenderEngine.Status.loadString(text);
                            RenderEngine.Status.IsVisible = true;
                            f = null;
                        }
                        else
                        {
                            Type cet = cr.CompiledAssembly.GetType("Water3D.CompiledExpression");

                            f = (fDelegate)System.Delegate.CreateDelegate(typeof(fDelegate), cet.GetMethod("f", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static));

                            // normal function
                            if (!funDef.Equals("0.0") && sourceCode.Equals(""))
                            {
                                funActive.Add(f);
                                funString.Add(funDef);
                                funShort.Add("F" + shortFunIt, funDef);
                                funTable.Add(funDef, f);
                                shortFunIt++;
                            }
                            // code snippet
                            if (funDef.Equals("0.0") && !sourceCode.Equals(""))
                            {
                                funActive.Add(f);
                                funString.Add(sourceCode);
                                funShort.Add("C" + shortCodeIt, sourceCode);
                                funTable.Add(sourceCode, f);
                                shortCodeIt++;
                            }
                            RenderEngine.Status.loadList(funString, funShort);
                        }
                    }
                    else // we dont need to compile
                    {
                        if (!funDef.Equals("0.0") && sourceCode.Equals(""))
                        {
                            funActive.Add((fDelegate)funTable[funDef]);
                            funString.Add(funDef);
                            RenderEngine.Status.loadList(funString, funShort);
                        }
                        if (funDef.Equals("0.0") && !sourceCode.Equals(""))
                        {
                            funActive.Add((fDelegate)funTable[sourceCode]);
                            funString.Add(sourceCode);
                            RenderEngine.Status.loadList(funString, funShort);
                        }
                    }
                }
            }
        }
Example #23
0
        public static string Decompile(EffectContainer effectChunk)
        {
            var asmWriter = new EffectHLSLWriter(effectChunk);

            return(asmWriter.Decompile());
        }
Example #24
0
 public EffectHLSLWriter(EffectContainer effectChunk)
 {
     EffectChunk = effectChunk;
 }