Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions jme3-core/src/main/java/com/jme3/light/Light.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ public int getId(){
*/
protected String name;

boolean frustumCheckNeeded = true;
boolean intersectsFrustum = false;
public boolean frustumCheckNeeded = true;
public boolean intersectsFrustum = false;

protected Light() {
}
Expand Down
1 change: 1 addition & 0 deletions jme3-core/src/main/java/com/jme3/renderer/opengl/GL3.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public interface GL3 extends GL2 {
public void glBindFragDataLocation(int param1, int param2, String param3); /// GL3+
public void glBindVertexArray(int param1); /// GL3+
public void glDeleteVertexArrays(IntBuffer arrays); /// GL3+
public void glFramebufferTextureLayer(int param1, int param2, int param3, int param4, int param5); /// GL3+
public void glGenVertexArrays(IntBuffer param1); /// GL3+
public String glGetString(int param1, int param2); /// GL3+
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,10 @@ public void glPatchParameter(int count) {
gl4.glPatchParameter(count);
checkError();
}

@Override
public void glFramebufferTextureLayer(int param1, int param2, int param3, int param4, int param5) {
gl3.glFramebufferTextureLayer(param1, param2, param3, param4, param5);
checkError();
}
}
18 changes: 13 additions & 5 deletions jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -1438,11 +1438,19 @@ public void updateRenderTexture(FrameBuffer fb, RenderBuffer rb) {
setupTextureParams(0, tex);
}

glfbo.glFramebufferTexture2DEXT(GLFbo.GL_FRAMEBUFFER_EXT,
convertAttachmentSlot(rb.getSlot()),
convertTextureType(tex.getType(), image.getMultiSamples(), rb.getFace()),
image.getId(),
0);
if (rb.getLayer() < 0){
glfbo.glFramebufferTexture2DEXT(GLFbo.GL_FRAMEBUFFER_EXT,
convertAttachmentSlot(rb.getSlot()),
convertTextureType(tex.getType(), image.getMultiSamples(), rb.getFace()),
image.getId(),
0);
} else {
gl3.glFramebufferTextureLayer(GLFbo.GL_FRAMEBUFFER_EXT,
convertAttachmentSlot(rb.getSlot()),
image.getId(),
0,
rb.getLayer());
}
}

public void updateFrameBufferAttachment(FrameBuffer fb, RenderBuffer rb) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ protected void generateNodeMainSection(StringBuilder source, ShaderNode shaderNo
}

