source: OGRE/trunk/ogrenew/RenderSystems/Direct3D9/include/OgreD3D9HLSLProgram.h @ 692

Revision 692, 4.4 KB checked in by mattausch, 19 years ago (diff)

adding ogre 1.2 and dependencies

RevLine 
[692]1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2005 The OGRE Team
8Also see acknowledgements in Readme.html
9
10This program is free software you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23-----------------------------------------------------------------------------
24*/
25#ifndef __D3D9HLSLProgram_H__
26#define __D3D9HLSLProgram_H__
27
28#include "OgreD3D9Prerequisites.h"
29#include "OgreHighLevelGpuProgram.h"
30
31namespace Ogre {
32    /** Specialisation of HighLevelGpuProgram to provide support for D3D9
33        High-Level Shader Language (HLSL).
34    @remarks
35        Note that the syntax of D3D9 HLSL is identical to nVidia's Cg language, therefore
36        unless you know you will only ever be deploying on Direct3D, or you have some specific
37        reason for not wanting to use the Cg plugin, I suggest you use Cg instead since that
38        can produce programs for OpenGL too.
39    */
40    class D3D9HLSLProgram : public HighLevelGpuProgram
41    {
42    public:
43        /// Command object for setting entry point
44        class CmdEntryPoint : public ParamCommand
45        {
46        public:
47            String doGet(const void* target) const;
48            void doSet(void* target, const String& val);
49        };
50        /// Command object for setting target assembler
51        class CmdTarget : public ParamCommand
52        {
53        public:
54            String doGet(const void* target) const;
55            void doSet(void* target, const String& val);
56        };
57
58    protected:
59
60        static CmdEntryPoint msCmdEntryPoint;
61        static CmdTarget msCmdTarget;
62
63        /** Internal load implementation, must be implemented by subclasses.
64        */
65        void loadFromSource(void);
66        /** Internal method for creating an appropriate low-level program from this
67        high-level program, must be implemented by subclasses. */
68        void createLowLevelImpl(void);
69        /// Internal unload implementation, must be implemented by subclasses
70        void unloadHighLevelImpl(void);
71        /// Populate the passed parameters with name->index map, must be overridden
72        void populateParameterNames(GpuProgramParametersSharedPtr params);
73
74        // Recursive utility method for populateParameterNames
75        void processParamElement(D3DXHANDLE parent, String prefix, unsigned int index, GpuProgramParametersSharedPtr params);
76
77        String mTarget;
78        String mEntryPoint;
79
80        LPD3DXBUFFER mpMicroCode;
81        LPD3DXCONSTANTTABLE mpConstTable;
82
83    public:
84        D3D9HLSLProgram(ResourceManager* creator, const String& name, ResourceHandle handle,
85            const String& group, bool isManual, ManualResourceLoader* loader);
86        ~D3D9HLSLProgram();
87
88        /** Sets the entry point for this program ie the first method called. */
89        void setEntryPoint(const String& entryPoint) { mEntryPoint = entryPoint; }
90        /** Gets the entry point defined for this program. */
91        const String& getEntryPoint(void) const { return mEntryPoint; }
92        /** Sets the shader target to compile down to, e.g. 'vs_1_1'. */
93        void setTarget(const String& target);
94        /** Gets the shader target to compile down to, e.g. 'vs_1_1'. */
95        const String& getTarget(void) const { return mTarget; }
96        /// Overridden from GpuProgram
97        bool isSupported(void) const;
98        /// Overridden from GpuProgram
99        GpuProgramParametersSharedPtr createParameters(void);
100        /// Overridden from GpuProgram
101        const String& getLanguage(void) const;
102    };
103}
104
105#endif
Note: See TracBrowser for help on using the repository browser.