- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我现在可以正常加载 ascii ply 文件,但它有一个纹理,无论我如何配置,我似乎都无法加载它。
cameraMain = new THREE.Camera(8, MainWidth / MainHeight, 1, 10000);
sceneMain = new THREE.Scene();
ambientLightMain = new THREE.AmbientLight(0x202020);
directionalLightMainRight = new THREE.DirectionalLight(0xffffff, 0.5);
directionalLightMainLeft = new THREE.DirectionalLight(0xffffff, 0.5);
pointLightMain = new THREE.PointLight(0xffffff, 0.3);
directionalLightMainRight.position.x = dlpx;
directionalLightMainRight.position.y = dlpy;
directionalLightMainRight.position.z = dlpz;
directionalLightMainRight.position.normalize();
directionalLightMainLeft.position.x = -dlpx;
directionalLightMainLeft.position.y = dlpy;
directionalLightMainLeft.position.z = dlpz;
directionalLightMainLeft.position.normalize();
pointLightMain.position.x = plpx;
pointLightMain.position.y = plpy;
pointLightMain.position.z = plpz;
sceneMain.addLight(ambientLightMain);
sceneMain.addLight(directionalLightMainRight);
sceneMain.addLight(directionalLightMainLeft);
sceneMain.addLight(pointLightMain);
rendererMain = new THREE.WebGLRenderer();
texture = THREE.ImageUtils.loadTexture('3D/'+ mainURL +'.jpg', {}, function() {
rendererMain.render(sceneMain);
});
rendererMain.domElement.style.backgroundColor = backgroundColor;
rendererMain.setSize(MainWidth, MainHeight);
rendererMain.domElement.addEventListener('DOMMouseScroll', onRendererMainScroll, false);
rendererMain.domElement.addEventListener('mousewheel', onRendererMainScroll, false);
rendererMain.domElement.addEventListener('dblclick', onRendererMainDblClick, false);
rendererMain.domElement.addEventListener('mousedown', onRendererMainMouseDown, false);
$("#viewerMain").append(rendererMain.domElement);
window.addEventListener('mousemove', onMouseMove, false);
window.addEventListener('mouseup', onMouseUp, false);
那段代码初始化了模型。其中一些不需要用于提问目的,它有用于缩放、旋转等的代码。我知道还有另一行,我已将其注释掉,但出于某种原因它不会在此处显示,所以我将单独进行。
material = new THREE.MeshBasicMaterial({map: texture});
该行在 loadTexture 代码之后。
剩下的部分用loadPly函数加载
var geometryMain = new THREE.Geometry();
for (i in event.data.content[0])
geometryMain.vertices.push(new THREE.Vertex(new THREE.Vector3(event.data.content[0][i][0], event.data.content[0][i][1], event.data.content[0][i][2])));
for (i in event.data.content[1])
geometryMain.faces.push(new THREE.Face3(event.data.content[1][i][0], event.data.content[1][i][1], event.data.content[1][i][2]));
geometryMain.computeCentroids();
geometryMain.computeFaceNormals();
mainModel = new THREE.Mesh(geometryMain, new THREE.MeshLambertMaterial({color:0xffffff, shading:THREE.FlatShading}));
sceneMain.addObject(mainModel);
mainModel.overdraw = true;
mainModel.doubleSided = true;
我尝试调整 THREE.mesh() 部分以包含 Material ,但它破坏了一切。我尝试过将 map:material 添加到 MeshLambertMaterial,同样不行。任何人有任何见解?抱歉,如果这太复杂了,但我还远远不够了解这一点以提高效率。
如果我添加
map:THREE.ImageUtils.loadTexture('3D/'+ mainURL +'.jpg')
到 THREE.Mesh() 行,我得到
.WebGLRenderingContext: GL ERROR :GL_INVALID_OPERATION : glDrawElements: attempt to access out of range vertices in attribute 2
最佳答案
为了在对象上显示纹理,需要纹理坐标。您似乎只向几何体添加顶点和面。查看THREE.PLYLoader
来源,它似乎不支持加载纹理坐标。 (虽然我不确定你是否使用那个加载器,因为它应该已经返回一个准备好的 Geometry
实例,而不是要求你手动构造数组)
关于javascript - 使用 Three.js 和 PLY 文件的纹理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16109774/
在 ms sql 2008 中编写一些存储过程时,当我输入一些变量名称时,我注意到 PLI 被突出显示为关键字。 有谁知道 PLI 的用途是什么? 最佳答案 您可以在 MSDN 上查看此类信息: 请参
我想使用 plyr 的并行功能函数内封装。 我原以为导出在函数体内创建的对象的正确方法(在本例中,对象是 df_2 )如下 # rm(list=ls()) library(plyr) library(
我是 3D 重建的新手,我有点云。我把它写在 .ply 文件上。但是当我按下它文件时 Meshlab 为我提供了一个 Error 。请找到以下内容,meshlab 可以允许打开该文件 Unespec
我正在使用一个简单的 .txt 文件测试层,其中包含:value = 0.4。解析器按预期工作,但是当我向该文件添加第二行时,出现错误: 错误:解析“LexToken(VALUE_KEY,'value
全部, 我正在用 python PLY 编写一个非常简单的解析器。它大部分完成了这项工作,但对于许多输入行,我从yacc收到语法错误。这是词法分析器和解析器代码,稍作修改以方便测试: tokens =
有没有办法对层词法分析器规则进行特殊处理? t_IDENT = r'[a-zA-Z_][0-9a-zA-Z_]*' t_OPERATOR = r'[<>=/*+-]+' t_DEFINE
我正在 python 中使用 PLY 构建解析器,当我运行解析器时,它会创建 3 个文件:parsetab.py、lextam.py 和 parse.out 如何才能不创建这些文件?有一个参数可以做到
我试图四处寻找这个问题的答案,但似乎找不到。我正在尝试使用 PLY 在 Python 中编写一个解析器作为一种编造的语言。我的 BNF 的简化版本如下所示: statement-list -> sta
我正在使用 Python 和 PLY 来解析类似 LISP 的 S 表达式,并且在解析函数调用时可以有零个或多个参数。我怎样才能将它放入 yacc 代码中。到目前为止,这是我的功能: def p_EX
所以我在 Ply 上编写了一个语法来识别基本的 C 语句,例如变量声明或 while 语句。现在,我想要做的是能够连接所有标记,然后打印它或让它在树上传播,如下所示: def p_whileStm
我正在尝试创建一个将我的脚本作为输入的解释器。我在编写正则表达式时遇到了一些问题。定义的标记之一是将所有字符串视为标记。 import ply.lex as lex import ply.yacc a
我想使用Python的PLY分析大量文本,其大小可能达到 1GB。 是否可以让 PLY 读取文本并将其解析为流,这样我就不必将整个内容加载到内存中?我想逐行检查文本,并让 PLY 对其进行分析。那可能
我正在尝试使用PLY lex / yacc解析PDF,而我却遇到了有关yacc解析规则的问题,该规则控制NUMBER标记,数组和indirect_references。 相关资料来源: def p_v
简而言之,我们如何区分使用了哪个规则 - 例子:- ''' p : a b | c | d '''所以假设我们需要为不同的规则编写不同的代码。那么有什么优雅的方法可以做到这一点。手册中给出的一种方法是
我在 PLY 中使用一个相当简单的解析器,我的规则之一采用以下形式: def p_things(p): ''' things : thing things things : t
我正在尝试构建一个 .PLY 解析器,以将存储为 .ply 文件的 3d 模型加载到半边数据结构网格中。 抱歉问了这么大的问题,我很冗长,我想确保我列出了所有的细节。因此,我将立即重申我的最终目标,以
我正在进入 .ply 文件的世界。我已经阅读了一些关于它们的内容,但是关于它们的格式的文档似乎与我的文件中的内容不太一致。我一直在尝试理解这篇文章 here,但我运气不佳。 这是我的 .ply 文件的
出于某种目的,我需要读取带有嵌入纹理的 PLY 文件(斯坦福三角格式)。我看到了 PLY 文件的几个规范,但找不到指定纹理映射语法的单个来源。似乎有很多库可以读取 PLY 文件,但大多数库似乎不支持纹
我使用 ply 作为我的 lex 解析器。我的规范如下: t_WHILE = r'while' t_THEN = r'then' t_ID = r'[a-zA-Z_][a-zA-Z0-9_]*'
我使用 ply 解析数据.我尝试使用空格作为词素的一部分。这里有一个简化的例子: from ply.lex import lex from ply.yacc import yacc tokens =
我是一名优秀的程序员,十分优秀!