2013-12-18 10:12:15 +08:00
|
|
|
/****************************************************************************
|
2014-01-07 11:25:07 +08:00
|
|
|
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
2013-11-05 01:14:22 +08:00
|
|
|
|
2013-12-18 10:12:15 +08:00
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
2013-11-05 01:14:22 +08:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef __CCRENDERCOMMAND_H_
|
|
|
|
#define __CCRENDERCOMMAND_H_
|
|
|
|
|
2014-04-27 01:11:22 +08:00
|
|
|
#include "base/CCPlatformMacros.h"
|
2013-11-05 01:14:22 +08:00
|
|
|
#include <stdint.h>
|
2014-04-27 01:11:22 +08:00
|
|
|
#include "2d/ccTypes.h"
|
2013-11-05 01:14:22 +08:00
|
|
|
|
|
|
|
NS_CC_BEGIN
|
|
|
|
|
2014-03-07 08:14:06 +08:00
|
|
|
/** Base class of the `RenderCommand` hierarchy.
|
|
|
|
*
|
|
|
|
The `Renderer` knows how to render `RenderCommands` objects.
|
2014-01-18 08:08:29 +08:00
|
|
|
*/
|
2013-11-05 01:14:22 +08:00
|
|
|
class RenderCommand
|
|
|
|
{
|
2013-12-03 14:08:47 +08:00
|
|
|
public:
|
2013-12-18 10:02:11 +08:00
|
|
|
|
|
|
|
enum class Type
|
|
|
|
{
|
2014-01-17 14:29:25 +08:00
|
|
|
UNKNOWN_COMMAND,
|
2013-12-18 10:02:11 +08:00
|
|
|
QUAD_COMMAND,
|
|
|
|
CUSTOM_COMMAND,
|
2014-01-16 08:07:38 +08:00
|
|
|
BATCH_COMMAND,
|
2013-12-18 10:02:11 +08:00
|
|
|
GROUP_COMMAND,
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Get Render Command Id */
|
2014-01-19 03:35:27 +08:00
|
|
|
inline float getGlobalOrder() const { return _globalOrder; }
|
2014-01-16 11:10:40 +08:00
|
|
|
|
|
|
|
/** Returns the Command type */
|
2014-01-18 15:10:04 +08:00
|
|
|
inline Type getType() const { return _type; }
|
2013-12-18 10:02:11 +08:00
|
|
|
|
2013-11-05 01:14:22 +08:00
|
|
|
protected:
|
2013-12-18 10:02:11 +08:00
|
|
|
RenderCommand();
|
|
|
|
virtual ~RenderCommand();
|
|
|
|
|
2013-11-05 01:14:22 +08:00
|
|
|
void printID();
|
|
|
|
|
2014-01-18 08:08:29 +08:00
|
|
|
// Type used in order to avoid dynamic cast, faster
|
2013-12-18 10:02:11 +08:00
|
|
|
Type _type;
|
2014-01-18 08:08:29 +08:00
|
|
|
|
|
|
|
// commands are sort by depth
|
2014-01-19 03:35:27 +08:00
|
|
|
float _globalOrder;
|
2013-11-05 01:14:22 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
NS_CC_END
|
|
|
|
|
|
|
|
#endif //__CCRENDERCOMMAND_H_
|