- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 cocos3d 中使用 CC3MeshNode 绘制了一个复杂的 3d 形状,但是这个形状不受我在世界中设置的光源(灯)的影响(阴影和明亮的地方取决于定位),如果我使用其中一个populateAs 方法来绘制类似球体的东西,它会受到光源的影响。手动绘制 CC3MeshNode 时应该怎么做才能使其受到光线的影响。
下面是在cocos3d中手动绘制矩形的示例代码
CC3MeshNode *pMeshNode = [[CC3MeshNode alloc] init];
[pMeshNode setIsTouchEnabled:YES];
CC3Mesh* theArrayMesh = [pMeshNode prepareParametricMesh];
// Prepare the vertex content and allocate space for vertices and indices.
[theArrayMesh ensureVertexContent];
theArrayMesh.allocatedVertexCapacity = totalVertexCount;
theArrayMesh.allocatedVertexIndexCapacity = (triangleCount * 3);
GLushort* indices = theArrayMesh.vertexIndices.vertices;
/*
* 1-------0
* | /| -z
* | / | ⥣
* | / | =>+x
* | / |
* | / |
* | / |
* |/ |
* 2-------3
*/
{
[theArrayMesh setVertexLocation: cc3v(3, -3,0) at: 3];
[theArrayMesh setVertexLocation: cc3v(-3, -3,0 ) at: 2];
[theArrayMesh setVertexLocation: cc3v(-3, 3, 0) at: 1];
[theArrayMesh setVertexLocation: cc3v(3, 3, 0) at: 0];
}
GLubyte indxIndx = 0;
GLubyte vtxIndx = 0;
for (int side = 0; side < 1; side++) {
// First trangle of side - CCW from bottom left
indices[indxIndx++] = vtxIndx++; // vertex 0
indices[indxIndx++] = vtxIndx++; // vertex 1
indices[indxIndx++] = vtxIndx; // vertex 2
// Second triangle of side - CCW from bottom left
indices[indxIndx++] = vtxIndx++; // vertex 2
indices[indxIndx++] = vtxIndx++; // vertex 3
indices[indxIndx++] = (vtxIndx - 4); // vertex 0
}
[self addChild:pMeshNode];
最佳答案
我认为问题在于您需要为网格提供顶点法线。光照计算需要法线才能正确运行。自动填充球体等的例程正在生成顶点法线并将其存储在网格中。当您使用 glEnable(GL_AUTO_NORMAL) 时,桌面 OpenGL 将为没有法线的网格生成法线,但此功能在移动设备中不存在,至少在 OpenGL ES 2.0 中不存在。
关于ios - CC3MeshNode在cocos3d中不受光照影响,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17084380/
我试图找到使用这行代码的原因 var cc = cc = cc || {}; 在 Cocos2D JavaScript 库中,例如 this地方,但我找不到任何合理的理由。就设置默认值而言,单一赋值是
我的 make 文件中有这些行: ifeq ($(SYSTEM),SOLARIS) # SUN Solaris 8 no c99 ifeq ($(OSVER),510)
服务器详细信息 MySQL 5.6.22 256GB 内存 4TB 固态硬盘 32 核 背景信息 有一个删除进程,每秒大约执行 3 次删除。每秒 2-3k QPS。主要是 SELECT。没有长时间运行
我正在 Spring 的帮助下发送邮件,其中我想要 CC 中的多个电子邮件 ID,所有人都会收到邮件,但问题是当他们在rackspace(apps.rackspace.com)中打开电子邮件时,它只显
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
我有一个生成文件。当我在 Unix 上运行它时,我得到这个错误: cc -I/opt/oracle/product/9.2.0/rdbms/demo -I/opt/oracle/product/9.2
直观的逻辑,具有 build 性,是函数式编程中类型系统的基础。经典逻辑不是 build 性的,尤其是排中律 A ∨ ¬A(或其等价物,例如 double negation elimination 或
我必须使用我之前创建的列表文件在 C++ 中编写一个队列,并且我很难编译所有内容。 我目前遇到的问题是,当我编译时出现错误: Queue.h:7:2: 错误:'List' 没有命名类型 如何正确连接队
使用支持延续的语言,例如Scheme、Ruby 和 Haskell,假设有一个函数 cc' 不带参数并返回当前延续,以便通过调用 cc' 获得延续的调用者然后可以随心所欲地在任何地方调用延续。 cc'
我有一个 InDesign 文档,其中包含不同宽度尺寸的页面。现在我想用 JS 脚本添加垂直指南。因此我必须添加 pageWidth + pageWidth (特定页面的)。 但我只知道如何获取文档尺
像这样,我有一个对象: { 'person': { 'like': { 'color': 'red', 'food': 'rice' }, 'nam
我知道我可以用: string input = "AA,BB,CC"; string output = ""; foreach (var item in
我正在尝试使用我使用 Label-img 标记的样本来训练对象检测算法。我的图像尺寸为 1100 x 1100 像素。我使用的算法是在 TensorFlow 2 Detection Model Zoo
我正在尝试学习 C,并且刚刚开始阅读“艰难地学习 C”这本书。在第二课中,作者提到了 Makefiles,并指出当使用命令“make example.c”时,“make”会自动调用 cc 来构建 .c
在我的主要方法的一开始,我就有了 main(int argc, char *argv[]){ if(argc!=2){ printf("not enough arguments"); ex
因此,我有一个 c 模块,其中我修改了两件事:向函数添加了一个参数,向结构体添加了一个参数。 问题是,当使用 cc 进行编译时(从我继承的脚本),无论我的更改在哪里,我都会收到错误消息(抱歉,如果翻译
我浪费了很多时间来弄清楚为什么一种算法应该比另一种算法更有效,然而,就速度而言,另一种算法却完全相同。我做了这些操作:我在一个单独的终端窗口中编译了第一个源代码;而第二个源代码在另一个窗口中。我只是用
多次按 Tab 不会将文本向右移动。有没有办法让它表现得像 Visual Studio 的智能缩进?第一个制表符缩进,随后的制表符将文本移动到下一个制表位。谢谢你。 最佳答案 像这样的东西? (def
如果我使用 C 编译器 cc,则命令行完成不起作用。如果我输入 cc dig + press tab 那么什么都不会发生,但是如果我用 cc digenv.c 编译程序,那么它就可以工作。为什么 cc
有人对它的工作原理有很好的指导吗?带有视觉辅助的东西会很好,我遇到的每个指南似乎都在说我需要重新尝试的同一件事。 最佳答案 这是留在CS实验室白板上的图。因此,您将要获取一些苹果,然后在开始操作之前先
我是一名优秀的程序员,十分优秀!