Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
AlphaNode.h
/*
* AlphaNode.h
*
* Created on: September 12, 2016
* Author: asuvorov
*/
#pragma once
#include "Common.h"
USING_NS_CC;
class AlphaNode : public DrawNode {
public:
void setOpacity(GLubyte opac);
AlphaNode() : DrawNode() {
}
CREATE_FUNC(AlphaNode);
virtual bool init();
void drawTriangle(const Vec2 &p1, const Vec2 &p2, const Vec2 &p3,
const Color4B &color1, const Color4B &color2, const Color4B &color3) {
unsigned int vertex_count = 3;
ensureCapacity(vertex_count);
V2F_C4B_T2F a = { Vec2(p1.x, p1.y), color1, Tex2F(0.0, 0.0) };
V2F_C4B_T2F b = { Vec2(p2.x, p2.y), color2, Tex2F(0.0, 0.0) };
V2F_C4B_T2F c = { Vec2(p3.x, p3.y), color3, Tex2F(0.0, 0.0) };
V2F_C4B_T2F_Triangle *triangles = (V2F_C4B_T2F_Triangle *)(_buffer + _bufferCount);
V2F_C4B_T2F_Triangle triangle = { a, b, c };
triangles[0] = triangle;
_bufferCount += vertex_count;
_dirty = true;
}
private:
GLubyte mOpacity;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment