我只是想创建一个非常简单的片段着色器,它为网格绘制指定的纹理.我查看了一些自定义片段着色器,它们完成了相同的操作并构建了自己的着色器并支持它周围的JS代码.但是,它只是不起作用.这是我正在尝试运行的代码的工作抽象:
顶点着色器
<script id="vertexShader" type="x-shader/x-vertex">
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix *
modelViewMatrix *
vec4(position,1.0);
}
</script>
Run Code Online (Sandbox Code Playgroud)
片段着色器
<script id="fragmentShader" type="x-shader/x-fragment">
uniform sampler2D texture1;
varying vec2 vUv;
void main() {
gl_FragColor = texture2D(texture1, vUv); // Displays Nothing
//gl_FragColor = vec4(0.5, 0.2, 1.0, 1.0); // Works; Displays Flat Color
}
</script>
Run Code Online (Sandbox Code Playgroud)
场景代码
<script>
// Initialize WebGL Renderer
var renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
var canvas = document.getElementById('canvas').appendChild(renderer.domElement);
// Initialize Scenes
var scene = new …
Run Code Online (Sandbox Code Playgroud) 我理解Promise存在于以下三种状态之一:Promise可以是待处理(未解析),履行(成功解决)或拒绝(解决失败).
阅读A + Promise Spec和MDN的文档,我很困惑他们都承认已完成和被拒绝的状态,但在Promise构造函数的定义中,他们指定了两个回调:resolve和reject.我们似乎可以互换地使用这两个术语; 他们不是.
并不意味着成功:
re·solve /r??zälv/ verb
1. settle or find a solution to (a problem, dispute, or contentious matter).
Run Code Online (Sandbox Code Playgroud)
是否意味着成功:
ful·fill /fo?ol?fil/ verb
1. bring to completion or reality; achieve or realize (something desired, promised, or predicted).
2. carry out (a task, duty, or role) as required, pledged, or expected.
Run Code Online (Sandbox Code Playgroud)
当我们真正实现承诺时,为什么我们在这里使用决心?有没有在其中的价值,我们通过一个实例解决可能会导致无极是拒绝 …
我已经在我的项目中得到了一个点,我正在渲染WebGLRenderTargets并将它们用作主场景中的纹理.它有效,但似乎我要做的工作比它需要的要多得多.我生成的纹理只需要64x64,但由于我正在使用我的主渲染器(窗口宽度乘窗口高度),因此不必要地以更大的分辨率渲染WebGLRenderTargets.
我可能错了,但我相信这会增加绘制到每个RenderTarget所需的处理以及然后将大纹理绘制到网格所需的处理.
我尝试过使用第二个渲染器,但是在渲染器B中绘制到渲染器后尝试使用WebGLRenderTarget时,我似乎遇到了这个错误:
WebGL: INVALID_OPERATION: bindTexture: object not from this context
作为参考,你可以在这里看到我的抽象页面(警告:由于我正在询问的问题,这个页面可能会滞后于你).我正在我的辅助场景中的平面上运行单面函数,并使用相机放置将其切割成多个部分,然后通过WebGLRenderTarget将这些片段应用到平铺片段,以便它们能够流畅但个性化.
我是否正确地假设使用相同的渲染器大小比渲染较小的渲染器效率低得多?如果是这样,您认为最佳解决方案是什么?目前有没有办法实现这种优化?
我目前正在Three.js中创建一个3D平铺六角板.出于艺术和功能的原因,每个图块都是它们自己的网格,由一个基本(不变)几何体组成,其材质中有一个生成的地图数组:Displacement,Diffuse,Normal.
当我添加更多纹理贴图时,我开始注意到FPS的减少,这促使我查看源代码.我有一个15x15的游戏板,这意味着每帧渲染225个单独的网格.当时每个网格由于设计不佳而由215个面组成,导致场景中有48,375个面.
认为它可以解决性能问题,我重新设计了网格只包含30个面孔,整个场景共有6,750个面孔; 惊人的改进.我很失望地发现,面部减少86%对性能几乎没有影响.
所以,我决定找到导致性能下降的确切原因.我设置了一个抽象的测试环境,并使用了一个3x10的平面网格(给它们30个面,就像我自己的模型一样).我尝试了不同的网格尺寸(网格数)和应用不同复杂度的材料.这是我发现的:
// /---------------------------------------------------\
// | Material | 15x15 | 20x20 | 25x25 |
// |---------------------|---------|---------|---------|------\
// | Flat Lambert Color | 60FPS | 48FPS | 30FPS | -00% |
// | Lambert Diffuse | 57FPS | 41FPS | 27FPS | -10% |
// | Blank Shader | 51FPS | 37FPS | 24FPS | -20% |
// | Full Shader (-H) | 49FPS | 32FPS | 21FPS | -30% |
// | Full Shader (+H) …
Run Code Online (Sandbox Code Playgroud) 我一直在尝试让Checkstyle在Eclipse Indigo IDE中使用Maven工作一段时间.最后,我想我会就此问一些专家建议.
我正在使用Eclipse Indigo并尝试将Checkstyle配置为在Maven中运行.
下面是我的pom.xml的片段.只有checkstyle:checkstyle
工作和创建报告.
<profile>
<id>checkstyle-profile</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<configLocation>${basedir}/src/main/resources/maven_checks.xml</configLocation>
</configuration>
<executions>
<execution>
<id>checkstyle-check</id>
<goals>
<goal>check</goal>
</goals>
<phase>compile</phase> <!-- Default is "verify" -->
<configuration>
<violationSeverity>error</violationSeverity>
<maxAllowedViolations>7000</maxAllowedViolations>
<failOnViolation>true</failOnViolation>
<failsOnError>true</failsOnError>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<configLocation>${basedir}/src/main/resources/maven_checks.xml</configLocation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
</plugin>
</plugins>
</reporting>
Run Code Online (Sandbox Code Playgroud)
一些不起作用的事情是:
checkstlye:check
.我得到以下错误.我应该运行什么目标才能checkstyle:check
运行.无法org.apache.maven.plugins:maven-checkstyle-plugin:2.9.1:check
在项目zzz-web上执行目标(default-cli):您有5950个Checkstyle违规希望快速回应.
提前致谢.瓦尔马
例如,我有一个表Person
,每个条目都有一个ID,我有一个表PersonEvent
,记录personID
每个人在一个事件.
如果PersonEvent
事件中不包含任何行,则Person
表中的每个人都会参加.但是,如果表中有条目,则PersonEvent
只有那些人参加了此活动.
我想做一个查询,例如:
SELECT *
FROM Person p
WHERE ((SELECT COUNT(*)
FROM PersonEvent pe
WHERE pe.personID = p.ID
AND pe.eventID = '290') = 0
OR EXISTS
(SELECT *
FROM PersonEvent pe
WHERE pe.personID = p.ID
AND pe.eventID = '290'))
Run Code Online (Sandbox Code Playgroud)
我该怎么做呢?
three.js ×3
webgl ×2
checkstyle ×1
exists ×1
javascript ×1
join ×1
maven ×1
optimization ×1
promise ×1
render ×1
renderer ×1
shader ×1
sql ×1
textures ×1