org.lwjglb.engine.Utils.loadResource()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(12.0k)|赞(0)|评价(0)|浏览(147)

本文整理了Java中org.lwjglb.engine.Utils.loadResource()方法的一些代码示例,展示了Utils.loadResource()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.loadResource()方法的具体详情如下:
包路径:org.lwjglb.engine.Utils
类名称:Utils
方法名:loadResource

Utils.loadResource介绍

暂无

代码示例

代码示例来源:origin: lwjglgamedev/lwjglbook

private void setupDepthShader() throws Exception {
  depthShaderProgram = new ShaderProgram();
  depthShaderProgram.createVertexShader(Utils.loadResource("/shaders/depth_vertex.vs"));
  depthShaderProgram.createFragmentShader(Utils.loadResource("/shaders/depth_fragment.fs"));
  depthShaderProgram.link();
  depthShaderProgram.createUniform("orthoProjectionMatrix");
  depthShaderProgram.createUniform("modelLightViewMatrix");
}

代码示例来源:origin: lwjglgamedev/lwjglbook

private void setupTestShader() throws Exception {
  testShaderProgram = new ShaderProgram();
  testShaderProgram.createVertexShader(Utils.loadResource("/shaders/test_vertex.vs"));
  testShaderProgram.createFragmentShader(Utils.loadResource("/shaders/test_fragment.fs"));
  testShaderProgram.link();
  for (int i = 0; i < ShadowRenderer.NUM_CASCADES; i++) {
    testShaderProgram.createUniform("texture_sampler[" + i + "]");
  }
  quadMesh = StaticMeshesLoader.load("/models/quad.obj", "")[0];
}

代码示例来源:origin: lwjglgamedev/lwjglbook

private void setupHudShader() throws Exception {
  hudShaderProgram = new ShaderProgram();
  hudShaderProgram.createVertexShader(Utils.loadResource("/shaders/hud_vertex.vs"));
  hudShaderProgram.createFragmentShader(Utils.loadResource("/shaders/hud_fragment.fs"));
  hudShaderProgram.link();
  // Create uniforms for Ortographic-model projection matrix and base colour
  hudShaderProgram.createUniform("projModelMatrix");
  hudShaderProgram.createUniform("colour");
  hudShaderProgram.createUniform("hasTexture");
}

代码示例来源:origin: lwjglgamedev/lwjglbook

private void setupDepthShader() throws Exception {
  depthShaderProgram = new ShaderProgram();
  depthShaderProgram.createVertexShader(Utils.loadResource("/shaders/depth_vertex.vs"));
  depthShaderProgram.createFragmentShader(Utils.loadResource("/shaders/depth_fragment.fs"));
  depthShaderProgram.link();
  depthShaderProgram.createUniform("orthoProjectionMatrix");
  depthShaderProgram.createUniform("modelLightViewMatrix");
  // Create uniform for joint matrices
  depthShaderProgram.createUniform("jointsMatrix");
}

代码示例来源:origin: lwjglgamedev/lwjglbook

