- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
一段时间以来,我一直在努力让 SkyX 工作,但未能成功。这是我的代码:
//THESE ARE GLOBAL
SkyX::BasicController* skyBasicController = NULL;
SkyX::SkyX* mSkyX = NULL;
Ogre::Camera* camera;
...
Ogre::SceneManager *sceneManager = ogreMain.getRoot()->createSceneManager(
Ogre::ST_GENERIC, "MainSceneManager");
Ogre::SceneNode *rootSceneNode = sceneManager->getRootSceneNode();
Ogre::ResourceGroupManager& resGrpMgr =
Ogre::ResourceGroupManager::getSingleton();
Ogre::String terrainResGrpName = "Terrain";
resGrpMgr.createResourceGroup(terrainResGrpName);
resGrpMgr.addResourceLocation(".\\Media\\Terrain\\programs", "FileSystem",
terrainResGrpName, 0);
resGrpMgr.addResourceLocation(".\\Media\\Terrain\\scripts", "FileSystem",
terrainResGrpName, 0);
resGrpMgr.addResourceLocation(".\\Media\\Terrain\\textures", "FileSystem",
terrainResGrpName, 0);
// The function 'initialiseResourceGroup' parses scripts if any in the locations.
resGrpMgr.initialiseResourceGroup(terrainResGrpName);
// Files that can be loaded are loaded.
resGrpMgr.loadResourceGroup(terrainResGrpName);
Ogre::String skyResGrpName = "SkyX";
resGrpMgr.createResourceGroup(skyResGrpName);
resGrpMgr.addResourceLocation(".\\Media\\SkyX", "FileSystem", skyResGrpName,
0);
// The function 'initialiseResourceGroup' parses scripts if any in the locations.
resGrpMgr.initialiseResourceGroup(skyResGrpName);
// Files that can be loaded are loaded.
resGrpMgr.loadResourceGroup(skyResGrpName);
ogreMain.getWindow()->setActive(true);
ogreMain.getWindow()->setAutoUpdated(false);
sceneManager->setAmbientLight(Ogre::ColourValue(.6, .6, .6));
sceneManager->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE);
sceneManager->setShadowColour(ColourValue(0, 0, 0));
camera = sceneManager->createCamera();
Ogre::SceneNode *camera_node = player_node->createChildSceneNode();
camera_node->attachObject(camera);
float viewport_width = 1.0f;
float viewport_height = 1.0f;
float viewport_left = (1.0f - viewport_width) * 0.5f;
float viewport_top = (1.0f - viewport_height) * 0.5f;
unsigned short lMainViewportZOrder = 100;
Ogre::Viewport *vp = ogreMain.getWindow()->addViewport(camera,
lMainViewportZOrder, viewport_left, viewport_top, viewport_width,
viewport_height);
vp->setAutoUpdated(true);
//vp->setBackgroundColour(Ogre::ColourValue(0.2f, 0.2f, 0.2f));
float ratio = float(vp->getActualWidth()) / float(vp->getActualHeight());
camera->setAspectRatio(ratio);
camera->setNearClipDistance(1.5f);
camera->setFarClipDistance(50000);
camera->setPosition(0, 6, 26);
camera->setDirection(0, -1, -6.5f);
...
skyBasicController = new SkyX::BasicController();
mSkyX = new SkyX::SkyX(sceneManager, skyBasicController);
mSkyX->create();
mSkyX->getVCloudsManager()->getVClouds()->setDistanceFallingParams(
Ogre::Vector2(2, -1));
ogreMain.getRoot()->addFrameListener(mSkyX);
ogreMain.getWindow()->addListener(mSkyX);
setPreset(mPresets[3]);
ogreMain.getRoot()->clearEventTimes();
... //some var declarations, then main loop
//BELOW HERE IS TAKEN FROM 2ND DEMO
struct SkyXSettings
{
/** Constructor
@remarks Skydome + vol. clouds + lightning settings
*/
SkyXSettings(const Ogre::Vector3 t, const Ogre::Real& tm, const Ogre::Real& mp, const SkyX::AtmosphereManager::Options& atmOpt,
const bool& lc, const bool& vc, const Ogre::Real& vcws, const bool& vcauto, const Ogre::Radian& vcwd,
const Ogre::Vector3& vcac, const Ogre::Vector4& vclr, const Ogre::Vector4& vcaf, const Ogre::Vector2& vcw,
const bool& vcl, const Ogre::Real& vclat, const Ogre::Vector3& vclc, const Ogre::Real& vcltm)
: time(t), timeMultiplier(tm), moonPhase(mp), atmosphereOpt(atmOpt), layeredClouds(lc), volumetricClouds(vc), vcWindSpeed(vcws)
, vcAutoupdate(vcauto), vcWindDir(vcwd), vcAmbientColor(vcac), vcLightResponse(vclr), vcAmbientFactors(vcaf), vcWheater(vcw)
, vcLightnings(vcl), vcLightningsAT(vclat), vcLightningsColor(vclc), vcLightningsTM(vcltm)
{}
/** Constructor
@remarks Skydome + vol. clouds
*/
SkyXSettings(const Ogre::Vector3 t, const Ogre::Real& tm, const Ogre::Real& mp, const SkyX::AtmosphereManager::Options& atmOpt,
const bool& lc, const bool& vc, const Ogre::Real& vcws, const bool& vcauto, const Ogre::Radian& vcwd,
const Ogre::Vector3& vcac, const Ogre::Vector4& vclr, const Ogre::Vector4& vcaf, const Ogre::Vector2& vcw)
: time(t), timeMultiplier(tm), moonPhase(mp), atmosphereOpt(atmOpt), layeredClouds(lc), volumetricClouds(vc), vcWindSpeed(vcws)
, vcAutoupdate(vcauto), vcWindDir(vcwd), vcAmbientColor(vcac), vcLightResponse(vclr), vcAmbientFactors(vcaf), vcWheater(vcw), vcLightnings(false)
{}
/** Constructor
@remarks Skydome settings
*/
SkyXSettings(const Ogre::Vector3 t, const Ogre::Real& tm, const Ogre::Real& mp, const SkyX::AtmosphereManager::Options& atmOpt, const bool& lc)
: time(t), timeMultiplier(tm), moonPhase(mp), atmosphereOpt(atmOpt), layeredClouds(lc), volumetricClouds(false), vcLightnings(false)
{}
/// Time
Ogre::Vector3 time;
/// Time multiplier
Ogre::Real timeMultiplier;
/// Moon phase
Ogre::Real moonPhase;
/// Atmosphere options
SkyX::AtmosphereManager::Options atmosphereOpt;
/// Layered clouds?
bool layeredClouds;
/// Volumetric clouds?
bool volumetricClouds;
/// VClouds wind speed
Ogre::Real vcWindSpeed;
/// VClouds autoupdate
bool vcAutoupdate;
/// VClouds wind direction
Ogre::Radian vcWindDir;
/// VClouds ambient color
Ogre::Vector3 vcAmbientColor;
/// VClouds light response
Ogre::Vector4 vcLightResponse;
/// VClouds ambient factors
Ogre::Vector4 vcAmbientFactors;
/// VClouds wheater
Ogre::Vector2 vcWheater;
/// VClouds lightnings?
bool vcLightnings;
/// VClouds lightnings average aparition time
Ogre::Real vcLightningsAT;
/// VClouds lightnings color
Ogre::Vector3 vcLightningsColor;
/// VClouds lightnings time multiplier
Ogre::Real vcLightningsTM;
};
/** Demo presets
@remarks The best way of determinate each parameter value is by using a real-time editor.
These presets have been quickly designed using the Paradise Editor, which is a commercial solution.
At the time I'm writting these lines, SkyX 0.1 is supported by Ogitor. Hope that the Ogitor team will
support soon SkyX 0.3, this way you all are going to be able to quickly create cool SkyX configurations.
*/
SkyXSettings mPresets[] = {
// Sunset
SkyXSettings(Ogre::Vector3(8.85f, 7.5f, 20.5f), -0.08f, 0, SkyX::AtmosphereManager::Options(9.77501f, 10.2963f, 0.01f, 0.0022f, 0.000675f, 30, Ogre::Vector3(0.57f, 0.52f, 0.44f), -0.991f, 3, 4), false, true, 300, false, Ogre::Radian(270), Ogre::Vector3(0.63f,0.63f,0.7f), Ogre::Vector4(0.35, 0.2, 0.92, 0.1), Ogre::Vector4(0.4, 0.7, 0, 0), Ogre::Vector2(0.8,1)),
// Clear
SkyXSettings(Ogre::Vector3(17.16f, 7.5f, 20.5f), 0, 0, SkyX::AtmosphereManager::Options(9.77501f, 10.2963f, 0.01f, 0.0017f, 0.000675f, 30, Ogre::Vector3(0.57f, 0.54f, 0.44f), -0.991f, 2.5f, 4), false),
// Thunderstorm 1
SkyXSettings(Ogre::Vector3(12.23, 7.5f, 20.5f), 0, 0, SkyX::AtmosphereManager::Options(9.77501f, 10.2963f, 0.01f, 0.00545f, 0.000375f, 30, Ogre::Vector3(0.55f, 0.54f, 0.52f), -0.991f, 1, 4), false, true, 300, false, Ogre::Radian(0), Ogre::Vector3(0.63f,0.63f,0.7f), Ogre::Vector4(0.25, 0.4, 0.5, 0.1), Ogre::Vector4(0.45, 0.3, 0.6, 0.1), Ogre::Vector2(1,1), true, 0.5, Ogre::Vector3(1,0.976,0.92), 2),
// Thunderstorm 2
SkyXSettings(Ogre::Vector3(10.23, 7.5f, 20.5f), 0, 0, SkyX::AtmosphereManager::Options(9.77501f, 10.2963f, 0.01f, 0.00545f, 0.000375f, 30, Ogre::Vector3(0.55f, 0.54f, 0.52f), -0.991f, 0.5, 4), false, true, 300, false, Ogre::Radian(0), Ogre::Vector3(0.63f,0.63f,0.7f), Ogre::Vector4(0, 0.02, 0.34, 0.24), Ogre::Vector4(0.29, 0.3, 0.6, 1), Ogre::Vector2(1,1), true, 0.5, Ogre::Vector3(0.95,1,1), 2),
// Desert
SkyXSettings(Ogre::Vector3(7.59f, 7.5f, 20.5f), 0, -0.8f, SkyX::AtmosphereManager::Options(9.77501f, 10.2963f, 0.01f, 0.0072f, 0.000925f, 30, Ogre::Vector3(0.71f, 0.59f, 0.53f), -0.997f, 2.5f, 1), true),
// Night
SkyXSettings(Ogre::Vector3(21.5f, 7.5, 20.5), 0.03, -0.25, SkyX::AtmosphereManager::Options(), true)
};
void setPreset(const SkyXSettings& preset)
{
mSkyX->setTimeMultiplier(preset.timeMultiplier);
mBasicController->setTime(preset.time);
mBasicController->setMoonPhase(preset.moonPhase);
mSkyX->getAtmosphereManager()->setOptions(preset.atmosphereOpt);
// Layered clouds
if (preset.layeredClouds)
{
// Create layer cloud
if (mSkyX->getCloudsManager()->getCloudLayers().empty())
{
mSkyX->getCloudsManager()->add(SkyX::CloudLayer::Options(/* Default options */));
}
}
else
{
// Remove layer cloud
if (!mSkyX->getCloudsManager()->getCloudLayers().empty())
{
mSkyX->getCloudsManager()->removeAll();
}
}
mSkyX->getVCloudsManager()->setWindSpeed(preset.vcWindSpeed);
mSkyX->getVCloudsManager()->setAutoupdate(preset.vcAutoupdate);
SkyX::VClouds::VClouds* vclouds = mSkyX->getVCloudsManager()->getVClouds();
vclouds->setWindDirection(preset.vcWindDir);
vclouds->setAmbientColor(preset.vcAmbientColor);
vclouds->setLightResponse(preset.vcLightResponse);
vclouds->setAmbientFactors(preset.vcAmbientFactors);
vclouds->setWheater(preset.vcWheater.x, preset.vcWheater.y, false);
if (preset.volumetricClouds)
{
// Create VClouds
if (!mSkyX->getVCloudsManager()->isCreated())
{
// SkyX::MeshManager::getSkydomeRadius(...) works for both finite and infinite(=0) camera far clip distances
mSkyX->getVCloudsManager()->create(mSkyX->getMeshManager()->getSkydomeRadius(mRenderingCamera));
}
}
else
{
// Remove VClouds
if (mSkyX->getVCloudsManager()->isCreated())
{
mSkyX->getVCloudsManager()->remove();
}
}
vclouds->getLightningManager()->setEnabled(preset.vcLightnings);
vclouds->getLightningManager()->setAverageLightningApparitionTime(preset.vcLightningsAT);
vclouds->getLightningManager()->setLightningColor(preset.vcLightningsColor);
vclouds->getLightningManager()->setLightningTimeMultiplier(preset.vcLightningsTM);
//mTextArea->setCaption(buildInfoStr());
// Reset camera position/orientation
//mRenderingCamera->setPosition(0,0,0);
//mRenderingCamera->setDirection(0,0,1);
mSkyX->update(0);
}
我没有使用 ExampleApplication 框架或任何其他框架。我根据自己的需要编写了自己的小类。
我只能看到闪电,与演示相比它们似乎太近了。此外,所有闪电的源头始终位于相机的顶部,并随之移动。
在我的场景中,我只有几个盒子和一个连接到其中一个的相机。
我已将 SkyX 0.3.1 编译为单独的 DLL,具有与调试配置集相同的 boost 和 ogre 库(与应用程序一起,所有配置为调试)。
提及 SkyX 的调试输出如下:
Creating resource group Terrain
Added resource location '.\Media\Terrain\programs' of type 'FileSystem' to resource group 'Terrain'
Added resource location '.\Media\Terrain\scripts' of type 'FileSystem' to resource group 'Terrain'
Added resource location '.\Media\Terrain\textures' of type 'FileSystem' to resource group 'Terrain'
Initialising resource group Terrain
Parsing scripts for resource group Terrain
Parsing script Terrain.material
Finished parsing scripts for resource group Terrain
Creating resources for group Terrain
All done
Loading resource group 'Terrain' - Resources: 1 World Geometry: 1
Texture: TerrainAmbientMap.jpg: Loading 1 faces(PF_L8,512x512x1) Internal format is PF_L8,512x512x1.
Texture: TerrainTex0.jpg: Loading 1 faces(PF_R8G8B8,512x512x1) Internal format is PF_X8R8G8B8,512x512x1.
Texture: TerrainTex1.jpg: Loading 1 faces(PF_R8G8B8,512x512x1) Internal format is PF_X8R8G8B8,512x512x1.
Finished loading resource group Terrain
Creating resource group SkyX
Added resource location '.\Media\SkyX' of type 'FileSystem' to resource group 'SkyX'
Initialising resource group SkyX
Parsing scripts for resource group SkyX
Parsing script SkyX.material
Finished parsing scripts for resource group SkyX
Creating resources for group SkyX
All done
Loading resource group 'SkyX' - Resources: 1 World Geometry: 1
Texture: Noise.jpg: Loading 1 faces(PF_R8G8B8,1024x1024x1) Internal format is PF_X8R8G8B8,1024x1024x1.
Texture: SkyX_Starfield.png: Loading 1 faces(PF_A8R8G8B8,512x512x1) Internal format is PF_A8R8G8B8,512x512x1.
Texture: SkyX_Moon.png: Loading 1 faces(PF_A8R8G8B8,512x512x1) Internal format is PF_A8R8G8B8,512x512x1.
Texture: SkyX_MoonHalo.png: Loading 1 faces(PF_A8R8G8B8,512x256x1) Internal format is PF_A8R8G8B8,512x256x1.
Finished loading resource group SkyX
...
Can't assign material _NULL_ to SubEntity of SkyXMeshEnt because this Material does not exist. Have you forgotten to define it in a .material script?
[SkyX] VClouds warning: unregistered camera registered, manual unregistering is needed before camera destruction
谢谢。
最佳答案
只需删除以下行即可解决问题。显然阴影不适用于 SkyX。
sceneManager->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE);
虽然你可以在 SkyX 初始化后使用那条线,但我不知道它是否有效。
关于c++ - Ogre3D 和 SkyX - 无法让 SkyX 正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14609386/
我使用 Ubuntu 10.10 编译并安装了最新的 Ogre 和 CEGUI 库。 例如,我可以#include,但是当我尝试添加 CEGUI header 时,我遇到了问题。 #include
所以我正在尝试使用 OGRE 在 C++ 中制作游戏。但我就是无法启动和运行 OGRE。 我遵循了本网站上的教程:http://www.ogre3d.org/tikiwiki/tiki-index.p
对于我在 c++ 中的项目 Ogre,我想使用 Ogre 的 SimpleSpline 创建一个对象的动画。一切正常,对象正确地沿着路径中的点序列进行动画处理。由于我需要使用正交 View 的场景,所
目前我正在从事 ADAS 项目,使用 ROS 和 OGRE(面向对象的图形渲染引擎)可视化道路模型(车道中心、车道边界等)。输入是几何点 (x,y,z)。 我可以使用 Ogre::RenderOper
到目前为止,我已经设法完成了我的 C++ 游戏编程生涯,几乎从未接触过异常,但最近我一直在使用 Ogre 引擎开发一个项目,并且我正在努力学习。我在这里发现了很多关于 C++ 异常的一般用法的很好的问
首先,先确认一下你的字段值是不是乱码,如果是,按照以下方法: 我的字段值是来自于一个geojson字符串,我在对它解析时做了如下处理: ?
我有一个有 body 和头部的角色。头和 body 相连,就像一根骨头,我已经知道骨头的名字了。现在我想得到头部的方向?那可能吗?我试过了,但它似乎不起作用: Entity *smith = m_sc
我正在使用 OGRE 1.7。我想制作一个有两个窗口的应用程序,第一个渲染场景(一堆 3D 点),第二个必须呈现一组控件(按钮、下拉菜单、标签等)。我目前正在使用 SDKTrays 来组织按钮,但由于
我尝试编译以下代码(来自 Felix Kerger 的 Ogre3d 初学者指南) #include "Ogre\ExampleApplication.h" class Example1 : p
假设我的世界中有一个 3d 对象,看起来像下面的东西.. http://en.wikipedia.org/wiki/File:Graftal3.png 我还有一个节点存储有关如何绘制的信息... ht
我在 Ogre3D 中用聚光灯照亮一架飞机。然而,热点上的边缘显示出之字形效果。看起来平面上的阴影是在每个顶点上完成的,没有任何插值。 线框渲染结果如下图: 如何在 Ogre3D 中启用逐像素照明,从
操作系统:Ubuntu 16.04 食人魔:v1.9 我正在尝试从这个 repository 编译代码.虽然它适用于 Ogre v1.9,但它给了我这个错误: In file included fro
我正在根据基本的 Ogre 教程编写自己的 Ogre 应用。 有谁知道在没有第一个设置对话框的情况下启动 OgreRenderWindow 的方法吗? 我知道 Ogre Basic tutorial
我已经在我的 PC 上安装了 Ogre 和依赖项,并下载了一些 Ogre 应用程序。当我启动我刚刚下载的项目的新 exe 文件时,它会生成以下错误: 05:37:59: Loading library
我已经成功编译并运行了 ogre3d.org 中提到的教程。它编译没有任何错误。 在那个教程中我使用了 http://www.ogre3d.org/tikiwiki/tiki-index.php?pa
我想做的是拥有一个应用程序(我目前正在使用示例框架应用程序)并在其中包含任何 ogre 库文件,而不是为整个系统安装它。这样一来,我就可以轻松地将应用程序移植到其他计算机上。 我使用的是 Mac OS
我正在开发将实时 View 设置为窗口背景的 Ogre 应用程序。 Hovewer 当我尝试使用 RenderTarget::getAverageFPS() 获取我的应用程序的帧速率时我有疑问,然后我
我正在尝试使用下面给出的代码将 Ogre 嵌入到 Qt 中: https://github.com/gklingler/QOgreWidget 它在我的系统上运行良好,没有任何问题,但是当我尝试在我的
在 CodeBlocks 中尝试在 linux 下编译时我得到 cannot find -lOgreMain_d 和 cannot find -lOIS_d. 在我的链接器设置下 /usr/lib/l
我已经使用 Code::Blocks 构建 Ogre 并将其安装到我的 Debian 中。接下来,我尝试编译教程应用程序,但出现以下错误: obj/Debug/BaseApplication.o: I
我是一名优秀的程序员,十分优秀!