Skip to content

RenderContext: code cleanup #2487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
25 changes: 8 additions & 17 deletions jme3-core/src/main/java/com/jme3/renderer/RenderContext.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2024 jMonkeyEngine
* Copyright (c) 2009-2025 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -38,6 +38,8 @@
import com.jme3.texture.FrameBuffer;
import com.jme3.texture.Image;
import java.lang.ref.WeakReference;
import java.util.Arrays;

import com.jme3.shader.bufferobject.BufferObject;

/**
Expand Down Expand Up @@ -222,7 +224,6 @@ public class RenderContext {
*/
public int boundRB;


/**
* Currently bound element array vertex buffer.
*
Expand Down Expand Up @@ -259,15 +260,13 @@ public class RenderContext {
*
* @see Renderer#setTexture(int, com.jme3.texture.Texture)
*/
public final WeakReference<Image> boundTextures[]
= new WeakReference[maxTextureUnits];

public final WeakReference<Image>[] boundTextures = new WeakReference[maxTextureUnits];

/**
* Current bound buffer object IDs for each buffer object unit.
*
* @see Renderer#setUniformBufferObject(int, com.jme3.shader.BufferObject)
* @see Renderer#setShaderStorageBufferObject(int, com.jme3.shader.BufferObject)
* @see Renderer#setUniformBufferObject(int, com.jme3.shader.bufferobject.BufferObject)
* @see Renderer#setShaderStorageBufferObject(int, com.jme3.shader.bufferobject.BufferObject)
*/
public final WeakReference<BufferObject>[] boundBO = new WeakReference[maxBufferObjectUnits];

Expand Down Expand Up @@ -364,9 +363,7 @@ public RenderContext() {
init();
}


private void init() {
cullMode = RenderState.FaceCullMode.Off;
depthTestEnabled = false;
depthWriteEnabled = true;
colorWriteEnabled = true;
Expand Down Expand Up @@ -421,16 +418,10 @@ private void init() {
public void reset() {
init();

for (int i = 0; i < boundTextures.length; i++) {
boundTextures[i] = null;
}

Arrays.fill(boundTextures, null);
textureIndexList.reset();

for (int i = 0; i < boundAttribs.length; i++) {
boundAttribs[i] = null;
}

Arrays.fill(boundAttribs, null);
attribIndexList.reset();
}
}