本文整理了Java中org.lwjglb.engine.graph.Transformation.buildModelLightViewMatrix()
方法的一些代码示例,展示了Transformation.buildModelLightViewMatrix()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transformation.buildModelLightViewMatrix()
方法的具体详情如下:
包路径:org.lwjglb.engine.graph.Transformation
类名称:Transformation
方法名:buildModelLightViewMatrix
暂无
代码示例来源:origin: lwjglgamedev/lwjglbook
private void renderChunkInstanced(List<GameItem> gameItems, boolean depthMap, Transformation transformation, Matrix4f viewMatrix, Matrix4f lightViewMatrix) {
this.modelViewBuffer.clear();
this.modelLightViewBuffer.clear();
int i = 0;
for (GameItem gameItem : gameItems) {
Matrix4f modelMatrix = transformation.buildModelMatrix(gameItem);
if (!depthMap) {
Matrix4f modelViewMatrix = transformation.buildModelViewMatrix(modelMatrix, viewMatrix);
modelViewMatrix.get(MATRIX_SIZE_FLOATS * i, modelViewBuffer);
}
Matrix4f modelLightViewMatrix = transformation.buildModelLightViewMatrix(modelMatrix, lightViewMatrix);
modelLightViewMatrix.get(MATRIX_SIZE_FLOATS * i, this.modelLightViewBuffer);
i++;
}
glBindBuffer(GL_ARRAY_BUFFER, modelViewVBO);
glBufferData(GL_ARRAY_BUFFER, modelViewBuffer, GL_DYNAMIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, modelLightViewVBO);
glBufferData(GL_ARRAY_BUFFER, modelLightViewBuffer, GL_DYNAMIC_DRAW);
glDrawElementsInstanced(
GL_TRIANGLES, getVertexCount(), GL_UNSIGNED_INT, 0, gameItems.size());
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
}
代码示例来源:origin: lwjglgamedev/lwjglbook
private void renderNonInstancedMeshes(Scene scene, boolean depthMap, ShaderProgram shader, Matrix4f viewMatrix, Matrix4f lightViewMatrix) {
sceneShaderProgram.setUniform("isInstanced", 0);
// Render each mesh with the associated game Items
Map<Mesh, List<GameItem>> mapMeshes = scene.getGameMeshes();
for (Mesh mesh : mapMeshes.keySet()) {
if (!depthMap) {
shader.setUniform("material", mesh.getMaterial());
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, shadowMap.getDepthMapTexture().getId());
}
mesh.renderList(mapMeshes.get(mesh), (GameItem gameItem) -> {
Matrix4f modelMatrix = transformation.buildModelMatrix(gameItem);
if (!depthMap) {
Matrix4f modelViewMatrix = transformation.buildModelViewMatrix(modelMatrix, viewMatrix);
sceneShaderProgram.setUniform("modelViewNonInstancedMatrix", modelViewMatrix);
}
Matrix4f modelLightViewMatrix = transformation.buildModelLightViewMatrix(modelMatrix, lightViewMatrix);
sceneShaderProgram.setUniform("modelLightViewNonInstancedMatrix", modelLightViewMatrix);
if (gameItem instanceof AnimGameItem) {
AnimGameItem animGameItem = (AnimGameItem) gameItem;
AnimatedFrame frame = animGameItem.getCurrentFrame();
shader.setUniform("jointsMatrix", frame.getJointMatrices());
}
}
);
}
}
代码示例来源:origin: lwjglgamedev/lwjglbook
Matrix4f modelLightViewMatrix = transformation.buildModelLightViewMatrix(modelMatrix, lightViewMatrix);
modelLightViewMatrix.get(INSTANCE_SIZE_FLOATS * i + MATRIX_SIZE_FLOATS, this.instanceDataBuffer);
代码示例来源:origin: lwjglgamedev/lwjglbook
Matrix4f modelLightViewMatrix = transformation.buildModelLightViewMatrix(modelMatrix, lightViewMatrix);
modelLightViewMatrix.get(INSTANCE_SIZE_FLOATS * i + MATRIX_SIZE_FLOATS, this.instanceDataBuffer);
代码示例来源:origin: lwjglgamedev/lwjglbook
Matrix4f modelLightViewMatrix = transformation.buildModelLightViewMatrix(modelMatrix, lightViewMatrix);
modelLightViewMatrix.get(INSTANCE_SIZE_FLOATS * i + MATRIX_SIZE_FLOATS, this.instanceDataBuffer);
代码示例来源:origin: lwjglgamedev/lwjglbook
Matrix4f modelLightViewMatrix = transformation.buildModelLightViewMatrix(modelMatrix, lightViewMatrix);
modelLightViewMatrix.get(INSTANCE_SIZE_FLOATS * i + MATRIX_SIZE_FLOATS, this.instanceDataBuffer);
代码示例来源:origin: lwjglgamedev/lwjglbook
sceneShaderProgram.setUniform("modelViewNonInstancedMatrix", modelViewMatrix);
Matrix4f modelLightViewMatrix = transformation.buildModelLightViewMatrix(modelMatrix, lightViewMatrix);
sceneShaderProgram.setUniform("modelLightViewNonInstancedMatrix", modelLightViewMatrix);
代码示例来源:origin: lwjglgamedev/lwjglbook
sceneShaderProgram.setUniform("modelViewNonInstancedMatrix", modelViewMatrix);
Matrix4f modelLightViewMatrix = transformation.buildModelLightViewMatrix(modelMatrix, lightViewMatrix);
sceneShaderProgram.setUniform("modelLightViewNonInstancedMatrix", modelLightViewMatrix);
代码示例来源:origin: lwjglgamedev/lwjglbook
sceneShaderProgram.setUniform("modelViewNonInstancedMatrix", modelViewMatrix);
Matrix4f modelLightViewMatrix = transformation.buildModelLightViewMatrix(modelMatrix, lightViewMatrix);
sceneShaderProgram.setUniform("modelLightViewNonInstancedMatrix", modelLightViewMatrix);
代码示例来源:origin: lwjglgamedev/lwjglbook
sceneShaderProgram.setUniform("modelViewNonInstancedMatrix", modelViewMatrix);
Matrix4f modelLightViewMatrix = transformation.buildModelLightViewMatrix(modelMatrix, lightViewMatrix);
sceneShaderProgram.setUniform("modelLightViewNonInstancedMatrix", modelLightViewMatrix);
代码示例来源:origin: lwjglgamedev/lwjglbook
sceneShaderProgram.setUniform("modelViewNonInstancedMatrix", modelViewMatrix);
Matrix4f modelLightViewMatrix = transformation.buildModelLightViewMatrix(modelMatrix, lightViewMatrix);
sceneShaderProgram.setUniform("modelLightViewNonInstancedMatrix", modelLightViewMatrix);
代码示例来源:origin: lwjglgamedev/lwjglbook
sceneShaderProgram.setUniform("modelViewNonInstancedMatrix", modelViewMatrix);
Matrix4f modelLightViewMatrix = transformation.buildModelLightViewMatrix(modelMatrix, lightViewMatrix);
sceneShaderProgram.setUniform("modelLightViewNonInstancedMatrix", modelLightViewMatrix);
代码示例来源:origin: lwjglgamedev/lwjglbook
public void renderScene(Window window, Camera camera, Scene scene) {
sceneShaderProgram.bind();
Matrix4f projectionMatrix = transformation.getProjectionMatrix();
sceneShaderProgram.setUniform("projectionMatrix", projectionMatrix);
Matrix4f orthoProjMatrix = transformation.getOrthoProjectionMatrix();
sceneShaderProgram.setUniform("orthoProjectionMatrix", orthoProjMatrix);
Matrix4f lightViewMatrix = transformation.getLightViewMatrix();
Matrix4f viewMatrix = transformation.getViewMatrix();
SceneLight sceneLight = scene.getSceneLight();
renderLights(viewMatrix, sceneLight);
sceneShaderProgram.setUniform("fog", scene.getFog());
sceneShaderProgram.setUniform("texture_sampler", 0);
sceneShaderProgram.setUniform("normalMap", 1);
sceneShaderProgram.setUniform("shadowMap", 2);
// Render each mesh with the associated game Items
Map<Mesh, List<GameItem>> mapMeshes = scene.getGameMeshes();
for (Mesh mesh : mapMeshes.keySet()) {
sceneShaderProgram.setUniform("material", mesh.getMaterial());
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, shadowMap.getDepthMapTexture().getId());
mesh.renderList(mapMeshes.get(mesh), (GameItem gameItem) -> {
Matrix4f modelViewMatrix = transformation.buildModelViewMatrix(gameItem, viewMatrix);
sceneShaderProgram.setUniform("modelViewMatrix", modelViewMatrix);
Matrix4f modelLightViewMatrix = transformation.buildModelLightViewMatrix(gameItem, lightViewMatrix);
sceneShaderProgram.setUniform("modelLightViewMatrix", modelLightViewMatrix);
}
);
}
sceneShaderProgram.unbind();
}
代码示例来源:origin: lwjglgamedev/lwjglbook
sceneShaderProgram.setUniform("modelViewNonInstancedMatrix", modelViewMatrix);
Matrix4f modelLightViewMatrix = transformation.buildModelLightViewMatrix(modelMatrix, lightViewMatrix);
sceneShaderProgram.setUniform("modelLightViewNonInstancedMatrix", modelLightViewMatrix);
代码示例来源:origin: lwjglgamedev/lwjglbook
sceneShaderProgram.setUniform("modelViewNonInstancedMatrix", modelViewMatrix);
Matrix4f modelLightViewMatrix = transformation.buildModelLightViewMatrix(modelMatrix, lightViewMatrix);
sceneShaderProgram.setUniform("modelLightViewNonInstancedMatrix", modelLightViewMatrix);
代码示例来源:origin: lwjglgamedev/lwjglbook
public void renderScene(Window window, Camera camera, Scene scene) {
sceneShaderProgram.bind();
Matrix4f projectionMatrix = transformation.getProjectionMatrix();
sceneShaderProgram.setUniform("projectionMatrix", projectionMatrix);
Matrix4f orthoProjMatrix = transformation.getOrthoProjectionMatrix();
sceneShaderProgram.setUniform("orthoProjectionMatrix", orthoProjMatrix);
Matrix4f lightViewMatrix = transformation.getLightViewMatrix();
Matrix4f viewMatrix = transformation.getViewMatrix();
SceneLight sceneLight = scene.getSceneLight();
renderLights(viewMatrix, sceneLight);
sceneShaderProgram.setUniform("fog", scene.getFog());
sceneShaderProgram.setUniform("texture_sampler", 0);
sceneShaderProgram.setUniform("normalMap", 1);
sceneShaderProgram.setUniform("shadowMap", 2);
// Render each mesh with the associated game Items
Map<Mesh, List<GameItem>> mapMeshes = scene.getGameMeshes();
for (Mesh mesh : mapMeshes.keySet()) {
sceneShaderProgram.setUniform("material", mesh.getMaterial());
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, shadowMap.getDepthMapTexture().getId());
mesh.renderList(mapMeshes.get(mesh), (GameItem gameItem) -> {
Matrix4f modelViewMatrix = transformation.buildModelViewMatrix(gameItem, viewMatrix);
sceneShaderProgram.setUniform("modelViewMatrix", modelViewMatrix);
Matrix4f modelLightViewMatrix = transformation.buildModelLightViewMatrix(gameItem, lightViewMatrix);
sceneShaderProgram.setUniform("modelLightViewMatrix", modelLightViewMatrix);
}
);
}
sceneShaderProgram.unbind();
}
代码示例来源:origin: lwjglgamedev/lwjglbook
public void renderScene(Window window, Camera camera, Scene scene) {
sceneShaderProgram.bind();
Matrix4f projectionMatrix = transformation.getProjectionMatrix();
sceneShaderProgram.setUniform("projectionMatrix", projectionMatrix);
Matrix4f orthoProjMatrix = transformation.getOrthoProjectionMatrix();
sceneShaderProgram.setUniform("orthoProjectionMatrix", orthoProjMatrix);
Matrix4f lightViewMatrix = transformation.getLightViewMatrix();
Matrix4f viewMatrix = transformation.getViewMatrix();
SceneLight sceneLight = scene.getSceneLight();
renderLights(viewMatrix, sceneLight);
sceneShaderProgram.setUniform("fog", scene.getFog());
sceneShaderProgram.setUniform("texture_sampler", 0);
sceneShaderProgram.setUniform("normalMap", 1);
sceneShaderProgram.setUniform("shadowMap", 2);
// Render each mesh with the associated game Items
Map<Mesh, List<GameItem>> mapMeshes = scene.getGameMeshes();
for (Mesh mesh : mapMeshes.keySet()) {
sceneShaderProgram.setUniform("material", mesh.getMaterial());
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, shadowMap.getDepthMapTexture().getId());
mesh.renderList(mapMeshes.get(mesh), (GameItem gameItem) -> {
Matrix4f modelViewMatrix = transformation.buildModelViewMatrix(gameItem, viewMatrix);
sceneShaderProgram.setUniform("modelViewMatrix", modelViewMatrix);
Matrix4f modelLightViewMatrix = transformation.buildModelLightViewMatrix(gameItem, lightViewMatrix);
sceneShaderProgram.setUniform("modelLightViewMatrix", modelLightViewMatrix);
}
);
}
sceneShaderProgram.unbind();
}
代码示例来源:origin: lwjglgamedev/lwjglbook
Matrix4f modelLightViewMatrix = transformation.buildModelLightViewMatrix(gameItem, lightViewMatrix);
sceneShaderProgram.setUniform("modelLightViewMatrix", modelLightViewMatrix);
代码示例来源:origin: lwjglgamedev/lwjglbook
Matrix4f modelLightViewMatrix = transformation.buildModelLightViewMatrix(gameItem, lightViewMatrix);
sceneShaderProgram.setUniform("modelLightViewMatrix", modelLightViewMatrix);
代码示例来源:origin: lwjglgamedev/lwjglbook
Matrix4f modelLightViewMatrix = transformation.buildModelLightViewMatrix(gameItem, lightViewMatrix);
sceneShaderProgram.setUniform("modelLightViewMatrix", modelLightViewMatrix);
内容来源于网络,如有侵权,请联系作者删除!