2014-07-31 13:52:39 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
2014-08-07 15:53:20 +08:00
|
|
|
|
2014-07-31 13:52:39 +08:00
|
|
|
http://www.cocos2d-x.org
|
2014-08-07 15:53:20 +08:00
|
|
|
|
2014-07-31 13:52:39 +08:00
|
|
|
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:
|
2014-08-07 15:53:20 +08:00
|
|
|
|
2014-07-31 13:52:39 +08:00
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
2014-08-07 15:53:20 +08:00
|
|
|
|
2014-07-31 13:52:39 +08:00
|
|
|
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.
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __CC_PRIMITIVE_H__
|
|
|
|
#define __CC_PRIMITIVE_H__
|
|
|
|
|
|
|
|
#include "renderer/CCVertexIndexData.h"
|
|
|
|
|
|
|
|
NS_CC_BEGIN
|
|
|
|
|
2014-08-12 11:56:21 +08:00
|
|
|
class CC_DLL Primitive : public Ref
|
2014-07-31 13:52:39 +08:00
|
|
|
{
|
|
|
|
public:
|
2014-08-05 17:49:35 +08:00
|
|
|
static Primitive* create(VertexData* verts, IndexBuffer* indices, int type);
|
2014-07-31 13:52:39 +08:00
|
|
|
|
2014-08-07 17:59:36 +08:00
|
|
|
const VertexData* getVertexData() const;
|
2014-07-31 13:52:39 +08:00
|
|
|
|
2014-08-07 17:59:36 +08:00
|
|
|
const IndexBuffer* getIndexData() const;
|
2014-07-31 13:52:39 +08:00
|
|
|
|
2014-08-05 17:49:35 +08:00
|
|
|
int getType() const { return _type; }
|
2014-08-01 14:46:35 +08:00
|
|
|
|
|
|
|
//called by rendering framework
|
|
|
|
void draw();
|
2014-08-04 17:00:08 +08:00
|
|
|
|
|
|
|
int getStart() const { return _start; }
|
|
|
|
int getCount() const { return _count; }
|
|
|
|
void setStart(int start) { _start = start; }
|
|
|
|
void setCount(int count) { _count = count; }
|
|
|
|
|
2014-07-31 13:52:39 +08:00
|
|
|
protected:
|
|
|
|
Primitive();
|
|
|
|
virtual ~Primitive();
|
|
|
|
|
2014-08-05 17:49:35 +08:00
|
|
|
bool init(VertexData* verts, IndexBuffer* indices, int type);
|
2014-07-31 13:52:39 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
VertexData* _verts;
|
2014-08-04 17:00:08 +08:00
|
|
|
IndexBuffer* _indices;
|
|
|
|
int _start;
|
|
|
|
int _count;
|
2014-08-05 17:49:35 +08:00
|
|
|
int _type;
|
2014-07-31 13:52:39 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
NS_CC_END
|
|
|
|
|
|
|
|
#endif //__CC_PRIMITIVE_H__
|