for (ShaderNodeVariable var : shaderNode.getDefinition().getOutputs()) {
ShaderNodeVariable v = new ShaderNodeVariable(var.getType(), shaderNode.getName(), var.getName());
ShaderNodeVariable v = new ShaderNodeVariable(var.getType(), shaderNode.getName(), var.getName(), var.getMultiplicity());
if (!declaredInputs.contains(shaderNode.getName() + "_" + var.getName())) {
if (!isVarying(info, v)) {
declareVariable(source, v);
Expand Down Expand Up @@ -397,6 +397,11 @@ protected void map(VariableMapping mapping, StringBuilder source) {
source.append(mapping.getLeftVariable().getNameSpace());
source.append("_");
source.append(mapping.getLeftVariable().getName());
if (mapping.getLeftVariable().getMultiplicity() != null){
source.append("[");
source.append(mapping.getLeftVariable().getMultiplicity());
source.append("]");
}

//left swizzle, the variable can't be declared and assigned on the same line.
if (mapping.getLeftSwizzling().length() > 0) {
Expand Down
2 changes: 1 addition & 1 deletion jme3-core/src/main/java/com/jme3/shader/VarType.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public enum VarType {
TextureBuffer(false,true,"sampler1D|sampler1DShadow"),
Texture2D(false,true,"sampler2D|sampler2DShadow"),
Texture3D(false,true,"sampler3D"),
TextureArray(false,true,"sampler2DArray"),
TextureArray(false,true,"sampler2DArray|sampler2DArrayShadow"),
TextureCubeMap(false,true,"samplerCube"),
Int("int");

Expand Down
56 changes: 56 additions & 0 deletions jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public class RenderBuffer {
int id = -1;
int slot = SLOT_UNDEF;
int face = -1;
int layer = -1;

/**
* @return The image format of the render buffer.
Expand Down Expand Up @@ -160,6 +161,10 @@ public String toString(){
return "BufferTarget[format=" + format + "]";
}
}

public int getLayer() {
return this.layer;
}
}

/**
Expand Down Expand Up @@ -324,6 +329,19 @@ public void setColorTexture(Texture2D tex){
addColorTexture(tex);
}

/**
* Set the color texture array to use for this framebuffer.
* This automatically clears all existing textures added previously
* with {@link FrameBuffer#addColorTexture } and adds this texture as the
* only target.
*
* @param tex The color texture array to set.
*/
public void setColorTexture(TextureArray tex, int layer){
clearColorTargets();
addColorTexture(tex, layer);
}

/**
* Set the color texture to use for this framebuffer.
* This automatically clears all existing textures added previously
Expand Down Expand Up @@ -369,6 +387,31 @@ public void addColorTexture(Texture2D tex) {
colorBufs.add(colorBuf);
}

/**
* Add a color texture array to use for this framebuffer.
* If MRT is enabled, then each subsequently added texture can be
* rendered to through a shader that writes to the array <code>gl_FragData</code>.
* If MRT is not enabled, then the index set with {@link FrameBuffer#setTargetIndex(int) }
* is rendered to by the shader.
*
* @param tex The texture array to add.
*/
public void addColorTexture(TextureArray tex, int layer) {
if (id != -1)
throw new UnsupportedOperationException("FrameBuffer already initialized.");

Image img = tex.getImage();
checkSetTexture(tex, false);

RenderBuffer colorBuf = new RenderBuffer();
colorBuf.slot = colorBufs.size();
colorBuf.tex = tex;
colorBuf.format = img.getFormat();
colorBuf.layer = layer;

colorBufs.add(colorBuf);
}

/**
* Add a color texture to use for this framebuffer.
* If MRT is enabled, then each subsequently added texture can be
Expand Down Expand Up @@ -412,7 +455,20 @@ public void setDepthTexture(Texture2D tex){
depthBuf.tex = tex;
depthBuf.format = img.getFormat();
}
public void setDepthTexture(TextureArray tex, int layer){
if (id != -1)
throw new UnsupportedOperationException("FrameBuffer already initialized.");

Image img = tex.getImage();
checkSetTexture(tex, true);

depthBuf = new RenderBuffer();
depthBuf.slot = img.getFormat().isDepthStencilFormat() ? SLOT_DEPTH_STENCIL : SLOT_DEPTH;
depthBuf.tex = tex;
depthBuf.format = img.getFormat();
depthBuf.layer = layer;
}

/**
* @return The number of color buffers attached to this texture.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ public VariableMapping readInputMapping(Statement statement1) throws IOException
}
right.setNameSpace(node.getName());
right.setType(var.getType());
right.setMultiplicity(var.getMultiplicity());
mapping.setRightVariable(right);
storeVaryings(node, mapping.getRightVariable());

Expand Down
5 changes: 5 additions & 0 deletions jme3-jogl/src/main/java/com/jme3/renderer/jogl/JoglGL.java
Original file line number Diff line number Diff line change
Expand Up @@ -600,4 +600,9 @@ public void glDeleteVertexArrays(IntBuffer arrays) {
checkLimit(arrays);
GLContext.getCurrentGL().getGL2ES3().glDeleteVertexArrays(arrays.limit(), arrays);
}

@Override
public void glFramebufferTextureLayer(int param1, int param2, int param3, int param4, int param5) {
GLContext.getCurrentGL().getGL3().glFramebufferTextureLayer(param1, param2, param3, param4, param5);
}
}
5 changes: 5 additions & 0 deletions jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/LwjglGL.java
Original file line number Diff line number Diff line change
Expand Up @@ -457,4 +457,9 @@ public void glDeleteVertexArrays(IntBuffer arrays) {
checkLimit(arrays);
ARBVertexArrayObject.glDeleteVertexArrays(arrays);
}

@Override
public void glFramebufferTextureLayer(int param1, int param2, int param3, int param4, int param5) {
GL30.glFramebufferTextureLayer(param1, param2, param3, param4, param5);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -486,4 +486,9 @@ public void glDeleteVertexArrays(IntBuffer arrays) {
checkLimit(arrays);
ARBVertexArrayObject.glDeleteVertexArrays(arrays);
}

@Override
public void glFramebufferTextureLayer(int param1, int param2, int param3, int param4, int param5) {
GL30.glFramebufferTextureLayer(param1, param2, param3, param4, param5);
}
}