本文整理汇总了C++中Portal::getPos方法的典型用法代码示例。如果您正苦于以下问题:C++ Portal::getPos方法的具体用法?C++ Portal::getPos怎么用?C++ Portal::getPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Portal
的用法示例。
在下文中一共展示了Portal::getPos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createEnvironmentMap
void FunctionalPortal::createEnvironmentMap(const std::vector<Portal *> *portals){
Portal *destPortal = (*portals)[iDestPortal];
Vec3 portalPos = destPortal->getPos();
Vec3 eyePos;
vecAdd(&destPos_pcoord, &portalPos, &eyePos);
bool oldHide = isHidden();
setHide(true);
GL_CHECK(glMatrixMode(GL_MODELVIEW));
GL_CHECK(glPushMatrix());
GL_CHECK(glMatrixMode(GL_PROJECTION));
GL_CHECK(glPushMatrix());
GL_CHECK(glPushAttrib(GL_VIEWPORT_BIT));
//GL_CHECK(glBindTexture(GL_TEXTURE_2D, 0));
tgr->bind();
//GL_CHECK(glBindTexture(GL_TEXTURE_2D, dstDepthmap));
//GL_CHECK(glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
//GL_TEXTURE_2D, dstDepthmap, 0));
/*GLuint id = renderTgr->genColorTexutre();
glFramebufferTexture2DEXT(
GL_FRAMEBUFFER_EXT,
GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_2D,
id,
0);
struct MAZErectangle viewport;
viewport.left = 0;
viewport.bottom = 0;
viewport.width = width;
viewport.height = height;
struct Vec3 centerPos = vec2vecAdd(&eyePos, 0, 0, -10);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(eyePos.x, eyePos.y, eyePos.z,
centerPos.x, centerPos.y, centerPos.z,
0, 1, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
struct MAZEmat projviewMat;
struct MAZEmat viewportMat;
getWindowProjMat(viewport, projviewMat, viewportMat);
hash_set<int *> visitedEdgeSet;
destPortal->cullDraw(&projviewMat, &viewportMat, viewport,
portals, visitedEdgeSet);
glBindTexture(GL_TEXTURE_2D, id);
//debug
sf::Uint8 *pixelArray = new sf::Uint8[width*height*4];
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixelArray); // to read from texture instead
sf::Image temp(width, height, pixelArray);
std::string filename = "envmap";
//char a[2] = {'a'+i, '\0'};
//filename.append(a);
filename.append(".jpg");
temp.SaveToFile(filename);
return;*/
glMatrixMode(GL_PROJECTION);
GLfloat aspectRatio = 1.;
GLfloat nearClip = 0.1f;
GLfloat farClip = 400.0f;
GLfloat fieldOfView = 90.0f; // Degrees
glLoadIdentity();
gluPerspective(fieldOfView, aspectRatio, nearClip, farClip);
glViewport(0, 0, width, height);
float lookVectors[24] = {
1, 0, 0, 1,
-1, 0, 0, 1,
0, 1, 0, 1,
0, -1, 0, 1,
0, 0, 1, 1,
0, 0, -1, 1
};
float up[24] = {
0, -1, 0, 1,
0, -1, 0, 1,
0, 0, 1, 1,
0, 0, -1, 1,
0, -1, 0, 1,
0, -1, 0, 1
};
struct MAZErectangle viewport;
viewport.left = 0;
viewport.bottom = 0;
viewport.width = width;
viewport.height = height;
GL_CHECK(glBindTexture(GL_TEXTURE_CUBE_MAP, dstCubemap));
struct Vec3 centerPos = vec2vecAdd(&eyePos,
lookVectors[direction*4],
lookVectors[direction*4+1],
lookVectors[direction*4+2]);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//.........这里部分代码省略.........