本文整理汇总了C++中cinderfx::Fluid2D::texCoordAt方法的典型用法代码示例。如果您正苦于以下问题:C++ Fluid2D::texCoordAt方法的具体用法?C++ Fluid2D::texCoordAt怎么用?C++ Fluid2D::texCoordAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cinderfx::Fluid2D
的用法示例。
在下文中一共展示了Fluid2D::texCoordAt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Color
void Fluid2DTextureApp::draw()
{
// clear out the window with black
gl::clear( Color( 0, 0, 0 ) );
gl::setMatricesWindow( getWindowWidth(), getWindowHeight() );
// Update the positions and tex coords
Rectf drawRect = getWindowBounds();
int limX = mFluid2D.resX() - 1;
int limY = mFluid2D.resY() - 1;
float dx = drawRect.getWidth()/(float)limX;
float dy = drawRect.getHeight()/(float)limY;
for( int j = 0; j < mFluid2D.resY(); ++j ) {
for( int i = 0; i < mFluid2D.resX(); ++i ) {
vec2 P = vec2( i*dx, j*dy );
vec2 uv = mFluid2D.texCoordAt( i, j );
int idx = j*mFluid2D.resX() + i;
mTriMesh->getPositions<2>()[idx] = P;
mTriMesh->getTexCoords0<2>()[idx] = uv;
}
}
mTex->bind();
gl::bindStockShader( gl::ShaderDef().color().texture() );
gl::draw( gl::VboMesh::create(*mTriMesh) );
mTex->unbind();
mParams.draw();
}
示例2: Color
void Fluid2DTextureApp::draw()
{
// clear out the window with black
gl::clear( Color( 0, 0, 0 ) );
gl::setMatricesWindow( getWindowWidth(), getWindowHeight() );
// Update the positions and tex coords
Rectf drawRect = getWindowBounds();
int limX = mFluid2D.resX() - 1;
int limY = mFluid2D.resY() - 1;
float dx = drawRect.getWidth()/(float)limX;
float dy = drawRect.getHeight()/(float)limY;
for( int j = 0; j < mFluid2D.resY(); ++j ) {
for( int i = 0; i < mFluid2D.resX(); ++i ) {
Vec2f P = Vec2f( i*dx, j*dy );
Vec2f uv = mFluid2D.texCoordAt( i, j );
int idx = j*mFluid2D.resX() + i;
mTriMesh.getVertices()[idx] = P;
mTriMesh.getTexCoords()[idx] = uv;
}
}
mTex.bind();
gl::draw( mTriMesh );
mTex.unbind();
mParams.draw();
}