本文整理汇总了C++中TriMesh::appendColorRgba方法的典型用法代码示例。如果您正苦于以下问题:C++ TriMesh::appendColorRgba方法的具体用法?C++ TriMesh::appendColorRgba怎么用?C++ TriMesh::appendColorRgba使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TriMesh
的用法示例。
在下文中一共展示了TriMesh::appendColorRgba方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
void BasicApplicationApp::setup()
{
plane.appendVertex(Vec3f(0, 0, 0)); // [ (0,0,0) ]
plane.appendColorRgba(Colorf(1.f,0,0));
plane.appendTexCoord(Vec2f(0,0));
plane.appendVertex(Vec3f(600, 0, 0)); // [ (0,0,0), (600,0,0) ]
plane.appendColorRgba(Colorf(1.f,1.f,0));
plane.appendTexCoord(Vec2f(1.f,0));
plane.appendVertex(Vec3f(600, 600, 0)); // [ (0,0,0), (600,0,0), (600,600,0)]
plane.appendColorRgba(Colorf(0,1.f,0));
plane.appendTexCoord(Vec2f(1.f,1.f));
plane.appendVertex(Vec3f(0, 600, 0)); // [ (0,0,0), (600,0,0), (600,600,0), (0,600,0)]
plane.appendColorRgba(Colorf(0,0,1.f));
plane.appendTexCoord(Vec2f(0.f,1.f));
uint indices[6] = {0,1,2,2,3,0};
plane.appendIndices(&indices[0], 6);
mTexture = gl::Texture( loadImage()))
}
示例2: setup
void ssaoApp::setup()
{
gl::disableVerticalSync();
RENDER_MODE = DeferredRenderer::SHOW_FINAL_VIEW;
//set up camera
mCam.setPerspective( 45.0f, getWindowAspectRatio(), 0.1f, 10000.0f );
Vec3f camPos( -14.0f, 7.0f, -14.0f );
mCam.lookAt(camPos * 1.5f, Vec3f::zero(), Vec3f(0.0f, 1.0f, 0.0f) );
mCam.setCenterOfInterestPoint(Vec3f::zero());
mMayaCam.setCurrentCam(mCam);
//create functions pointers to send to deferred renderer
boost::function<void(gl::GlslProg*)> fRenderShadowCastersFunc = boost::bind( &ssaoApp::drawShadowCasters, this, boost::lambda::_1 );
boost::function<void(gl::GlslProg*)> fRenderNotShadowCastersFunc = boost::bind( &ssaoApp::drawNonShadowCasters, this, boost::lambda::_1 );
boost::function<void(void)> fRenderOverlayFunc = boost::bind( &ssaoApp::drawOverlay, this );
mDeferredRenderer.setup( fRenderShadowCastersFunc, fRenderNotShadowCastersFunc, NULL, NULL, &mCam, Vec2i(1024, 768), 1024, true, true ); //no overlay or "particles"
//have these cast point light shadows
mDeferredRenderer.addCubeLight( Vec3f(-2.0f, 4.0f, 6.0f), Color(0.10f, 0.69f, 0.93f) * LIGHT_BRIGHTNESS_DEFAULT, true); //blue
mDeferredRenderer.addCubeLight( Vec3f(4.0f, 6.0f, -4.0f), Color(0.94f, 0.15f, 0.23f) * LIGHT_BRIGHTNESS_DEFAULT, true); //red
//add a bunch of lights
for(int i = 0; i < 10; i++) {
for(int j = 0; j < 10; j++) {
int randColIndex = Rand::randInt(5);
Color randCol;
switch( randColIndex ) {
case 0:
randCol = Color(0.99f, 0.67f, 0.23f); //orange
break;
case 1:
randCol = Color(0.97f, 0.24f, 0.85f); //pink
break;
case 2:
randCol = Color(0.00f, 0.93f, 0.30f); //green
break;
case 3:
randCol = Color(0.98f, 0.96f, 0.32f); //yellow
break;
case 4:
randCol = Color(0.10f, 0.69f, 0.93f); //blue
break;
case 5:
randCol = Color(0.94f, 0.15f, 0.23f); //red
break;
};
mDeferredRenderer.addCubeLight( Vec3f( i * 20, 30, j * 20), randCol * LIGHT_BRIGHTNESS_DEFAULT, false, true);
}
}
mCurrLightIndex = 0;
float size = 3000;
plane.appendVertex(Vec3f(size, -1,-size));
plane.appendColorRgba(ColorA(255,255,255,255));
plane.appendNormal(Vec3f(.0f, 1.0f, 0.0f));
plane.appendVertex(Vec3f(-size, -1,-size));
plane.appendColorRgba(ColorA(255,255,255,255));
plane.appendNormal(Vec3f(.0f, 1.0f, 0.0f));
plane.appendVertex(Vec3f(-size, -1, size));
plane.appendColorRgba(ColorA(255,255,255,255));
plane.appendNormal(Vec3f(.0f, 1.0f, 0.0f));
plane.appendVertex(Vec3f(size, -1, size));
plane.appendColorRgba(ColorA(255,255,255,255));
plane.appendNormal(Vec3f(.0f, 1.0f, 0.0f));
uint indices[6] = {0,1,2,2,3,0};
plane.appendIndices(&indices[0], 6);
gl::VboMesh::Layout layout;
shadowPlane = gl::VboMesh::create(plane);
TriMesh bunnyMesh;
ObjLoader loader( loadResource(RES_BUNNY) );
loader.load( &bunnyMesh );
bunny = gl::VboMesh(bunnyMesh);
}