private void setupHudShader() throws Exception {
  hudShaderProgram = new ShaderProgram();
  hudShaderProgram.createVertexShader(Utils.loadResource("/shaders/hud_vertex.vs"));
  hudShaderProgram.createFragmentShader(Utils.loadResource("/shaders/hud_fragment.fs"));
  hudShaderProgram.link();
  // Create uniforms for Ortographic-model projection matrix and base colour
  hudShaderProgram.createUniform("projModelMatrix");
  hudShaderProgram.createUniform("colour");
  hudShaderProgram.createUniform("hasTexture");
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void init(Window window) throws Exception {
  // Create shader
  shaderProgram = new ShaderProgram();
  shaderProgram.createVertexShader(Utils.loadResource("/shaders/vertex.vs"));
  shaderProgram.createFragmentShader(Utils.loadResource("/shaders/fragment.fs"));
  shaderProgram.link();
  
  // Create uniforms for modelView and projection matrices and texture
  shaderProgram.createUniform("projectionMatrix");
  shaderProgram.createUniform("modelViewMatrix");
  shaderProgram.createUniform("texture_sampler");
}

代码示例来源:origin: lwjglgamedev/lwjglbook

private void setupHudShader() throws Exception {
  hudShaderProgram = new ShaderProgram();
  hudShaderProgram.createVertexShader(Utils.loadResource("/shaders/hud_vertex.vs"));
  hudShaderProgram.createFragmentShader(Utils.loadResource("/shaders/hud_fragment.fs"));
  hudShaderProgram.link();
  // Create uniforms for Ortographic-model projection matrix and base colour
  hudShaderProgram.createUniform("projModelMatrix");
  hudShaderProgram.createUniform("colour");
  hudShaderProgram.createUniform("hasTexture");
}

代码示例来源:origin: lwjglgamedev/lwjglbook

private void setupHudShader() throws Exception {
  hudShaderProgram = new ShaderProgram();
  hudShaderProgram.createVertexShader(Utils.loadResource("/shaders/hud_vertex.vs"));
  hudShaderProgram.createFragmentShader(Utils.loadResource("/shaders/hud_fragment.fs"));
  hudShaderProgram.link();
  // Create uniforms for Ortographic-model projection matrix and base colour
  hudShaderProgram.createUniform("projModelMatrix");
  hudShaderProgram.createUniform("colour");
  hudShaderProgram.createUniform("hasTexture");
}

代码示例来源:origin: lwjglgamedev/lwjglbook

private void setupHudShader() throws Exception {
  hudShaderProgram = new ShaderProgram();
  hudShaderProgram.createVertexShader(Utils.loadResource("/shaders/hud_vertex.vs"));
  hudShaderProgram.createFragmentShader(Utils.loadResource("/shaders/hud_fragment.fs"));
  hudShaderProgram.link();
  // Create uniforms for Ortographic-model projection matrix and base colour
  hudShaderProgram.createUniform("projModelMatrix");
  hudShaderProgram.createUniform("colour");
  hudShaderProgram.createUniform("hasTexture");
}

代码示例来源:origin: lwjglgamedev/lwjglbook

public void init(Window window) throws Exception {
  // Create shader
  shaderProgram = new ShaderProgram();
  shaderProgram.createVertexShader(Utils.loadResource("/vertex.vs"));
  shaderProgram.createFragmentShader(Utils.loadResource("/fragment.fs"));
  shaderProgram.link();
  
  // Create uniforms for world and projection matrices
  shaderProgram.createUniform("projectionMatrix");
  shaderProgram.createUniform("worldMatrix");
  
  window.setClearColor(0.0f, 0.0f, 0.0f, 0.0f);
}

代码示例来源:origin: lwjglgamedev/lwjglbook

private void setupDepthShader() throws Exception {
  depthShaderProgram = new ShaderProgram();
  depthShaderProgram.createVertexShader(Utils.loadResource("/shaders/depth_vertex.vs"));
  depthShaderProgram.createFragmentShader(Utils.loadResource("/shaders/depth_fragment.fs"));
  depthShaderProgram.link();
  depthShaderProgram.createUniform("isInstanced");
  depthShaderProgram.createUniform("jointsMatrix");
  depthShaderProgram.createUniform("modelLightViewNonInstancedMatrix");
  depthShaderProgram.createUniform("orthoProjectionMatrix");
}

代码示例来源:origin: lwjglgamedev/lwjglbook

private void setupDepthShader() throws Exception {
  depthShaderProgram = new ShaderProgram();
  depthShaderProgram.createVertexShader(Utils.loadResource("/shaders/depth_vertex.vs"));
  depthShaderProgram.createFragmentShader(Utils.loadResource("/shaders/depth_fragment.fs"));
  depthShaderProgram.link();
  depthShaderProgram.createUniform("isInstanced");
  depthShaderProgram.createUniform("jointsMatrix");
  depthShaderProgram.createUniform("modelLightViewNonInstancedMatrix");
  depthShaderProgram.createUniform("orthoProjectionMatrix");
}

代码示例来源:origin: lwjglgamedev/lwjglbook

private void setupParticlesShader() throws Exception {
  particlesShaderProgram = new ShaderProgram();
  particlesShaderProgram.createVertexShader(Utils.loadResource("/shaders/particles_vertex.vs"));
  particlesShaderProgram.createFragmentShader(Utils.loadResource("/shaders/particles_fragment.fs"));
  particlesShaderProgram.link();
  particlesShaderProgram.createUniform("projectionMatrix");
  particlesShaderProgram.createUniform("texture_sampler");
  particlesShaderProgram.createUniform("numCols");
  particlesShaderProgram.createUniform("numRows");
}

代码示例来源:origin: lwjglgamedev/lwjglbook

private void setupDepthShader() throws Exception {
  depthShaderProgram = new ShaderProgram();
  depthShaderProgram.createVertexShader(Utils.loadResource("/shaders/depth_vertex.vs"));
  depthShaderProgram.createFragmentShader(Utils.loadResource("/shaders/depth_fragment.fs"));
  depthShaderProgram.link();
  depthShaderProgram.createUniform("isInstanced");
  depthShaderProgram.createUniform("jointsMatrix");
  depthShaderProgram.createUniform("modelLightViewNonInstancedMatrix");
  depthShaderProgram.createUniform("orthoProjectionMatrix");
}

代码示例来源:origin: lwjglgamedev/lwjglbook

private void setupParticlesShader() throws Exception {
  particlesShaderProgram = new ShaderProgram();
  particlesShaderProgram.createVertexShader(Utils.loadResource("/shaders/particles_vertex.vs"));
  particlesShaderProgram.createFragmentShader(Utils.loadResource("/shaders/particles_fragment.fs"));
  particlesShaderProgram.link();
  particlesShaderProgram.createUniform("projectionMatrix");
  particlesShaderProgram.createUniform("texture_sampler");
  particlesShaderProgram.createUniform("numCols");
  particlesShaderProgram.createUniform("numRows");
}

代码示例来源:origin: lwjglgamedev/lwjglbook

private void setupDepthShader() throws Exception {
  depthShaderProgram = new ShaderProgram();
  depthShaderProgram.createVertexShader(Utils.loadResource("/shaders/depth_vertex.vs"));
  depthShaderProgram.createFragmentShader(Utils.loadResource("/shaders/depth_fragment.fs"));
  depthShaderProgram.link();
  depthShaderProgram.createUniform("isInstanced");
  depthShaderProgram.createUniform("jointsMatrix");
  depthShaderProgram.createUniform("modelLightViewNonInstancedMatrix");
  depthShaderProgram.createUniform("orthoProjectionMatrix");
}

代码示例来源:origin: lwjglgamedev/lwjglbook

private void setupSkyBoxShader() throws Exception {
  skyBoxShaderProgram = new ShaderProgram();
  skyBoxShaderProgram.createVertexShader(Utils.loadResource("/shaders/sb_vertex.vs"));
  skyBoxShaderProgram.createFragmentShader(Utils.loadResource("/shaders/sb_fragment.fs"));
  skyBoxShaderProgram.link();
  // Create uniforms for projection matrix
  skyBoxShaderProgram.createUniform("projectionMatrix");
  skyBoxShaderProgram.createUniform("modelViewMatrix");
  skyBoxShaderProgram.createUniform("texture_sampler");
  skyBoxShaderProgram.createUniform("ambientLight");
}

代码示例来源:origin: lwjglgamedev/lwjglbook

private void setupSkyBoxShader() throws Exception {
  skyBoxShaderProgram = new ShaderProgram();
  skyBoxShaderProgram.createVertexShader(Utils.loadResource("/shaders/sb_vertex.vs"));
  skyBoxShaderProgram.createFragmentShader(Utils.loadResource("/shaders/sb_fragment.fs"));
  skyBoxShaderProgram.link();
  // Create uniforms for projection matrix
  skyBoxShaderProgram.createUniform("projectionMatrix");
  skyBoxShaderProgram.createUniform("modelViewMatrix");
  skyBoxShaderProgram.createUniform("texture_sampler");
  skyBoxShaderProgram.createUniform("ambientLight");
}

代码示例来源:origin: lwjglgamedev/lwjglbook

private void setupParticlesShader() throws Exception {
  particlesShaderProgram = new ShaderProgram();
  particlesShaderProgram.createVertexShader(Utils.loadResource("/shaders/particles_vertex.vs"));
  particlesShaderProgram.createFragmentShader(Utils.loadResource("/shaders/particles_fragment.fs"));
  particlesShaderProgram.link();
  particlesShaderProgram.createUniform("viewMatrix");
  particlesShaderProgram.createUniform("projectionMatrix");
  particlesShaderProgram.createUniform("texture_sampler");
  particlesShaderProgram.createUniform("numCols");
  particlesShaderProgram.createUniform("numRows");
}

代码示例来源:origin: lwjglgamedev/lwjglbook

private void setupParticlesShader() throws Exception {
  particlesShaderProgram = new ShaderProgram();
  particlesShaderProgram.createVertexShader(Utils.loadResource("/shaders/particles_vertex.vs"));
  particlesShaderProgram.createFragmentShader(Utils.loadResource("/shaders/particles_fragment.fs"));
  particlesShaderProgram.link();
  particlesShaderProgram.createUniform("viewMatrix");
  particlesShaderProgram.createUniform("projectionMatrix");
  particlesShaderProgram.createUniform("texture_sampler");
  particlesShaderProgram.createUniform("numCols");
  particlesShaderProgram.createUniform("numRows");
}

相关文章