本文整理汇总了C++中CubeMap类的典型用法代码示例。如果您正苦于以下问题:C++ CubeMap类的具体用法?C++ CubeMap怎么用?C++ CubeMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CubeMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NeedCheckCubeStatus
void NeedCheckCubeStatus()
{
uint32 ClickerNum = 0;
// now checking if every clicker has debuff from manticron
// if not - apply mind exhaustion and delete from clicker's list
for (CubeMap::iterator i = Cube.begin(); i != Cube.end(); ++i)
{
Unit *clicker = Unit::GetUnit(*m_creature, (*i).second);
if (!clicker || !clicker->HasAura(SPELL_SHADOW_GRASP, EFFECT_INDEX_1))
{
DebuffClicker(clicker);
(*i).second = 0;
}
else
++ClickerNum;
}
// if 5 clickers from other cubes apply shadow cage
if (ClickerNum >= MAX_CLICK && !m_creature->HasAura(SPELL_SHADOW_CAGE, EFFECT_INDEX_0) && m_creature->HasAura(SPELL_BLASTNOVA, EFFECT_INDEX_0))
{
DoScriptText(SAY_BANISH, m_creature);
m_creature->CastSpell(m_creature, SPELL_SHADOW_CAGE, true);
}
else
{
if (ClickerNum < MAX_CLICK && m_creature->HasAura(SPELL_SHADOW_CAGE, EFFECT_INDEX_0))
m_creature->RemoveAurasDueToSpell(SPELL_SHADOW_CAGE);
}
if (!ClickerNum)
m_bNeedCheckCube = false;
}
示例2:
ReferenceTarget *CubeMap::Clone(RemapDir &remap)
{
CubeMap *pnew = new CubeMap;
pnew->ReplaceReference(0,pblock->Clone(remap));
BaseClone(this, pnew, remap);
return pnew;
}
示例3: NeedCheckCubeStatus
void NeedCheckCubeStatus()
{
uint32 ClickerNum = 0;
// now checking if every clicker has debuff from manticron(it is dispelable atm rev 6110 : S)
// if not - apply mind exhaustion and delete from clicker's list
for (CubeMap::iterator i = Cube.begin(); i != Cube.end(); ++i)
{
Unit* clicker = Unit::GetUnit(*me, (*i).second);
if (!clicker || !clicker->HasAura(SPELL_SHADOW_GRASP))
{
DebuffClicker(clicker);
(*i).second = 0;
}
else
++ClickerNum;
}
// if 5 clickers from other cubes apply shadow cage
if (ClickerNum >= CLICKERS_COUNT && !me->HasAura(SPELL_SHADOW_CAGE))
{
Talk(SAY_BANISH);
DoCast(me, SPELL_SHADOW_CAGE, true);
}
else
if (ClickerNum < CLICKERS_COUNT && me->HasAura(SPELL_SHADOW_CAGE))
me->RemoveAurasDueToSpell(SPELL_SHADOW_CAGE);
if (!ClickerNum)
NeedCheckCube = false;
}
示例4: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
CubeMap w;
w.show();
return a.exec();
}
示例5: ReadString
Texture<real>* SceneImporter<real>::ReadCubeMap( std::istream& stream, const std::string& name )
{
std::string imagesPath = ReadString( stream );
CubeMap<real>* cubeMap = new CubeMap<real>( imagesPath );
cubeMap->SetName( name );
return cubeMap;
}
示例6: Set
void Set(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t)
{
CubeMap *map = (CubeMap*) owner;
switch(id)
{
case pb_cubemapfile: map->SetCubeMapFile(v.s); break;
default: break;
}
GetCOREInterface()->RedrawViews(GetCOREInterface()->GetTime());
}
示例7: serialize
void CubeTexture::serialize(Archive* a) {
a->member("filename", filename);
a->optional("linear", linear, true);
a->optional("mipmap", mipmap, false);
if(a->isreading()) {
CubeMap<Vec3f> *m = ImageIO::LoadCubeRGBF(filename);
if(m->Resolution() == 0) cerr << "cannot load texture " << filename << endl << flush;
map.Copy(*m);
delete m;
_Init();
}
}
示例8: Vec2f
void TerrainApp::drawSphere()
{
Vec3f spherePos = mSphere.getCenter();
Vec3f roomDims = mRoom.getDims();
float x = ( spherePos.x + roomDims.x ) / ( roomDims.x * 2.0f );
float y = ( spherePos.z + roomDims.z ) / ( roomDims.z * 2.0f );;
Vec2f texCoord = Vec2f( x, y );
mCubeMap.bind();
mRd.getHeightsTexture().bind( 1 );
mRd.getNormalsTexture().bind( 2 );
mSphereShader.bind();
mSphereShader.uniform( "cubeMap", 0 );
mSphereShader.uniform( "heightsTex", 1 );
mSphereShader.uniform( "normalsTex", 2 );
mSphereShader.uniform( "mvpMatrix", mSpringCam.mMvpMatrix );
mSphereShader.uniform( "terrainScale", mTerrainScale );
mSphereShader.uniform( "eyePos", mSpringCam.getEye() );
mSphereShader.uniform( "fogColor", mFogColor );
mSphereShader.uniform( "sandColor", mSandColor );
mSphereShader.uniform( "power", mRoom.getPower() );
mSphereShader.uniform( "roomDims", mRoom.getDims() );
mSphereShader.uniform( "texCoord", texCoord );
mSphereShader.uniform( "sphereRadius", mSphere.getRadius() * 0.45f );
mSphereShader.uniform( "zoomMulti", mZoomMulti );
mSphereShader.uniform( "timePer", mRoom.getTimePer() * 1.5f + 0.5f );
gl::draw( mSphere, 128 );
mSphereShader.unbind();
}
示例9: ColorA
void TerrainApp::drawIntoRoomFbo()
{
mRoomFbo.bindFramebuffer();
gl::clear( ColorA( 0.0f, 0.0f, 0.0f, 0.0f ), true );
gl::setMatricesWindow( mRoomFbo.getSize(), false );
gl::setViewport( mRoomFbo.getBounds() );
gl::disableAlphaBlending();
gl::enable( GL_TEXTURE_2D );
glEnable( GL_CULL_FACE );
glCullFace( GL_BACK );
Matrix44f m;
m.setToIdentity();
m.scale( mRoom.getDims() );
mCubeMap.bind();
mRoomShader.bind();
mRoomShader.uniform( "cubeMap", 0 );
mRoomShader.uniform( "mvpMatrix", mSpringCam.mMvpMatrix );
mRoomShader.uniform( "mMatrix", m );
mRoomShader.uniform( "eyePos", mSpringCam.mEye );
mRoomShader.uniform( "roomDims", mRoom.getDims() );
mRoomShader.uniform( "power", mRoom.getPower() );
mRoomShader.uniform( "lightPower", mRoom.getLightPower() );
mRoomShader.uniform( "timePer", mRoom.getTimePer() * 1.5f + 0.5f );
mRoom.draw();
mRoomShader.unbind();
mRoomFbo.unbindFramebuffer();
glDisable( GL_CULL_FACE );
}
示例10: Set
void Set(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t)
{
CubeMap *map = (CubeMap*) owner;
switch(id)
{
case pb_cubemapfile:
{
IAssetManager* assetMgr = IAssetManager::GetInstance();
if(assetMgr)
{
map->SetCubeMapFile(assetMgr->GetAsset(v.s,kBitmapAsset)); break;
}
}
default: break;
}
GetCOREInterface()->RedrawViews(GetCOREInterface()->GetTime());
}
示例11: gen_cube_map
CubeMap gen_cube_map(const GLsizei size, spherical_function fn,
GLint internalFormat, GLenum format, GLenum type)
{
float ** data = new float*[6];
for (int i = 0; i < 6; i++)
data[i] = new float[size*size];
fill_cube_map(data, size, fn);
CubeMap map;
map.build();
map.load_cube(data, size, internalFormat, format, type);
for (int i = 0; i < 6; i++)
delete [] data[i];
delete [] data;
return map;
}
示例12: WinMain
int WINAPI WinMain(HINSTANCE hinst, HINSTANCE, LPSTR, int)
{
//PrimitiveRestart pr = PrimitiveRestart();
//pr.Start("OGLPractice");
//Instanced instance = Instanced();
//instance.Start("Instanced");
//Gouraud gouraud = Gouraud();
//gouraud.Start("Gouraud");
//LoadTexture loadTexture = LoadTexture();
//loadTexture.Start("LoadTexture");
CubeMap cubeMap = CubeMap();
cubeMap.Start("CubeMap");
/*
WNDCLASSW wc;
memset(&wc, 0, sizeof(wc));
wc.style = CS_CLASSDC;
wc.lpfnWndProc = WindowProc;
wc.cbWndExtra = sizeof(struct OGL *);
wc.hInstance = GetModuleHandleW(NULL);
wc.lpszClassName = L"ORT";
RegisterClassW(&wc);
// adjust the window size and show at InitDevice time
hwnd = CreateWindowW(wc.lpszClassName, L"OGLPractice", WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, 0, 0, hinst, 0);
if (!hwnd) return false;
SetWindowLongPtr(hwnd, 0, NULL);
hdc = GetDC(hwnd);
initDevice();
initSomthings2();
Run(MainLoop);
*/
return (0);
}
示例13: ColorA
void ShadedSphereApp::drawSphere()
{
gl::color( ColorA( 1, 1, 1, 1 ) );
gl::disable( GL_TEXTURE_2D );
mCubeMap.bind();
mSphereShader.bind();
mSphereShader.uniform( "cubeMap", 0 );
mSphereShader.uniform( "radius", 70.0f );
mSphereShader.uniform( "mvpMatrix", mSpringCam.mMvpMatrix );
mSphereShader.uniform( "eyePos", mSpringCam.getEye() );
mSphereShader.uniform( "power", mRoom.getPower() );
mSphereShader.uniform( "roomDim", mRoom.getDims() );
gl::drawSphere( Vec3f::zero(), 1.0f, 128 );
mSphereShader.unbind();
}
示例14: main
int main (int argc, char *argv[])
{
QApplication app(argc, argv);
handleCmdParams(argc, argv);
std::cout << "Loading " << image_path << "... ";
cv::Mat original_cross = cv::imread(image_path);
if(!original_cross.data)
{
std::cout << "Error" << std::endl;
return -1;
}
//convert to 32 Float for homogeinize formats
original_cross.convertTo(original_cross, CV_32F, 1.0f/255.0f);
//resize the image if it's needed
if(out_face_size != 0)
{
//image.resize(image, cv::Size2f(out_face_size*3, out_face_size*4));
cv::resize(original_cross, original_cross, cv::Size(out_face_size*3, out_face_size*4));
}
std::cout << "...Loaded" << std::endl;
if(show_orig_cross)
{
cv::namedWindow("Original Cross", CV_WINDOW_FLAGS);
cv::imshow("Original Cross", original_cross);
cv::waitKey();
cv::destroyWindow("Original Cross");
}
////Filtering
std::vector<CubeMap> filtered_cubes;
std::vector<float> pows;
std::vector<std::vector<cv::Mat> > filtered_face_images;
std::vector<cv::Mat> filtered_cross_images;
//Load cubemap
CubeMap cube;
cube.loadCubeCross(original_cross);
if(!mipmaps)
{
// //Load cubemap
// CubeMap cube;
// cube.loadCubeCross(original_cross);
int len = (pow_max - pow_min)/pow_step;
pows = std::vector<float> (len+1);
for(unsigned int i = 0; i < unsigned(len + 1); ++i)
{
pows[i] = pow_min + pow_step*i;
std::cout << "pows[" << i << "] --> " << pows[i] << std::endl;
}
filtered_cubes = CubeMapFilter::cosinePowFilterArrayCube(cube, filter_angle, pows);
cv::waitKey();
//filtered_cross_images = cubeMapsArrayToCrosses(filtered_cubes);
//cv::namedWindow("Bu", CV_WINDOW_FLAGS);
//cv::imshow("Bu", filtered_cross_images[0]);
//cv::waitKey();
//filtered_cubes[0].resizeCube(int(4));
filtered_cubes[0] = CubeMapFilter::edgePullFixup(filtered_cubes[0], fixup_band);
//filtered_cubes.push_back(CubeMapFilter::cosinePowFilterCube(cube, filter_angle, pows[0]));
}
else
{
//load cube and get cube size and steps
// CubeMap cube;
// cube.loadCubeCross(original_cross);
int face_size = cube.getFaceSize();
unsigned int steps = std::log2(face_size)+1;
std::cout << "Steps: " << steps << std::endl;
//initialize pow
float step = (pow_max - pow_min)/float(steps-1);
std::cout << "Step: " << step << std::endl;
pows = std::vector<float> (steps);
for(unsigned int i = 0; i < steps; ++i)
{
pows[i] = pow_min + step*float(steps - i - 1);
std::cout << "pows[" << i << "] --> " << pows[i] << std::endl;
}
//exit(0);
filtered_cubes = std::vector<CubeMap> (steps);
cv::Size cross_size = original_cross.size();
std::cout << "Original size: (" << cross_size.height << ", " << cross_size.width << ")" << std::endl;
cv::Mat aux_cross;
std::cout << "aux_cross" << std::endl;
for(unsigned int i = 0; i < steps; ++i)
{
// CubeMap cube_aux;
// std::cout << "compute step" << std::endl;
unsigned int step = std::pow(2,i);
// std::cout << "Compute new size" << std::endl;
cv::Size new_size(int(cross_size.width/step), int(cross_size.height/step));
std::cout << "New size: (" << new_size.height << ", " << new_size.width << ")" << std::endl;
// std::cout << "Resize" << std::endl;
#ifdef RESIZE_BEFORE
cv::resize(original_cross, aux_cross, new_size);
#endif
//.........这里部分代码省略.........
示例15: main
int main()
{
/* Create GL Window */
if (!initWindow())
return -1;
/* Initialise vertex buffers for cube */
CubeMap cubeMap;
cubeMap.loadCubeMap("../textures/cubemaps/Yokohama/");
/* Load shaders needed */
Entity* box = new Entity(glm::vec3(0));
box->setShader(ShaderManager::loadShader("simpleReflect"));
box->loadFromFile("../models/Cube.3ds");
rigidBodies.push_back(new RigidBody(box));
box = new Entity(glm::vec3(0,2,0));
box->setShader(ShaderManager::loadShader("simpleReflect"));
box->loadFromFile("../models/Cube.3ds");
rigidBodies.push_back(new RigidBody(box));
std::cout << "some amazing feature has been added";
glEnable(GL_DEPTH_TEST);
while (!glfwWindowShouldClose(window))
{
/* Rendering Code */
// Calculate deltatime of current frame
GLfloat currentFrame = glfwGetTime();
deltaTime = currentFrame - lastFrame;
lastFrame = currentFrame;
// Check if any events have been activiated (key pressed, mouse moved etc.) and call corresponding response functions
glfwPollEvents();
do_movement();
//do_rotation();
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glm::mat4 viewMatrix = glm::lookAt (
cameraPos, //where you are
cameraPos + cameraFront, // what you are looking at, however we move, the camera keeps looking at the target direction
cameraUp
);
glm::mat4 projectionMatrix = glm::perspective(
fov,
(GLfloat)WIDTH/(GLfloat)HEIGHT,
0.1f,
1000.0f
);
for(int i =0; i < rigidBodies.size(); i++)
{
//for(int j = 0; j < rigidBodies.size(); j++)
//{
// if (i ==j)
// continue;
// //if(rigidBodies[i]->aabb->collies(rigidBodies[j]->aabb))
// //do something with shaders to indicate collision in broadphase
//}
rigidBodies[i]->Update(deltaTime);
rigidBodies[i]->entity->getShader()->setUniformMatrix4fv("projectionMat", projectionMatrix);
//cubeMap.getShader()->setUniformMatrix4fv("projectionMat", projectionMatrix);
rigidBodies[i]->entity->getShader()->setUniformMatrix4fv("viewMat", viewMatrix);
//cubeMap.getShader()->setUniformMatrix4fv("viewMat", viewMatrix);
//dragonModel.getShader()->setUniformMatrix4fv("viewMat", view_mat);
rigidBodies[i]->entity->getShader()->setUniformVector4fv("camPos", glm::vec4(cameraPos, 1.0f));
//glm:: vec3 cam_pos= glm::vec3 (cam_pos);
//dragonModel.getShader()->setUniformVector4fv("camPos", glm::vec4(cam_pos, 1.0f));
//rigidBodies[i]->entity->getShader()->setUniformVector4fv("modelMat", rigidBodies[i]->entity->getModelMat());
rigidBodies[i]->entity->draw();
//rigidBodies[i]->ApplyGravity();
}
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glDisable(GL_TEXTURE_GEN_R);
//cubeMap.drawSkyBox();
//.........这里部分代码省略.........