This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sprite *spriteBack = m_textureBack->getSprite(); | |
Sprite *spriteFront = m_textureFront->getSprite(); | |
GLint defFrameBuf = 0; //デフォルトのFBOを退避 | |
GLuint colorBufBack = spriteBack->getTexture()->getName(); | |
GLuint colorBufFront = spriteFront->getTexture()->getName(); | |
GLuint frameBufBack = 0, frameBufFront = 0; | |
glGenFramebuffers(1, &frameBufFront); | |
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &defFrameBuf); | |
glBindFramebuffer(GL_FRAMEBUFFER, frameBufFront); | |
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, colorBufFront, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//※SCREEN_WIDTHは1280、SCREEN_HEIGHTは720 | |
//実機の画面サイズ | |
Size frameSize = Director::sharedDirector()->getOpenGLView()->getFrameSize(); | |
//setDesignResolutionSize()で指定した画面サイズ(アス比の違う実機では多少変わる) | |
Size windowSize = Director::getInstance()->getWinSize(); | |
//Live2Dのキャンバスサイズ | |
float canvasWidth = m_live2DModel->getCanvasWidth(); | |
float canvasHeight = m_live2DModel->getCanvasHeight(); | |
float logicalWidth = abs(VIEW_LOGICAL_LEFT - VIEW_LOGICAL_RIGHT); | |
float aspect = ((float)SCREEN_WIDTH / SCREEN_HEIGHT); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Model::draw(cocos2d::Renderer *renderer, const cocos2d::Mat4 &transform, uint32_t flags){ | |
double t = (live2d::UtSystem::getUserTimeMSec()/1000.0) * 2 * M_PI ; | |
m_live2DModel->setParamFloat("PARAM_ANGLE_X", (float)(30 * sin( t/3.0 )) ); | |
cocos2d::Sprite *sprite = m_redderTexture->getSprite(); | |
GLint oldFBO; | |
GLuint frame_buffer = 0; | |
GLuint color_buffer = sprite->getTexture()->getName(); | |
glGenFramebuffers(1, &frame_buffer); | |
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldFBO); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "HelloWorldScene.h" | |
USING_NS_CC; | |
Scene* HelloWorld::createScene(){ | |
auto scene = Scene::create(); | |
auto layer = HelloWorld::create(); | |
scene->addChild(layer); | |
return scene; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "HelloWorldScene.h" | |
USING_NS_CC; | |
Scene *HelloWorld::createScene(){ | |
auto scene = Scene::create(); | |
auto layer = HelloWorld::create(); | |
scene->addChild(layer); | |
return scene; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//↓参考元 | |
//https://github.com/Quasimondo/QuasimondoJS | |
//Released under the MIT license | |
//http://opensource.org/licenses/mit-license.php | |
#ifndef __HELLOWORLD_SCENE_H__ | |
#define __HELLOWORLD_SCENE_H__ | |
#include "cocos2d.h" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "HelloWorldScene.h" | |
USING_NS_CC; | |
Scene* HelloWorld::createScene(){ | |
auto scene = Scene::create(); | |
auto layer = HelloWorld::create(); | |
scene->addChild(layer); | |
return scene; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "HelloWorldScene.h" | |
USING_NS_CC; | |
Scene *HelloWorld::createScene(){ | |
auto scene = Scene::create(); | |
auto layer = HelloWorld::create(); | |
scene->addChild(layer); | |
return scene; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "HelloWorldScene.h" | |
USING_NS_CC; | |
Scene* HelloWorld::createScene(){ | |
auto scene = Scene::create(); | |
auto layer = HelloWorld::create(); | |
scene->addChild(layer); | |
return scene; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool HelloWorld::init(){ | |
if(!Layer::init()){ return false; } | |
//ブラーの幅等を設定 | |
const int maxRadius = 64; | |
int step = 1, radius = 40; | |
int radiusWithStep = radius / step; | |
Vec2 *weights = new Vec2[maxRadius]; | |
calculateGaussianWeights(radiusWithStep, weights); |