예제 #1
0
        public InstanceSet(vxEngine vxEngine)
        {
            this.vxEngine = vxEngine;

            mGraphicsDevice = vxEngine.GraphicsDevice;

            mInstanceVertexDeclaration = new VertexDeclaration(new[]
            {
                new VertexElement(0, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 2),
                new VertexElement(16, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 3),
                new VertexElement(32, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 4),
                new VertexElement(48, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 5)
            });
        }
예제 #2
0
        public void Initialise(vxEngine vxEngine)
        {
            foreach (ModelMeshPart part in InstancedModel.ModelMain.Meshes.SelectMany(m => m.MeshParts))
            {
                part.Effect.Parameters["LightDirection"].SetValue(Vector3.Normalize(new Vector3(100, 130, 0)));

                part.Effect.Parameters["LightColor"].SetValue(new Vector4(0.8f, 0.8f, 0.8f, 1.0f));
                part.Effect.Parameters["AmbientLightColor"].SetValue(new Vector4(0.2f, 0.2f, 0.2f, 1.0f));


                part.Effect.Parameters["Shininess"].SetValue(0.01f);
                part.Effect.Parameters["SpecularIntensity"].SetValue(8.0f);

                part.Effect.Parameters["PoissonKernel"].SetValue(vxEngine.Renderer.poissonKernel);
                part.Effect.Parameters["RandomTexture3D"].SetValue(vxEngine.Renderer.RandomTexture3D);
                part.Effect.Parameters["RandomTexture2D"].SetValue(vxEngine.Renderer.RandomTexture3D);
                part.Effect.CurrentTechnique = part.Effect.Techniques["Lambert"];
            }

            foreach (var eff in InstancedModel.ModelShadow.Meshes.SelectMany(m => m.Effects))
            {
                eff.CurrentTechnique = eff.Techniques["ShadowInstanced"];
            }



            foreach (ModelMeshPart part in InstancedModel.ModelMain.Meshes.SelectMany(m => m.MeshParts))
            {
                part.Effect.Parameters["LightDirection"].SetValue(Vector3.Normalize(new Vector3(100, 130, 0)));

                part.Effect.Parameters["LightColor"].SetValue(new Vector4(0.8f, 0.8f, 0.8f, 1.0f));
                part.Effect.Parameters["AmbientLightColor"].SetValue(new Vector4(0.2f, 0.2f, 0.2f, 1.0f));


                part.Effect.Parameters["Shininess"].SetValue(0.01f);
                part.Effect.Parameters["SpecularIntensity"].SetValue(8.0f);

                part.Effect.Parameters["PoissonKernel"].SetValue(vxEngine.Renderer.poissonKernel);
                part.Effect.Parameters["RandomTexture3D"].SetValue(vxEngine.Renderer.RandomTexture3D);
                part.Effect.Parameters["RandomTexture2D"].SetValue(vxEngine.Renderer.RandomTexture3D);
                part.Effect.CurrentTechnique = part.Effect.Techniques["Lambert"];
            }

            foreach (var eff in InstancedModel.ModelShadow.Meshes.SelectMany(m => m.Effects))
            {
                eff.CurrentTechnique = eff.Techniques["ShadowInstanced"];
            }
        }
예제 #3
0
 public vxAlphaEntity3D(vxEngine Engine, vxModel model, Vector3 Pos) :
     base(Engine, model, Pos)
 {
     Texture = Engine.Assets.Textures.Blank;
 }
예제 #4
0
        /// <summary>
        /// Initialises the vxConsole Static Object.
        /// </summary>
        /// <param name="engine">Engine.</param>
        public static void Initialize(vxEngine engine)
        {
            vxEngine = engine;

            Variables = new Dictionary <object, vxVar> ();


            #region Graphics Variables
            AddVar(new vxVar(vxEnumEnvVarType.RES_X,
                             engine.GraphicsDevice.PresentationParameters.BackBufferWidth,
                             "The Resolution Width",
                             delegate(vxVar v) {
                Console.WriteLine("Setting '" + v.Name + "' to " + v.Value);
            }
                             ));

            AddVar(new vxVar(vxEnumEnvVarType.RES_Y,
                             engine.GraphicsDevice.PresentationParameters.BackBufferHeight,
                             "The Resolution Height",
                             delegate(vxVar v) {
                Console.WriteLine("Setting '" + v.Name + "' to " + v.Value);
            }
                             ));

            vxVar newvar = new vxVar(vxEnumEnvVarType.FLSCRN,
                                     engine.GraphicsDevice.PresentationParameters.IsFullScreen,
                                     "Full Screen",
                                     delegate(vxVar v) {
                Console.WriteLine("Setting '" + v.Name + "' to " + v.Value);
            });
            AddVar(newvar);

            AddVar(new vxVar(vxEnumEnvVarType.VSYNC,
                             true,
                             "Vsync",
                             delegate(vxVar v) {
                Console.WriteLine("Setting '" + v.Name + "' to " + v.Value);
            }
                             ));

            #endregion

            #region DEBUG Variables

            AddVar(new vxVar(vxEnumEnvVarType.DEBUG_MESH, false,
                             "Toggles the Debug Mesh for Physics"));

            AddVar(new vxVar(vxEnumEnvVarType.DEBUG_RNDRTRGT, false,
                             "Toggles viewing the Individual Render Targets"));

            AddVar(new vxVar(vxEnumEnvVarType.DEBUG_INGMECNSL, false,
                             "Toggles the In-Game Debug Window"));

            AddVar(new vxVar(vxEnumEnvVarType.DEBUG_SHW_FPS, false,
                             "Toggles the FPS Counter"));

            AddVar(new vxVar(vxEnumEnvVarType.DEBUG_SHW_TIMERULES, false,
                             "Toggles the Time Ruler Debuger"));

            #endregion

            #region Enviroment File Paths

            string enginecontentpath = "Virtex.Lib.Vertices.Core";

                        #if VRTC_PLTFRM_XNA
            enginecontentpath = "Content/vxengine";
                        #elif VRTC_PLTFRM_GL
            enginecontentpath = "Vertices.Engine.Content/Compiled.DesktopGL";
                        #elif VRTC_PLTFRM_DROID
            enginecontentpath = "Vertices.Engine.Content/Compiled.Android";
                        #endif
            AddVar(new vxVar(vxEnumEnvVarType.PATH_ENGINE_CONTENT, enginecontentpath,
                             "Path to the Engine Content Folder"));



            string path             = "Profiles/";
            string virtexrootfolder = "virtexedgegames";
                        #if VRTC_PLTFRM_XNA
            path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\" + virtexrootfolder + "\\" + vxEngine.GameName + "\\" + path;
                        #elif VRTC_PLTFRM_GL
            //In Unix Systems, Hide the Folder
            path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/." + virtexrootfolder + "/" + vxEngine.GameName + "/" + path;
                        #endif
            AddVar(new vxVar(vxEnumEnvVarType.PATH_SETTINGS, path,
                             "Path to the Settings Folder"));


            string sndpath = "Sandbox/";
                        #if VRTC_PLTFRM_XNA
            sndpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\" + virtexrootfolder + "\\" + vxEngine.GameName + "\\" + sndpath;
                        #elif VRTC_PLTFRM_GL
            sndpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/." + virtexrootfolder + "/" + vxEngine.GameName + "/" + sndpath;
                        #endif
            AddVar(new vxVar(vxEnumEnvVarType.PATH_SANDBOX, sndpath,
                             "Path to the Sandbox Folder"));

            #endregion
        }