text
stringlengths 0
2.2M
|
---|
cameras[i]->end();
|
}
|
//
|
//////////////////////////
|
//////////////////////////
|
// DRAW STUFF ON TOP
|
//////////////////////////
|
//
|
ofPushStyle();
|
glDepthFunc(GL_ALWAYS); // draw on top of everything
|
//draw some labels
|
ofSetColor(255, 255, 255);
|
ofDrawBitmapString("Press keys 1-4 to select a camera for main view", viewMain.x + 20, 30);
|
ofDrawBitmapString("Camera selected: " + ofToString(iMainCamera+1), viewMain.x + 20, 50);
|
ofDrawBitmapString("Press 'f' to toggle fullscreen", viewMain.x + 20, 70);
|
ofDrawBitmapString("Press 'p' to toggle parents on OrthoCamera's", viewMain.x + 20, 90);
|
ofDrawBitmapString("EasyCam", viewGrid[0].x + 20, viewGrid[0].y + 30);
|
ofDrawBitmapString("Front", viewGrid[1].x + 20, viewGrid[1].y + 30);
|
ofDrawBitmapString("Top", viewGrid[2].x + 20, viewGrid[2].y + 30);
|
ofDrawBitmapString("Left", viewGrid[3].x + 20, viewGrid[3].y + 30);
|
//draw outlines on views
|
ofSetLineWidth(5);
|
ofNoFill();
|
ofSetColor(255, 255, 255);
|
//
|
for (int i=0; i<N_CAMERAS; i++)
|
ofDrawRectangle(viewGrid[i]);
|
//
|
ofDrawRectangle(viewMain);
|
glDepthFunc(GL_LESS);
|
ofPopStyle();
|
//
|
//////////////////////////
|
}
|
void ofApp::drawScene(int iCameraDraw){
|
nodeSwarm.draw();
|
nodeGrid.draw();
|
//////////////////////////////////
|
// DRAW EASYCAM FRUSTUM PREVIEW
|
//////////////////////////////////
|
//
|
// This code draws our camera in
|
// the scene (reddy/pink lines)
|
//
|
// The pyramid-like shape defined
|
// by the cameras view is called
|
// a 'frustum'.
|
//
|
// Often we refer to the volume
|
// which can be seen by the
|
// camera as 'the view frustum'.
|
//
|
//let's not draw the camera
|
//if we're looking through it
|
if (iCameraDraw != 0)
|
{
|
ofPushStyle();
|
//in 'camera space' this frustum
|
//is defined by a box with bounds
|
//-1->1 in each axis
|
//
|
//to convert from camera to world
|
//space, we multiply by the inverse
|
//matrix of the camera
|
//
|
//by applying this transformation
|
//our box in camera space is
|
//transformed into a frustum in
|
//world space.
|
//the camera's matricies are dependant on
|
//the aspect ratio of the viewport
|
//so we must send the viewport if it's not
|
//the same as fullscreen
|
//
|
//watch the aspect ratio of preview camera
|
glm::mat4 inverseCameraMatrix = glm::inverse(camEasyCam.getModelViewProjectionMatrix( (iMainCamera == 0 ? viewMain : viewGrid[0]) ));
|
// By default, we can say
|
// 'we are drawing in world space'
|
//
|
// The camera matrix performs
|
// world->camera
|
//
|
// The inverse camera matrix performs
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.