source: OGRE/trunk/ogrenew/RenderSystems/Direct3D9/src/OgreD3D9GpuProgramManager.cpp @ 692

Revision 692, 3.8 KB checked in by mattausch, 18 years ago (diff)

adding ogre 1.2 and dependencies

Line 
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#include "OgreD3D9GpuProgramManager.h"
26#include "OgreD3D9GpuProgram.h"
27#include "OgreException.h"
28
29namespace Ogre {
30    //-----------------------------------------------------------------------------
31    D3D9GpuProgramManager::D3D9GpuProgramManager(LPDIRECT3DDEVICE9 device)
32        :GpuProgramManager(), mpDevice(device)
33    {
34        // Superclass sets up members
35
36        // Register with resource group manager
37        ResourceGroupManager::getSingleton()._registerResourceManager(mResourceType, this);
38
39    }
40    //-----------------------------------------------------------------------------
41    D3D9GpuProgramManager::~D3D9GpuProgramManager()
42    {
43        // Unregister with resource group manager
44        ResourceGroupManager::getSingleton()._unregisterResourceManager(mResourceType);
45
46    }
47    //-----------------------------------------------------------------------------
48    GpuProgramParametersSharedPtr D3D9GpuProgramManager::createParameters(void)
49    {
50        return GpuProgramParametersSharedPtr(new GpuProgramParameters());
51    }
52    //-----------------------------------------------------------------------------
53    Resource* D3D9GpuProgramManager::createImpl(const String& name, ResourceHandle handle,
54        const String& group, bool isManual, ManualResourceLoader* loader,
55        const NameValuePairList* params)
56    {
57        NameValuePairList::const_iterator paramIt;
58
59        if (!params || (paramIt = params->find("type")) == params->end())
60        {
61            OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
62                "You must supply a 'type' parameter",
63                "D3D9GpuProgramManager::createImpl");
64        }
65
66        if (paramIt->second == "vertex_program")
67        {
68            return new D3D9GpuVertexProgram(this, name, handle, group,
69                isManual, loader, mpDevice);
70        }
71        else
72        {
73            return new D3D9GpuFragmentProgram(this, name, handle, group,
74                isManual, loader, mpDevice);
75        }
76    }
77    //-----------------------------------------------------------------------------
78    Resource* D3D9GpuProgramManager::createImpl(const String& name, ResourceHandle handle,
79        const String& group, bool isManual, ManualResourceLoader* loader,
80        GpuProgramType gptype, const String& syntaxCode)
81    {
82        if (gptype == GPT_VERTEX_PROGRAM)
83        {
84            return new D3D9GpuVertexProgram(this, name, handle, group,
85                isManual, loader, mpDevice);
86        }
87        else
88        {
89            return new D3D9GpuFragmentProgram(this, name, handle, group,
90                isManual, loader, mpDevice);
91        }
92    }
93}
Note: See TracBrowser for help on using the repository browser.