本文整理汇总了C++中CameraUi类的典型用法代码示例。如果您正苦于以下问题:C++ CameraUi类的具体用法?C++ CameraUi怎么用?C++ CameraUi使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CameraUi类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mouseDrag
void AudioVisualizerApp::mouseDrag( MouseEvent event )
{
// handle mouse drag
mCameraUi.mouseDrag( event.getPos(), event.isLeftDown(), event.isMiddleDown(), event.isRightDown() );
}
示例2: getAssetPath
void AudioVisualizerApp::setup()
{
// initialize signals
signalChannelEnd = false;
// make a list of valid audio file extensions and initialize audio variables
const char* extensions[] = { "mp3", "wav", "ogg" };
mAudioExtensions = vector<string>( extensions, extensions + 2 );
mAudioPath = getAssetPath( "" );
mIsAudioPlaying = false;
// setup camera
mCamera.setPerspective( 50.0f, 1.0f, 1.0f, 10000.0f );
mCamera.lookAt( vec3( -kWidth / 4, kHeight / 2, -kWidth / 8 ), vec3( kWidth / 4, -kHeight / 8, kWidth / 4 ) );
mCameraUi.setCamera( &mCamera );
// create channels from which we can construct our textures
mChannelLeft = Channel32f( kBands, kHistory );
mChannelRight = Channel32f( kBands, kHistory );
memset( mChannelLeft.getData(), 0, mChannelLeft.getRowBytes() * kHistory );
memset( mChannelRight.getData(), 0, mChannelRight.getRowBytes() * kHistory );
// create texture format (wrap the y-axis, clamp the x-axis)
mTextureFormat.setWrapS( GL_CLAMP_TO_BORDER );
mTextureFormat.setWrapT( GL_REPEAT );
mTextureFormat.setMinFilter( GL_LINEAR );
mTextureFormat.setMagFilter( GL_LINEAR );
mTextureFormat.loadTopDown( true );
// compile shader
try {
mShader = gl::GlslProg::create( loadAsset( "shaders/spectrum.vert" ), loadAsset( "shaders/spectrum.frag" ) );
}
catch( const std::exception& e ) {
console() << e.what() << std::endl;
quit();
return;
}
// create static mesh (all animation is done in the vertex shader)
std::vector<vec3> positions;
std::vector<Colorf> colors;
std::vector<vec2> coords;
std::vector<uint32_t> indices;
for( size_t h = 0; h < kHeight; ++h ) {
for( size_t w = 0; w < kWidth; ++w ) {
// add polygon indices
if( h < kHeight - 1 && w < kWidth - 1 ) {
size_t offset = positions.size();
indices.emplace_back( offset );
indices.emplace_back( offset + kWidth );
indices.emplace_back( offset + kWidth + 1 );
indices.emplace_back( offset );
indices.emplace_back( offset + kWidth + 1 );
indices.emplace_back( offset + 1 );
}
// add vertex
positions.emplace_back( vec3( float( w ), 0, float( h ) ) );
// add texture coordinates
// note: we only want to draw the lower part of the frequency bands,
// so we scale the coordinates a bit
const float part = 0.5f;
float s = w / float( kWidth - 1 );
float t = h / float( kHeight - 1 );
coords.emplace_back( vec2( part - part * s, t ) );
// add vertex colors
colors.emplace_back( Color( CM_HSV, s, 0.5f, 0.75f ) );
}
}
gl::VboMesh::Layout layout;
layout.usage( GL_STATIC_DRAW );
layout.attrib( geom::Attrib::POSITION, 3 );
layout.attrib( geom::Attrib::COLOR, 3 );
layout.attrib( geom::Attrib::TEX_COORD_0, 2 );
mMesh = gl::VboMesh::create( positions.size(), GL_TRIANGLES, { layout }, indices.size(), GL_UNSIGNED_INT );
mMesh->bufferAttrib( geom::POSITION, positions.size() * sizeof( vec3 ), positions.data() );
mMesh->bufferAttrib( geom::COLOR, colors.size() * sizeof( vec3 ), colors.data() );
mMesh->bufferAttrib( geom::TEX_COORD_0, coords.size() * sizeof( vec2 ), coords.data() );
mMesh->bufferIndices( indices.size() * sizeof( uint32_t ), indices.data() );
// play audio using the Cinder FMOD block
FMOD::System_Create( &mFMODSystem );
mFMODSystem->init( 32, FMOD_INIT_NORMAL | FMOD_INIT_ENABLE_PROFILE, NULL );
mFMODSound = nullptr;
mFMODChannel = nullptr;
playAudio( findAudio( mAudioPath ) );
mIsMouseDown = false;
mMouseUpDelay = 30.0;
mMouseUpTime = getElapsedSeconds() - mMouseUpDelay;
//.........这里部分代码省略.........
示例3: mouseUp
void ViewportArrayApp::mouseUp( MouseEvent event )
{
if( currentViewport != -1 ) mCameraUi.setCamera( &mCameras[currentViewport] );
mCameraUi.mouseUp( event );
}
示例4: getViewportAt
void ViewportArrayApp::mouseWheel( MouseEvent event )
{
int viewport = getViewportAt( mViewports, event.getPos() );
if( viewport != -1 ) mCameraUi.setCamera( &mCameras[viewport] );
mCameraUi.mouseWheel( event );
}
示例5: setup
void cApp::setup(){
mExp.setup(1920, 1080, 0, 100-1, GL_RGB, mt::getRenderPath(), 0, "test" );
setWindowSize( 1920, 1080 );
setWindowPos(0, 0);
mPln.setSeed( 345 );
mPln.setOctaves( 4 );
cam = CameraPersp(1920, 1080, 55, 0.1, 100000);
eye = vec3(0,0,1000);
cam.lookAt(eye, vec3(0,0,0));
camui.setCamera(&cam);
}
示例6: mouseDown
void GeometryApp::mouseDown( MouseEvent event )
{
mRecenterCamera = false;
mCamUi.mouseDown( event );
if( getElapsedSeconds() - mLastMouseDownTime < 0.2f ) {
mPrimitiveSelected = static_cast<Primitive>( static_cast<int>( mPrimitiveSelected ) + 1 );
createGeometry();
}
mLastMouseDownTime = getElapsedSeconds();
}
示例7: draw
void cApp::draw(){
glPointSize(1);
glLineWidth(1);
gl::enableAlphaBlending();
mExp.begin(camui.getCamera());{
gl::clear();
mt::drawCoordinate(100);
vbo.draw();
}
mExp.end();
mExp.draw();
gl::pushMatrices();
{
gl::color(1, 1, 1);
gl::drawString("fps " + to_string( getAverageFps()), vec2(20,20) );
gl::drawString("frame " + to_string( frame ), vec2(20,35) );
}
gl::popMatrices();
}
示例8: newPos
void Choreo3DApp::update()
{
setFrameRate(frameRate);
//DISABLE CAMERA INTERACTION IF MOUSE IS OVER UI REGION
if (getMousePos().x > 3 * getWindowWidth()/4. && camActive)
{
camActive = false;
mCamUi.disconnect();
mCamUi.disable();
cout << "disabling camera UI" << endl;
} else {
if (!camActive)
{
mCamUi.connect(getWindow());
mCamUi.enable();
}
camActive = true;
cout << "enabling camera UI" << endl;
}
mGlsl->uniform("uColor", markerColour );
if (!paused)
{
//UPDATE POSITIONS
//MAP INSTANCE DATA TO VBO
//WRITE NEW POSITIONS
//UNMAP
glm::vec3 *newPositions = (glm::vec3*)mInstanceDataVbo->mapReplace();
for( int i = 0; i < jointList.size(); ++i )
{
float instanceX = jointList[i].jointPositions[FRAME_COUNT].x;
float instanceY = jointList[i].jointPositions[FRAME_COUNT].y;
float instanceZ = jointList[i].jointPositions[FRAME_COUNT].z;
vec3 newPos(vec3(instanceX,instanceY, instanceZ)); //CREATE A NEW VEC3 FOR UPDATING THE VBO
framePositions[i] = newPos;
}
//REPLACE VEC3s IN VBO BY INCREMENTING THE POINTER
for (int i = 0; i < framePositions.size(); i++){
*newPositions++ = framePositions[i];
}
handTrail.update(framePositions[26], dancerColor);
// std::cout << framePositions[17] << std::endl;
skeleton.update(framePositions);
mInstanceDataVbo->unmap();
// std::cout << "position: " << positions[0] << std::endl;
if (ribbonsActive)updateRibbons();
//MANUALLY INCREMENT THE FRAME, IF THE FRAME_COUNT EXCEEDS TOTAL FRAMES, RESET THE COUNTER
if (FRAME_COUNT < TOTAL_FRAMES)
{
FRAME_COUNT += 1;
} else {
FRAME_COUNT = 0;
}
//std::cout << getAverageFps() << std:: endl;
// std::cout << "frame rate: " << getAverageFps() << ", frame count: " << FRAME_COUNT << std::endl;
//define changed color
// Color temp = Color(dancerColor[0],dancerColor[1],dancerColor[2]);
mCurrentFrame++; //MANUALLY ADVANCE THE CURRENT FRAME - WITH RESPECT TO THE DANCERS
}
updateGui();
}
示例9: mouseWheel
void TextParticlesApp::mouseWheel( MouseEvent event )
{
mCamUi.mouseWheel( event );
}
示例10: resize
void cApp::resize(){
CameraPersp & cam = const_cast<CameraPersp&>(camUi.getCamera());
cam.setAspectRatio( getWindowAspectRatio() );
camUi.setCamera( &cam );
}
示例11: mouseDrag
void cApp::mouseDrag( MouseEvent event ){
camUi.mouseDrag( event.getPos(), event.isLeftDown(), event.isMiddleDown(), event.isRightDown() );
}
示例12: mouseDown
void cApp::mouseDown( MouseEvent event ){
camUi.mouseDown( event.getPos() );
}
示例13: mouseDrag
void GeometryApp::mouseDrag( MouseEvent event )
{
mCamUi.mouseDrag( event );
}
示例14: mouseUp
void TextParticlesApp::mouseUp( MouseEvent event )
{
mCamUi.mouseUp( event );
}
示例15: mouseDrag
void ArmyDemoApp::mouseDrag( MouseEvent event )
{
mCamUi.mouseDrag( event.getPos(), event.isLeftDown(), event.isMiddleDown(), event.isRightDown() );
}