本文整理了Java中org.lwjglb.engine.graph.Transformation.getModelViewMatrix()
方法的一些代码示例,展示了Transformation.getModelViewMatrix()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transformation.getModelViewMatrix()
方法的具体详情如下:
包路径:org.lwjglb.engine.graph.Transformation
类名称:Transformation
方法名:getModelViewMatrix
暂无
代码示例来源:origin: lwjglgamedev/lwjglbook
public void renderScene(Window window, Camera camera, GameItem[] gameItems,
SceneLight sceneLight) {
sceneShaderProgram.bind();
// Update projection Matrix
Matrix4f projectionMatrix = transformation.getProjectionMatrix(FOV, window.getWidth(), window.getHeight(), Z_NEAR, Z_FAR);
sceneShaderProgram.setUniform("projectionMatrix", projectionMatrix);
// Update view Matrix
Matrix4f viewMatrix = transformation.getViewMatrix(camera);
renderLights(viewMatrix, sceneLight);
sceneShaderProgram.setUniform("texture_sampler", 0);
// Render each gameItem
for (GameItem gameItem : gameItems) {
Mesh mesh = gameItem.getMesh();
// Set model view matrix for this item
Matrix4f modelViewMatrix = transformation.getModelViewMatrix(gameItem, viewMatrix);
sceneShaderProgram.setUniform("modelViewMatrix", modelViewMatrix);
// Render the mesh for this game item
sceneShaderProgram.setUniform("material", mesh.getMaterial());
mesh.render();
}
sceneShaderProgram.unbind();
}
代码示例来源:origin: lwjglgamedev/lwjglbook
public void renderScene(Window window, Camera camera, GameItem[] gameItems,
SceneLight sceneLight) {
sceneShaderProgram.bind();
// Update projection Matrix
Matrix4f projectionMatrix = transformation.getProjectionMatrix(FOV, window.getWidth(), window.getHeight(), Z_NEAR, Z_FAR);
sceneShaderProgram.setUniform("projectionMatrix", projectionMatrix);
// Update view Matrix
Matrix4f viewMatrix = transformation.getViewMatrix(camera);
renderLights(viewMatrix, sceneLight);
sceneShaderProgram.setUniform("texture_sampler", 0);
// Render each gameItem
for (GameItem gameItem : gameItems) {
Mesh mesh = gameItem.getMesh();
// Set model view matrix for this item
Matrix4f modelViewMatrix = transformation.getModelViewMatrix(gameItem, viewMatrix);
sceneShaderProgram.setUniform("modelViewMatrix", modelViewMatrix);
// Render the mesh for this game item
sceneShaderProgram.setUniform("material", mesh.getMaterial());
mesh.render();
}
sceneShaderProgram.unbind();
}
代码示例来源:origin: lwjglgamedev/lwjglbook
public void renderScene(Window window, Camera camera, GameItem[] gameItems,
SceneLight sceneLight) {
sceneShaderProgram.bind();
// Update projection Matrix
Matrix4f projectionMatrix = transformation.getProjectionMatrix(FOV, window.getWidth(), window.getHeight(), Z_NEAR, Z_FAR);
sceneShaderProgram.setUniform("projectionMatrix", projectionMatrix);
// Update view Matrix
Matrix4f viewMatrix = transformation.getViewMatrix(camera);
renderLights(viewMatrix, sceneLight);
sceneShaderProgram.setUniform("texture_sampler", 0);
// Render each gameItem
for (GameItem gameItem : gameItems) {
Mesh mesh = gameItem.getMesh();
// Set model view matrix for this item
Matrix4f modelViewMatrix = transformation.getModelViewMatrix(gameItem, viewMatrix);
sceneShaderProgram.setUniform("modelViewMatrix", modelViewMatrix);
// Render the mesh for this game item
sceneShaderProgram.setUniform("material", mesh.getMaterial());
mesh.render();
}
sceneShaderProgram.unbind();
}
代码示例来源:origin: lwjglgamedev/lwjglbook
private void renderSkyBox(Window window, Camera camera, Scene scene) {
skyBoxShaderProgram.bind();
skyBoxShaderProgram.setUniform("texture_sampler", 0);
// Update projection Matrix
Matrix4f projectionMatrix = transformation.getProjectionMatrix(FOV, window.getWidth(), window.getHeight(), Z_NEAR, Z_FAR);
skyBoxShaderProgram.setUniform("projectionMatrix", projectionMatrix);
SkyBox skyBox = scene.getSkyBox();
Matrix4f viewMatrix = transformation.getViewMatrix(camera);
viewMatrix.m30(0);
viewMatrix.m31(0);
viewMatrix.m32(0);
Matrix4f modelViewMatrix = transformation.getModelViewMatrix(skyBox, viewMatrix);
skyBoxShaderProgram.setUniform("modelViewMatrix", modelViewMatrix);
skyBoxShaderProgram.setUniform("ambientLight", scene.getSceneLight().getAmbientLight());
scene.getSkyBox().getMesh().render();
skyBoxShaderProgram.unbind();
}
代码示例来源:origin: lwjglgamedev/lwjglbook
public void render(Window window, Camera camera, GameItem[] gameItems) {
clear();
if ( window.isResized() ) {
glViewport(0, 0, window.getWidth(), window.getHeight());
window.setResized(false);
}
shaderProgram.bind();
// Update projection Matrix
Matrix4f projectionMatrix = transformation.getProjectionMatrix(FOV, window.getWidth(), window.getHeight(), Z_NEAR, Z_FAR);
shaderProgram.setUniform("projectionMatrix", projectionMatrix);
// Update view Matrix
Matrix4f viewMatrix = transformation.getViewMatrix(camera);
shaderProgram.setUniform("texture_sampler", 0);
// Render each gameItem
for(GameItem gameItem : gameItems) {
// Set model view matrix for this item
Matrix4f modelViewMatrix = transformation.getModelViewMatrix(gameItem, viewMatrix);
shaderProgram.setUniform("modelViewMatrix", modelViewMatrix);
// Render the mes for this game item
gameItem.getMesh().render();
}
shaderProgram.unbind();
}
代码示例来源:origin: lwjglgamedev/lwjglbook
public void renderScene(Window window, Camera camera, Scene scene) {
sceneShaderProgram.bind();
// Update projection Matrix
Matrix4f projectionMatrix = transformation.getProjectionMatrix(FOV, window.getWidth(), window.getHeight(), Z_NEAR, Z_FAR);
sceneShaderProgram.setUniform("projectionMatrix", projectionMatrix);
// Update view Matrix
Matrix4f viewMatrix = transformation.getViewMatrix(camera);
SceneLight sceneLight = scene.getSceneLight();
renderLights(viewMatrix, sceneLight);
sceneShaderProgram.setUniform("texture_sampler", 0);
// Render each gameItem
GameItem[] gameItems = scene.getGameItems();
for (GameItem gameItem : gameItems) {
Mesh mesh = gameItem.getMesh();
// Set model view matrix for this item
Matrix4f modelViewMatrix = transformation.getModelViewMatrix(gameItem, viewMatrix);
sceneShaderProgram.setUniform("modelViewMatrix", modelViewMatrix);
// Render the mesh for this game item
sceneShaderProgram.setUniform("material", mesh.getMaterial());
mesh.render();
}
sceneShaderProgram.unbind();
}
代码示例来源:origin: lwjglgamedev/lwjglbook
public void render(Window window, Camera camera, GameItem[] gameItems, Vector3f ambientLight,
PointLight[] pointLightList, SpotLight[] spotLightList, DirectionalLight directionalLight) {
clear();
if ( window.isResized() ) {
glViewport(0, 0, window.getWidth(), window.getHeight());
window.setResized(false);
}
shaderProgram.bind();
// Update projection Matrix
Matrix4f projectionMatrix = transformation.getProjectionMatrix(FOV, window.getWidth(), window.getHeight(), Z_NEAR, Z_FAR);
shaderProgram.setUniform("projectionMatrix", projectionMatrix);
// Update view Matrix
Matrix4f viewMatrix = transformation.getViewMatrix(camera);
// Update Light Uniforms
renderLights(viewMatrix, ambientLight, pointLightList, spotLightList, directionalLight);
shaderProgram.setUniform("texture_sampler", 0);
// Render each gameItem
for (GameItem gameItem : gameItems) {
Mesh mesh = gameItem.getMesh();
// Set model view matrix for this item
Matrix4f modelViewMatrix = transformation.getModelViewMatrix(gameItem, viewMatrix);
shaderProgram.setUniform("modelViewMatrix", modelViewMatrix);
// Render the mesh for this game item
shaderProgram.setUniform("material", mesh.getMaterial());
mesh.render();
}
shaderProgram.unbind();
}
代码示例来源:origin: lwjglgamedev/lwjglbook
public void render(Window window, Camera camera, GameItem[] gameItems) {
clear();
if ( window.isResized() ) {
glViewport(0, 0, window.getWidth(), window.getHeight());
window.setResized(false);
}
shaderProgram.bind();
// Update projection Matrix
Matrix4f projectionMatrix = transformation.getProjectionMatrix(FOV, window.getWidth(), window.getHeight(), Z_NEAR, Z_FAR);
shaderProgram.setUniform("projectionMatrix", projectionMatrix);
// Update view Matrix
Matrix4f viewMatrix = transformation.getViewMatrix(camera);
shaderProgram.setUniform("texture_sampler", 0);
// Render each gameItem
for(GameItem gameItem : gameItems) {
Mesh mesh = gameItem.getMesh();
// Set model view matrix for this item
Matrix4f modelViewMatrix = transformation.getModelViewMatrix(gameItem, viewMatrix);
shaderProgram.setUniform("modelViewMatrix", modelViewMatrix);
// Render the mesh for this game item
shaderProgram.setUniform("colour", mesh.getColour());
shaderProgram.setUniform("useColour", mesh.isTextured() ? 0 : 1);
mesh.render();
}
shaderProgram.unbind();
}
代码示例来源:origin: lwjglgamedev/lwjglbook
Mesh mesh = gameItem.getMesh();
Matrix4f modelViewMatrix = transformation.getModelViewMatrix(gameItem, viewMatrix);
shaderProgram.setUniform("modelViewMatrix", modelViewMatrix);
代码示例来源:origin: lwjglgamedev/lwjglbook
Mesh mesh = gameItem.getMesh();
Matrix4f modelViewMatrix = transformation.getModelViewMatrix(gameItem, viewMatrix);
shaderProgram.setUniform("modelViewMatrix", modelViewMatrix);
代码示例来源:origin: lwjglgamedev/lwjglbook
Mesh mesh = gameItem.getMesh();
Matrix4f modelViewMatrix = transformation.getModelViewMatrix(gameItem, viewMatrix);
shaderProgram.setUniform("modelViewMatrix", modelViewMatrix);
内容来源于网络,如有侵权,请联系作者删除!