- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
你能帮帮我吗?我不明白如何在 Ogre3D 中与普通对象一起绘制 PhysX 调试可视化。
我有 OpenGL 的代码,但我不能将它转换为 Ogre3d:
void RenderData(const PxRenderBuffer & data)
{
glLineWidth(1.0f);
glDisable(GL_LIGHTING);
//----------Render Points------------------
unsigned int NbPoints = data.getNbPoints();
if(NbPoints)
{
float* pVertList = new float[NbPoints*3];
float* pColorList = new float[NbPoints*4];
int vertIndex = 0;
int colorIndex = 0;
const PxDebugPoint* Points = data.getPoints();
while(NbPoints--)
{
pVertList[vertIndex++] = Points->pos.x;
pVertList[vertIndex++] = Points->pos.y;
pVertList[vertIndex++] = Points->pos.z;
pColorList[colorIndex++] = (float)((Points->color>>16)&0xff)/255.0f;
pColorList[colorIndex++] = (float)((Points->color>>8)&0xff)/255.0f;
pColorList[colorIndex++] = (float)(Points->color&0xff)/255.0f;
pColorList[colorIndex++] = 1.0f;
Points++;
}
RenderBuffer(pVertList, pColorList, GL_POINTS, data.getNbPoints());
delete[] pVertList;
delete[] pColorList;
}
//----------Render Lines------------------
unsigned int NbLines = data.getNbLines();
if(NbLines)
{
float* pVertList = new float[NbLines*3*2];
float* pColorList = new float[NbLines*4*2];
int vertIndex = 0;
int colorIndex = 0;
const PxDebugLine* Lines = data.getLines();
while(NbLines--)
{
pVertList[vertIndex++] = Lines->pos0.x;
pVertList[vertIndex++] = Lines->pos0.y;
pVertList[vertIndex++] = Lines->pos0.z;
pColorList[colorIndex++] = (float)((Lines->color0>>16)&0xff)/255.0f;
pColorList[colorIndex++] = (float)((Lines->color0>>8)&0xff)/255.0f;
pColorList[colorIndex++] = (float)(Lines->color0&0xff)/255.0f;
pColorList[colorIndex++] = 1.0f;
pVertList[vertIndex++] = Lines->pos1.x;
pVertList[vertIndex++] = Lines->pos1.y;
pVertList[vertIndex++] = Lines->pos1.z;
pColorList[colorIndex++] = (float)((Lines->color0>>16)&0xff)/255.0f;
pColorList[colorIndex++] = (float)((Lines->color0>>8)&0xff)/255.0f;
pColorList[colorIndex++] = (float)(Lines->color0&0xff)/255.0f;
pColorList[colorIndex++] = 1.0f;
Lines++;
}
RenderBuffer(pVertList, pColorList, GL_LINES, data.getNbLines()*2);
delete[] pVertList;
delete[] pColorList;
}
//----------Render Triangles------------------
unsigned int NbTris = data.getNbTriangles();
if(NbTris)
{
float* pVertList = new float[NbTris*3*3];
float* pColorList = new float[NbTris*4*3];
int vertIndex = 0;
int colorIndex = 0;
const PxDebugTriangle* Triangles = data.getTriangles();
while(NbTris--)
{
pVertList[vertIndex++] = Triangles->pos0.x;
pVertList[vertIndex++] = Triangles->pos0.y;
pVertList[vertIndex++] = Triangles->pos0.z;
pVertList[vertIndex++] = Triangles->pos1.x;
pVertList[vertIndex++] = Triangles->pos1.y;
pVertList[vertIndex++] = Triangles->pos1.z;
pVertList[vertIndex++] = Triangles->pos2.x;
pVertList[vertIndex++] = Triangles->pos2.y;
pVertList[vertIndex++] = Triangles->pos2.z;
for(int i=0;i<3;i++)
{
pColorList[colorIndex++] = (float)((Triangles->color0>>16)&0xff)/255.0f;
pColorList[colorIndex++] = (float)((Triangles->color0>>8)&0xff)/255.0f;
pColorList[colorIndex++] = (float)(Triangles->color0&0xff)/255.0f;
pColorList[colorIndex++] = 1.0f;
}
Triangles++;
}
RenderBuffer(pVertList, pColorList, GL_TRIANGLES, data.getNbTriangles()*3);
delete[] pVertList;
delete[] pColorList;
}
glEnable(GL_LIGHTING);
glColor4f(1.0f,1.0f,1.0f,1.0f);
}
void RenderBuffer(float* pVertList, float* pColorList, int type, int num)
{
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3,GL_FLOAT, 0, pVertList);
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(4, GL_FLOAT, 0, pColorList);
glDrawArrays(type, 0, num);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
}
当然,您不能使用此代码。我只想绘制 PhysX 调试可视化。
最佳答案
看看名为“NxOgre”的 Ogre3D PhysX 包装器(结合 Critter,它是 Ogre3D 的实际桥梁)是如何工作的。一个好的起点是 wiki tutorial page .
大纲:PhsyX 为每个世界中的每个场景提供调试渲染数据结构。这可以被采用并形成一个数据结构,可以在 Ogre3D 中使用以进行渲染。
for (World::SceneIterator iterator = mWorld->getScenes(); iterator != iterator.end(); iterator++)
{
const NxDebugRenderable* renderable = iterator->getScene()->getDebugRenderable();
if (renderable == 0)
continue;
unsigned int nbLines = renderable->getNbLines();
const NxDebugLine* lines = renderable->getLines();
while(nbLines--)
{
mMeshData->mLines.push_back(lines->p0.x);
mMeshData->mLines.push_back(lines->p0.y);
mMeshData->mLines.push_back(lines->p0.z);
mMeshData->mLines.push_back(lines->p1.x);
mMeshData->mLines.push_back(lines->p1.y);
mMeshData->mLines.push_back(lines->p1.z);
mMeshData->mColours.push_back(lines->color);
mMeshData->mColours.push_back(lines->color);
lines++;
}
mMeshData->mNbLines += renderable->getNbLines();
}
最相关的部分:
关于c++ - (Ogre3d/PhysX/C++) - 如何绘制调试可视化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25344410/
我刚刚在 GitHub 上下载了 PhysX 3.4,但似乎无法编译 PhysX.sln。我收到很多这样的错误: C1083 Cannot open include file: 'stddef.h':
我正在尝试为 PhysX 应用程序中的物理模拟定义一个时间步长,这样物理将在所有机器上以相同的速度运行。我希望物理以 60FPS 的速度更新,因此每次更新应该有 1/60 秒的增量时间。 我的应用程序
我正在尝试在游戏引擎中实现PhysX,但是在链接PhysX库时遇到了一些奇怪的问题。无论我做什么,它总是失败,但是Nvidia的片段却像是一种魅力。我将尝试描述自己的所作所为,希望有人能找到我所缺少的
我正在使用 PhysX 作为基础物理求解器(使用它的 SPH 模拟)开发一个非真实感水渲染演示,并希望添加泡沫和水滴渲染以增强其视觉效果。 首先,我使用相邻粒子的数量作为阈值将它们分成几组(水、泡沫和
今天,我试着玩弄 Physx 和 Physx 可视化调试器,一如既往,新手会遇到问题和疑问。我会用我糟糕的英语水平尽可能地描述我的问题。 1) 我设法创建了一个 physx 场景。添加一个动态 Act
我需要在 PhysX 3.2 中制作一个类似 NULL 的刚体。一个非碰撞的 - 仅作为 anchor 。有什么办法吗?我只需要它来解决一些关节组合。提前致谢 最佳答案 首先为对创建一个过滤器: Px
就目前情况而言,这个问题不太适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、民意调查或扩展讨论。如果您觉得这个问题可以改进并可能重新开放,visit
我最近比较了一些用于模拟和游戏开发的物理引擎。有些是免费的,有些是开源的,有些是商业的(1 甚至是非常商业的 $$$$)。Havok、Ode、Newton(又名 oxNewton)、Bullet、Ph
你能帮帮我吗?我不明白如何在 Ogre3D 中与普通对象一起绘制 PhysX 调试可视化。 我有 OpenGL 的代码,但我不能将它转换为 Ogre3d: void RenderData(const
我目前正在使用 physx(尝试将 ik 添加到布娃娃)。出于某种原因,布娃娃的所有关节都是无摩擦的,因此,布娃娃往往会“摇晃”,尤其是当它悬卡在空中并连接到多个移动的运动参与者时。 我想给关节增加摩
我正在开展一个项目,我需要在我的 PhysX 应用程序中创建一个地形。 作为输入数据,我有 dted 文件(高程)。 在 PhysX 中创建地形的更好方法是什么?我需要一个大地形。 我尝试创建一个 H
所以,现在,我正在尝试开发一款游戏的直升机系统。我遇到的问题是,我想编辑直升机的重力,并且仅当我在其中/使用它时,但现在它导致所有使用 PhysX 的对象失去它的重力。 这是我正在使用的函数。 g_p
我仍在研究用于模拟流体的物理系统。我重写了我的应用程序以使用 PhysX 3.3.0 并变得更加客观,现在我遇到了一个问题,我在一两周内无法解决。 这是我对 PhysX Context 的启动: vo
我正在尝试使用我的老师提供的引擎来创建布娃娃。我们使用 DirectX 10,.X 格式作为网格文件(使用 assimp 和老师设计的封闭解析器)和 Nvidia PhysX。 我有工作动画(网格变形
我注意到有很多函数可以进行光线转换,但它们似乎使用了常量 NxRay 我遇到的问题是有一辆向下转换光线的车辆作为我的 NxRay。它不是恒定的,因为车辆可以以不同的角度移动,但我希望能够进行光线转换以
我有一个应用程序是为使用 Bullet 物理引擎而编写的。我在 8 核的 Intel i7 2600K CPU 上运行它。该应用程序必须处理数百万个物理工作 block ,每个工作 block 都可以
我正在使用 Ogre3D 和 PhysX。 当我从 8 位高度图加载地形时,它在 Visual Debugger 上看起来很正常。 看第一张图: http://img44.imageshack.us/
我正在浏览最近开源的 NVidia PhysX 3.4,我发现的都是 C++ 类 - 是 header 版本还是仅 C 语言的包装器 API? 最佳答案 可能您必须自己创建 C Header 包装器
所以,我正在尝试从 Qt Creator 中的 HelloWorldRender 片段编译代码。我希望能够做的只是单步执行调试器中的代码并对其进行修改,以便我可以了解如何使用它。 但是,问题是当我尝试
我是一名优秀的程序员,十分优秀!