本文整理汇总了C++中Storm3D_Scene::GetCamera方法的典型用法代码示例。如果您正苦于以下问题:C++ Storm3D_Scene::GetCamera方法的具体用法?C++ Storm3D_Scene::GetCamera怎么用?C++ Storm3D_Scene::GetCamera使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Storm3D_Scene
的用法示例。
在下文中一共展示了Storm3D_Scene::GetCamera方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderCones
void renderCones(Storm3D_Scene &scene, bool renderShadows, float timeFactor, bool renderGlows)
{
// this draws spotlight cone
frozenbyte::storm::PixelShader::disable();
Storm3D_ShaderManager::GetSingleton()->setProjectedShaders();
coneNvVertexShader.apply();
Storm3D_Camera &camera = *static_cast<Storm3D_Camera *> (scene.GetCamera());
glDepthMask(GL_FALSE);
glDisable(GL_ALPHA_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);
StormSpotList::iterator it = spots.begin();
for(; it != spots.end(); ++it)
{
Storm3D_Spotlight *spot = it->get();
if(!spot || !spot->enabled() || !spot->featureEnabled(IStorm3D_Spotlight::ConeVisualization))
continue;
if(renderShadows)
spot->renderCone(camera, timeFactor, renderGlows);
}
Storm3D_ShaderManager::GetSingleton()->setNormalShaders();
frozenbyte::storm::PixelShader::disable();
glDepthMask(GL_TRUE);
glDisable(GL_BLEND);
}
示例2: renderSpotBuffers
void renderSpotBuffers(Storm3D_Scene &scene, bool renderShadows)
{
bool atiShaders = false;
int spotType = Storm3D_Spotlight::getSpotType();
if(spotType == Storm3D_Spotlight::AtiBuffer)
atiShaders = true;
// FIXME: broken?
glPolygonOffset(1, 1);
glEnable(GL_POLYGON_OFFSET_FILL);
if(atiShaders)
Storm3D_ShaderManager::GetSingleton()->setAtiDepthShaders();
else
{
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
//glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
Storm3D_ShaderManager::GetSingleton()->setNormalShaders();
}
Storm3D_Camera &camera = *static_cast<Storm3D_Camera *> (scene.GetCamera());
Storm3D_Spotlight::clearCache();
if(renderShadows)
{
StormSpotList::iterator it = spots.begin();
for(; it != spots.end(); ++it)
{
Storm3D_Spotlight *spot = it->get();
if(!spot || !spot->enabled() || !spot->featureEnabled(IStorm3D_Spotlight::Shadows))
continue;
// Test spot visibility with foo scissor rect -- not really an optimal way of doing this
if(!spot->setScissorRect(camera, VC2I(100, 100), scene))
continue;
glDisable(GL_SCISSOR_TEST);
const float *cameraView = camera.GetView4x4Matrix();
if(!spot->setAsRenderTarget(cameraView))
continue;
glErrors();
renderer.render(IStorm3D_TerrainRendererBase::SpotBuffer, scene, spot);
glErrors();
}
}
Storm3D_ShaderManager::GetSingleton()->setNormalShaders();
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
frozenbyte::storm::PixelShader::disable();
glDisable(GL_POLYGON_OFFSET_FILL);
camera.Apply();
}
示例3: renderFakeSpotBuffers
void renderFakeSpotBuffers(Storm3D_Scene &scene, bool renderShadows)
{
// Renders fake shadows to texture?
Storm3D_ShaderManager::GetSingleton()->setFakeDepthShaders();
Storm3D_Camera &camera = *static_cast<Storm3D_Camera *> (scene.GetCamera());
// FIXME: this does not appear to do anything
// d3d9 tinkers with these parameters here
// but this is incorrect on opengl
// because texture sampling state is part of the texture
glActiveTexture(GL_TEXTURE1);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
Storm3D_FakeSpotlight::clearCache();
// bool rendered = false;
FakeSpotList::iterator it = fakeSpots.begin();
for(; it != fakeSpots.end(); ++it)
{
Storm3D_FakeSpotlight *spot = it->get();
if(!spot || !spot->enabled())
continue;
const float *cameraView = camera.GetView4x4Matrix();
if(!spot->setAsRenderTarget(cameraView))
continue;
renderer.render(IStorm3D_TerrainRendererBase::FakeSpotBuffer, scene, 0, spot);
// rendered = true;
}
//if(rendered)
// Storm3D_FakeSpotlight::filterBuffers(storm, device);
// FIXME: this does not appear to do anything
// d3d9 tinkers with these parameters here
// but this is incorrect on opengl
// because texture sampling state is part of the texture
glActiveTexture(GL_TEXTURE1);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
frozenbyte::storm::PixelShader::disable();
Storm3D_ShaderManager::GetSingleton()->setNormalShaders();
camera.Apply();
}
示例4: findDecals
void findDecals(Storm3D_Scene &scene)
{
decals.clear();
// Find decals
{
IStorm3D_Camera *camera = scene.GetCamera();
Storm3D_Camera *stormCamera = reinterpret_cast<Storm3D_Camera *> (camera);
Frustum frustum = stormCamera->getFrustum();
Tree::FrustumIterator itf(*tree, frustum);
for(; !itf.end(); itf.next())
decals.push_back(*itf);
std::sort(decals.begin(), decals.end(), DecalSorter());
}
}
示例5: renderShadows
void renderShadows(Storm3D_Scene &scene)
{
// this is BROKEN
// FIXME
// just clear the list
shadowDecals.clear();
return;
createIndexBuffers();
int renderAmount = 0;
if(!shadowDecals.empty())
{
IStorm3D_Camera *camera = scene.GetCamera();
Storm3D_Camera *stormCamera = reinterpret_cast<Storm3D_Camera *> (camera);
Frustum frustum = stormCamera->getFrustum();
shadowVertices.create(shadowDecals.size() * 4, VERTEX_SIZE, true);
int rawSize = shadowDecals.size() * 4 * VERTEX_SIZE;
void *ramBuffer = malloc(rawSize);
void *lockPointer = shadowVertices.lock();
VXFORMAT_DECAL *buffer = reinterpret_cast<VXFORMAT_DECAL *> (ramBuffer);
float inverseRange =1.f / fogRange;
for(unsigned int i = 0; i < shadowDecals.size(); ++i)
{
const StormDecal &decal = shadowDecals[i];
Sphere sphere(decal.position, decal.getRadius());
if(frustum.visibility(sphere))
{
float factor = decal.position.y - fogEnd;
factor *= inverseRange;
if(factor < 0.f)
factor = 0.f;
if(factor > 1.f)
factor = 1.f;
factor = 1.f - factor;
COL color = decal.light;
color.r += factor * (1.f - color.r);
color.g += factor * (1.f - color.g);
color.b += factor * (1.f - color.b);
DWORD vertexColor = color.GetAsD3DCompatibleARGB() & 0x00FFFFFF;
DWORD oldColor = decal.vertexColor;
decal.vertexColor = vertexColor;
decal.insert(buffer);
decal.vertexColor = oldColor;
buffer += 4;
++renderAmount;
}
}
if(renderAmount)
{
if(renderAmount > STORM_MAX_DECAL_AMOUNT)
renderAmount = STORM_MAX_DECAL_AMOUNT;
memcpy(lockPointer, ramBuffer, renderAmount * 4 * VERTEX_SIZE);
}
free(ramBuffer);
shadowVertices.unlock();
}
D3DXMATRIX tm;
frozenbyte::storm::VertexShader::disable();
frozenbyte::storm::PixelShader::disable();
Storm3D_ShaderManager::GetSingleton()->SetWorldTransform(tm);
applyFVF(DECAL_FVF, VERTEX_SIZE);
glActiveTexture(GL_TEXTURE0);
glClientActiveTexture(GL_TEXTURE0);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PRIMARY_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_ADD);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_PRIMARY_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
glActiveTexture(GL_TEXTURE1);
glClientActiveTexture(GL_TEXTURE1);
glDisable(GL_TEXTURE_2D);
glDisable(GL_TEXTURE_3D);
glDisable(GL_TEXTURE_CUBE_MAP);
glDepthMask(GL_FALSE);
glEnable(GL_BLEND);
glDisable(GL_ALPHA_TEST);
glBlendFunc(GL_ZERO, GL_SRC_COLOR);
if(renderAmount && shadowMaterial)
{
shadowVertices.apply(0);
shadowMaterial->applyShadow();
indices.render(renderAmount * 2, renderAmount * 4);
//.........这里部分代码省略.........
示例6: renderFakeSpotLights
void renderFakeSpotLights(Storm3D_Scene &scene, bool renderShadows)
{
// Renders fake shadows to screen?
Storm3D_Camera &camera = *static_cast<Storm3D_Camera *> (scene.GetCamera());
Storm3D_ShaderManager::GetSingleton()->setFakeShadowShaders();
glBlendFunc(GL_ZERO, GL_SRC_COLOR);
glEnable(GL_BLEND);
glDisable(GL_ALPHA_TEST);
glDepthMask(GL_FALSE);
// D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_PROJECTED done in shader in OpenGL
FakeSpotList::iterator it = fakeSpots.begin();
unsigned int count = 0;
for(; it != fakeSpots.end(); ++it)
{
Storm3D_FakeSpotlight *spot = it->get();
if(!spot || !spot->enabled())
continue;
const float *cameraView = camera.GetView4x4Matrix();
spot->applyTextures(cameraView);
for (int i = 0; i < 4; i++)
{
glActiveTexture(GL_TEXTURE0 + i);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
float temp[4] = { 0.0, 0.0f, 0.0f, 0.0f };
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, temp);
}
if (count == 0)
{
// this is the most horrific fucked up WTF thing ever
// without this we get strangely colored artifacts in strange places
// someone please explain what is going on
// for some reason first draw of fakespotlight is messed up
// so when drawing the first one, "fix it" by drawing it twice
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
renderer.render(IStorm3D_TerrainRendererBase::FakeSpotProjection, scene, 0, spot);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
}
renderer.render(IStorm3D_TerrainRendererBase::FakeSpotProjection, scene, 0, spot);
++count;
}
frozenbyte::storm::PixelShader::disable();
frozenbyte::storm::VertexShader::disable();
for (int i = 0; i < 4; i++)
{
glActiveTexture(GL_TEXTURE0 + i);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
}
Storm3D_ShaderManager::GetSingleton()->setNormalShaders();
glBlendFunc(GL_ONE, GL_ONE);
glDisable(GL_BLEND);
glDisable(GL_CLIP_PLANE0);
glDisable(GL_CLIP_PLANE1);
glDisable(GL_CLIP_PLANE2);
}
示例7: renderSpotLights
void renderSpotLights(Storm3D_Scene &scene, bool renderShadows, LightType type)
{
// this renders spotlight light & shadows
Storm3D_ShaderManager::GetSingleton()->setProjectedShaders();
glBlendFunc(GL_ONE, GL_ONE);
glEnable(GL_BLEND);
glDisable(GL_ALPHA_TEST);
glDepthMask(GL_FALSE);
Storm3D_Camera &camera = *static_cast<Storm3D_Camera *> (scene.GetCamera());
StormSpotList::iterator it = spots.begin();
for(; it != spots.end(); ++it)
{
Storm3D_Spotlight *spot = it->get();
if(!spot || !spot->enabled())
continue;
// Test spot visibility with foo scissor rect -- not really an optimal way of doing this
if(!spot->setScissorRect(camera, VC2I(100, 100), scene))
continue;
// glDisable below makes at least some spotlights visible through movie top & bottom "black bars"
//glDisable(GL_SCISSOR_TEST);
spot->applyTextures(camera.GetViewMatrix(), storm, renderShadows);
for(int i = 0; i < 4; ++i)
{
if(i != 2)
{
glActiveTexture(GL_TEXTURE0 + i);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
}
}
if(type == RealSolid)
renderer.render(IStorm3D_TerrainRendererBase::SpotProjectionSolid, scene, spot);
else
{
renderer.render(IStorm3D_TerrainRendererBase::SpotProjectionDecal, scene, spot);
renderer.render(IStorm3D_TerrainRendererBase::SpotProjectionAlpha, scene, spot);
}
}
Storm3D_ShaderManager::GetSingleton()->setNormalShaders();
glActiveTexture(GL_TEXTURE1);
glDisable(GL_TEXTURE_2D);
glDisable(GL_TEXTURE_3D);
glDisable(GL_TEXTURE_CUBE_MAP);
glBindTexture(GL_TEXTURE_2D, 0);
glActiveTexture(GL_TEXTURE2);
glDisable(GL_TEXTURE_2D);
glDisable(GL_TEXTURE_3D);
glDisable(GL_TEXTURE_CUBE_MAP);
glBindTexture(GL_TEXTURE_2D, 0);
glActiveTexture(GL_TEXTURE3);
glDisable(GL_TEXTURE_2D);
glDisable(GL_TEXTURE_3D);
glDisable(GL_TEXTURE_CUBE_MAP);
glBindTexture(GL_TEXTURE_2D, 0);
glActiveTexture(GL_TEXTURE4);
glDisable(GL_TEXTURE_2D);
glDisable(GL_TEXTURE_3D);
glDisable(GL_TEXTURE_CUBE_MAP);
glBindTexture(GL_TEXTURE_2D, 0);
frozenbyte::storm::PixelShader::disable();
glDisable(GL_BLEND);
glDisable(GL_SCISSOR_TEST);
glDisable(GL_CLIP_PLANE0);
glDisable(GL_CLIP_PLANE1);
glDisable(GL_CLIP_PLANE2);
}