+++ /dev/null
-/*\r
-* Copyright (c) 2007-2010 SlimDX Group\r
-* \r
-* Permission is hereby granted, free of charge, to any person obtaining a copy\r
-* of this software and associated documentation files (the "Software"), to deal\r
-* in the Software without restriction, including without limitation the rights\r
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
-* copies of the Software, and to permit persons to whom the Software is\r
-* furnished to do so, subject to the following conditions:\r
-* \r
-* The above copyright notice and this permission notice shall be included in\r
-* all copies or substantial portions of the Software.\r
-* \r
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
-* THE SOFTWARE.\r
-*/\r
-#pragma once\r
-\r
-#include <vcclr.h>\r
-#include "Device.h"\r
-#include "BaseEffect.h"\r
-#include "EffectStateManager.h"\r
-#include "IResettable.h"\r
-#include "Macro.h"\r
-#include "Include.h"\r
-#include "EffectPool9.h"\r
-\r
-namespace SlimDX\r
-{\r
- ref class DataStream;\r
-\r
- namespace Direct3D9\r
- {\r
- /// <summary>\r
- /// Represents a Direct3D rendering effect.\r
- /// </summary>\r
- /// <unmanaged>ID3DXEffect</unmanaged>\r
- public ref class Effect : public BaseEffect, public IResettable\r
- {\r
- COMOBJECT_CUSTOM(ID3DXEffect, Effect);\r
-\r
- private:\r
- IEffectStateManagerShim *shim;\r
- \r
- static Effect^ FromMemory_Internal( Device^ device, const void* memory, UINT size, array<Macro>^ preprocessorDefines, Include^ includeFile, System::String^ skipConstants, ShaderFlags flags, EffectPool^ pool, System::String^* compilationErrors, System::Exception^* exception );\r
-\r
- public:\r
- /// <summary>\r
- /// Releases all resources used by the <see cref="Effect"/>.\r
- /// </summary>\r
- virtual ~Effect() { if( shim != NULL ) shim->Release(); shim = NULL; }\r
-\r
- /// <summary>\r
- /// Creates an effect from a block of memory.\r
- /// </summary>\r
- /// <param name="device">The device used to create the effect.</param>\r
- /// <param name="memory">A block of memory containing the effect data.</param>\r
- /// <param name="preprocessorDefines">A set of preprocessor definitions.</param>\r
- /// <param name="includeFile">An include file handler.</param>\r
- /// <param name="skipConstants">A set of constants that will be ignored by the effect system.</param>\r
- /// <param name="flags">A set of flags describing effect creation options.</param>\r
- /// <param name="pool">The pool used for shared effect parameters.</param>\r
- /// <param name="compilationErrors">When the method completes, contains compilation errors and warnings.</param>\r
- /// <returns>The created effect object.</returns>\r
- static Effect^ FromMemory( Device^ device, array<System::Byte>^ memory, array<Macro>^ preprocessorDefines, Include^ includeFile, System::String^ skipConstants, ShaderFlags flags, EffectPool^ pool, [Out] System::String^ %compilationErrors );\r
-\r
- /// <summary>\r
- /// Creates an effect from a block of memory.\r
- /// </summary>\r
- /// <param name="device">The device used to create the effect.</param>\r
- /// <param name="memory">A block of memory containing the effect data.</param>\r
- /// <param name="preprocessorDefines">A set of preprocessor definitions.</param>\r
- /// <param name="includeFile">An include file handler.</param>\r
- /// <param name="skipConstants">A set of constants that will be ignored by the effect system.</param>\r
- /// <param name="flags">A set of flags describing effect creation options.</param>\r
- /// <param name="pool">The pool used for shared effect parameters.</param>\r
- /// <returns>The created effect object.</returns>\r
- static Effect^ FromMemory( Device^ device, array<System::Byte>^ memory, array<Macro>^ preprocessorDefines, Include^ includeFile, System::String^ skipConstants, ShaderFlags flags, EffectPool^ pool );\r
-\r
- /// <summary>\r
- /// Creates an effect from a block of memory.\r
- /// </summary>\r
- /// <param name="device">The device used to create the effect.</param>\r
- /// <param name="memory">A block of memory containing the effect data.</param>\r
- /// <param name="preprocessorDefines">A set of preprocessor definitions.</param>\r
- /// <param name="includeFile">An include file handler.</param>\r
- /// <param name="skipConstants">A set of constants that will be ignored by the effect system.</param>\r
- /// <param name="flags">A set of flags describing effect creation options.</param>\r
- /// <returns>The created effect object.</returns>\r
- static Effect^ FromMemory( Device^ device, array<System::Byte>^ memory, array<Macro>^ preprocessorDefines, Include^ includeFile, System::String^ skipConstants, ShaderFlags flags );\r
-\r
- /// <summary>\r
- /// Creates an effect from a block of memory.\r
- /// </summary>\r
- /// <param name="device">The device used to create the effect.</param>\r
- /// <param name="memory">A block of memory containing the effect data.</param>\r
- /// <param name="flags">A set of flags describing effect creation options.</param>\r
- /// <returns>The created effect object.</returns>\r
- static Effect^ FromMemory( Device^ device, array<System::Byte>^ memory, ShaderFlags flags );\r
-\r
- /// <summary>\r
- /// Creates an effect from a stream.\r
- /// </summary>\r
- /// <param name="device">The device used to create the effect.</param>\r
- /// <param name="stream">A stream containing the effect data.</param>\r
- /// <param name="preprocessorDefines">A set of preprocessor definitions.</param>\r
- /// <param name="includeFile">An include file handler.</param>\r
- /// <param name="skipConstants">A set of constants that will be ignored by the effect system.</param>\r
- /// <param name="flags">A set of flags describing effect creation options.</param>\r
- /// <param name="pool">The pool used for shared effect parameters.</param>\r
- /// <param name="compilationErrors">When the method completes, contains compilation errors and warnings.</param>\r
- /// <returns>The created effect object.</returns>\r
- static Effect^ FromStream( Device^ device, System::IO::Stream^ stream, array<Macro>^ preprocessorDefines, Include^ includeFile, System::String^ skipConstants, ShaderFlags flags, EffectPool^ pool, [Out] System::String^ %compilationErrors );\r
-\r
- /// <summary>\r
- /// Creates an effect from a stream.\r
- /// </summary>\r
- /// <param name="device">The device used to create the effect.</param>\r
- /// <param name="stream">A stream containing the effect data.</param>\r
- /// <param name="preprocessorDefines">A set of preprocessor definitions.</param>\r
- /// <param name="includeFile">An include file handler.</param>\r
- /// <param name="skipConstants">A set of constants that will be ignored by the effect system.</param>\r
- /// <param name="flags">A set of flags describing effect creation options.</param>\r
- /// <param name="pool">The pool used for shared effect parameters.</param>\r
- /// <returns>The created effect object.</returns>\r
- static Effect^ FromStream( Device^ device, System::IO::Stream^ stream, array<Macro>^ preprocessorDefines, Include^ includeFile, System::String^ skipConstants, ShaderFlags flags, EffectPool^ pool );\r
-\r
- /// <summary>\r
- /// Creates an effect from a stream.\r
- /// </summary>\r
- /// <param name="device">The device used to create the effect.</param>\r
- /// <param name="stream">A stream containing the effect data.</param>\r
- /// <param name="preprocessorDefines">A set of preprocessor definitions.</param>\r
- /// <param name="includeFile">An include file handler.</param>\r
- /// <param name="skipConstants">A set of constants that will be ignored by the effect system.</param>\r
- /// <param name="flags">A set of flags describing effect creation options.</param>\r
- /// <returns>The created effect object.</returns>\r
- static Effect^ FromStream( Device^ device, System::IO::Stream^ stream, array<Macro>^ preprocessorDefines, Include^ includeFile, System::String^ skipConstants, ShaderFlags flags );\r
-\r
- /// <summary>\r
- /// Creates an effect from a stream.\r
- /// </summary>\r
- /// <param name="device">The device used to create the effect.</param>\r
- /// <param name="stream">A stream containing the effect data.</param>\r
- /// <param name="flags">A set of flags describing effect creation options.</param>\r
- /// <returns>The created effect object.</returns>\r
- static Effect^ FromStream( Device^ device, System::IO::Stream^ stream, ShaderFlags flags );\r
-\r
- /// <summary>\r
- /// Creates an effect from a string.\r
- /// </summary>\r
- /// <param name="device">The device used to create the effect.</param>\r
- /// <param name="sourceData">A string containing the effect data.</param>\r
- /// <param name="preprocessorDefines">A set of preprocessor definitions.</param>\r
- /// <param name="includeFile">An include file handler.</param>\r
- /// <param name="skipConstants">A set of constants that will be ignored by the effect system.</param>\r
- /// <param name="flags">A set of flags describing effect creation options.</param>\r
- /// <param name="pool">The pool used for shared effect parameters.</param>\r
- /// <param name="compilationErrors">When the method completes, contains compilation errors and warnings.</param>\r
- /// <returns>The created effect object.</returns>\r
- static Effect^ FromString( Device^ device, System::String^ sourceData, array<Macro>^ preprocessorDefines, Include^ includeFile, System::String^ skipConstants, ShaderFlags flags, EffectPool^ pool, [Out] System::String^ %compilationErrors );\r
-\r
- /// <summary>\r
- /// Creates an effect from a string.\r
- /// </summary>\r
- /// <param name="device">The device used to create the effect.</param>\r
- /// <param name="sourceData">A string containing the effect data.</param>\r
- /// <param name="preprocessorDefines">A set of preprocessor definitions.</param>\r
- /// <param name="includeFile">An include file handler.</param>\r
- /// <param name="skipConstants">A set of constants that will be ignored by the effect system.</param>\r
- /// <param name="flags">A set of flags describing effect creation options.</param>\r
- /// <param name="pool">The pool used for shared effect parameters.</param>\r
- /// <returns>The created effect object.</returns>\r
- static Effect^ FromString( Device^ device, System::String^ sourceData, array<Macro>^ preprocessorDefines, Include^ includeFile, System::String^ skipConstants, ShaderFlags flags, EffectPool^ pool );\r
-\r
- /// <summary>\r
- /// Creates an effect from a string.\r
- /// </summary>\r
- /// <param name="device">The device used to create the effect.</param>\r
- /// <param name="sourceData">A string containing the effect data.</param>\r
- /// <param name="preprocessorDefines">A set of preprocessor definitions.</param>\r
- /// <param name="includeFile">An include file handler.</param>\r
- /// <param name="skipConstants">A set of constants that will be ignored by the effect system.</param>\r
- /// <param name="flags">A set of flags describing effect creation options.</param>\r
- /// <returns>The created effect object.</returns>\r
- static Effect^ FromString( Device^ device, System::String^ sourceData, array<Macro>^ preprocessorDefines, Include^ includeFile, System::String^ skipConstants, ShaderFlags flags );\r
-\r
- /// <summary>\r
- /// Creates an effect from a string.\r
- /// </summary>\r
- /// <param name="device">The device used to create the effect.</param>\r
- /// <param name="sourceData">A string containing the effect data.</param>\r
- /// <param name="flags">A set of flags describing effect creation options.</param>\r
- /// <returns>The created effect object.</returns>\r
- static Effect^ FromString( Device^ device, System::String^ sourceData, ShaderFlags flags );\r
-\r
- /// <summary>\r
- /// Creates an effect from a file.\r
- /// </summary>\r
- /// <param name="device">The device used to create the effect.</param>\r
- /// <param name="fileName">The name of the source file containing the effect data.</param>\r
- /// <param name="preprocessorDefines">A set of preprocessor definitions.</param>\r
- /// <param name="includeFile">An include file handler.</param>\r
- /// <param name="skipConstants">A set of constants that will be ignored by the effect system.</param>\r
- /// <param name="flags">A set of flags describing effect creation options.</param>\r
- /// <param name="pool">The pool used for shared effect parameters.</param>\r
- /// <param name="compilationErrors">When the method completes, contains compilation errors and warnings.</param>\r
- /// <returns>The created effect object.</returns>\r
- static Effect^ FromFile( Device^ device, System::String^ fileName, array<Macro>^ preprocessorDefines, Include^ includeFile, System::String^ skipConstants, ShaderFlags flags, EffectPool^ pool, [Out] System::String^ %compilationErrors );\r
-\r
- /// <summary>\r
- /// Creates an effect from a file.\r
- /// </summary>\r
- /// <param name="device">The device used to create the effect.</param>\r
- /// <param name="fileName">The name of the source file containing the effect data.</param>\r
- /// <param name="preprocessorDefines">A set of preprocessor definitions.</param>\r
- /// <param name="includeFile">An include file handler.</param>\r
- /// <param name="skipConstants">A set of constants that will be ignored by the effect system.</param>\r
- /// <param name="flags">A set of flags describing effect creation options.</param>\r
- /// <param name="pool">The pool used for shared effect parameters.</param>\r
- /// <returns>The created effect object.</returns>\r
- static Effect^ FromFile( Device^ device, System::String^ fileName, array<Macro>^ preprocessorDefines, Include^ includeFile, System::String^ skipConstants, ShaderFlags flags, EffectPool^ pool );\r
-\r
- /// <summary>\r
- /// Creates an effect from a file.\r
- /// </summary>\r
- /// <param name="device">The device used to create the effect.</param>\r
- /// <param name="fileName">The name of the source file containing the effect data.</param>\r
- /// <param name="preprocessorDefines">A set of preprocessor definitions.</param>\r
- /// <param name="includeFile">An include file handler.</param>\r
- /// <param name="skipConstants">A set of constants that will be ignored by the effect system.</param>\r
- /// <param name="flags">A set of flags describing effect creation options.</param>\r
- /// <returns>The created effect object.</returns>\r
- static Effect^ FromFile( Device^ device, System::String^ fileName, array<Macro>^ preprocessorDefines, Include^ includeFile, System::String^ skipConstants, ShaderFlags flags );\r
-\r
- /// <summary>\r
- /// Creates an effect from a file.\r
- /// </summary>\r
- /// <param name="device">The device used to create the effect.</param>\r
- /// <param name="fileName">The name of the source file containing the effect data.</param>\r
- /// <param name="flags">A set of flags describing effect creation options.</param>\r
- /// <returns>The created effect object.</returns>\r
- static Effect^ FromFile( Device^ device, System::String^ fileName, ShaderFlags flags );\r
-\r
- /// <summary>\r
- /// Creates a copy of the effect.\r
- /// </summary>\r
- /// <param name="device">The device associated with the effect.</param>\r
- /// <returns>The cloned effect.</returns>\r
- Effect^ Clone( Device^ device );\r
-\r
- /// <summary>\r
- /// Starts an active technique.\r
- /// </summary>\r
- /// <param name="flags">Rendering flags.</param>\r
- /// <returns>The number of passes required to complete the technique.</returns>\r
- int Begin( FX flags );\r
-\r
- /// <summary>\r
- /// Starts an active technique.\r
- /// </summary>\r
- /// <returns>The number of passes required to complete the technique.</returns>\r
- int Begin();\r
-\r
- /// <summary>\r
- /// Ends the active rendering technique.\r
- /// </summary>\r
- /// <returns>A <see cref="SlimDX::Result"/> object describing the result of the operation.</returns>\r
- Result End();\r
-\r
- /// <summary>\r
- /// Begins an effect pass.\r
- /// </summary>\r
- /// <param name="pass">Index of the pass to start.</param>\r
- /// <returns>A <see cref="SlimDX::Result"/> object describing the result of the operation.</returns>\r
- Result BeginPass( int pass );\r
-\r
- /// <summary>\r
- /// Ends the current effect pass.\r
- /// </summary>\r
- /// <returns>A <see cref="SlimDX::Result"/> object describing the result of the operation.</returns>\r
- Result EndPass();\r
-\r
- /// <summary>\r
- /// Starts capturing state changes in a parameter block.\r
- /// </summary>\r
- /// <returns>A <see cref="SlimDX::Result"/> object describing the result of the operation.</returns>\r
- Result BeginParameterBlock();\r
-\r
- /// <summary>\r
- /// Stops capturing state changes.\r
- /// </summary>\r
- /// <returns>A handle to the parameter state block.</returns>\r
- EffectHandle^ EndParameterBlock();\r
-\r
- /// <summary>\r
- /// Applies a parameter state block to the effect.\r
- /// </summary>\r
- /// <param name="parameterBlock">Handle to the parameter block.</param>\r
- /// <returns>A <see cref="SlimDX::Result"/> object describing the result of the operation.</returns>\r
- Result ApplyParameterBlock( EffectHandle^ parameterBlock );\r
-\r
- /// <summary>\r
- /// Deletes a stored parameter state block.\r
- /// </summary>\r
- /// <param name="parameterBlock">Handle to the parameter block.</param>\r
- /// <returns>A <see cref="SlimDX::Result"/> object describing the result of the operation.</returns>\r
- Result DeleteParameterBlock( EffectHandle^ parameterBlock );\r
-\r
- /// <summary>\r
- /// Determines whether a parameter is used by a technique.\r
- /// </summary>\r
- /// <param name="parameter">Handle of the parameter.</param>\r
- /// <param name="technique">Handle of the technique.</param>\r
- /// <returns><c>true</c> if the parameter is used by the technique; otherwise, <c>false</c>.</returns>\r
- bool IsParameterUsed( EffectHandle^ parameter, EffectHandle^ technique );\r
- \r
- /// <summary>\r
- /// Propagates state changes that occur inside of an active pass to the device before rendering.\r
- /// </summary>\r
- /// <returns>A <see cref="SlimDX::Result"/> object describing the result of the operation.</returns>\r
- Result CommitChanges();\r
-\r
- /// <summary>\r
- /// Searches for the next valid technique.\r
- /// </summary>\r
- /// <param name="technique">The starting point for the search.</param>\r
- /// <returns>The next valid technique.</returns>\r
- EffectHandle^ FindNextValidTechnique( EffectHandle^ technique );\r
-\r
- /// <summary>\r
- /// Validates a technique.\r
- /// </summary>\r
- /// <param name="technique">Handle of the technique.</param>\r
- /// <returns><c>true</c> if the technique is valid; otherwise, <c>false</c>.</returns>\r
- bool ValidateTechnique( EffectHandle^ technique );\r
-\r
- /// <summary>Called when the Direct3D device has been lost.</summary>\r
- /// <returns>A <see cref="SlimDX::Result"/> object describing the result of the operation.</returns>\r
- virtual Result OnLostDevice();\r
-\r
- /// <summary>Ccalled when the Direct3D device has been reset.</summary>\r
- /// <returns>A <see cref="SlimDX::Result"/> object describing the result of the operation.</returns>\r
- virtual Result OnResetDevice();\r
-\r
- /// <summary>\r
- /// Sets a contiguous range of shader constants.\r
- /// </summary>\r
- /// <param name="handle">Handle to the value to set.</param>\r
- /// <param name="data">The data used to set the handle.</param>\r
- /// <param name="offset">The starting offset into the data, in bytes.</param>\r
- /// <param name="count">The number of bytes of data to set.</param>\r
- /// <returns>A <see cref="SlimDX::Result"/> object describing the result of the operation.</returns>\r
- Result SetRawValue( EffectHandle^ handle, DataStream^ data, int offset, int count );\r
-\r
- Result SetRawValue( EffectHandle^ handle, DataStream^ data );\r
- Result SetRawValue( EffectHandle^ handle, array<float>^ data );\r
- Result SetRawValue( EffectHandle^ handle, array<float>^ data, int startIndex, int count );\r
-\r
- /// <summary>\r
- /// Disassembles the effect.\r
- /// </summary> \r
- /// <param name="enableColorCode"><c>true</c> to enable color coding to make the disassembly easier to read, <c>false</c> to disable color coding.</param>\r
- /// <returns>\r
- /// A <see cref="SlimDX::DataStream"/> that contains the disassembled effect.\r
- /// </returns>\r
- DataStream^ Disassemble(bool enableColorCode);\r
-\r
- /// <summary>\r
- /// Gets or sets the currently active technique.\r
- /// </summary>\r
- property EffectHandle^ Technique\r
- {\r
- EffectHandle^ get();\r
- void set( EffectHandle^ value );\r
- }\r
-\r
- /// <summary>\r
- /// Gets or sets the effect state manager.\r
- /// </summary>\r
- property IEffectStateManager^ StateManager\r
- {\r
- IEffectStateManager^ get();\r
- void set( IEffectStateManager^ value );\r
- }\r
-\r
- /// <summary>\r
- /// Gets the device associated with the effect.\r
- /// </summary>\r
- property Device^ Device\r
- {\r
- SlimDX::Direct3D9::Device^ get();\r
- }\r
-\r
- /// <summary>\r
- /// Gets the pool of shared effect parameters.\r
- /// </summary>\r
- property EffectPool^ Pool\r
- {\r
- EffectPool^ get();\r
- }\r
- };\r
- }\r
-}\r