fix generic objects not uploading on first add
also clean up some comments
This commit is contained in:
+8
-4
@@ -291,7 +291,11 @@ public class BlazeDhGenericObjectRenderer implements IDhGenericRenderer
|
||||
throw new IllegalArgumentException("Box group must be of type ["+ RenderableBoxGroup.class.getSimpleName()+"], type received: ["+(iBoxGroup != null ? iBoxGroup.getClass() : "NULL")+"].");
|
||||
}
|
||||
RenderableBoxGroup boxGroup = (RenderableBoxGroup) iBoxGroup;
|
||||
|
||||
if (boxGroup.size() != 0)
|
||||
{
|
||||
// trigger a box change to make sure the initial data is uploaded
|
||||
boxGroup.triggerBoxChange();
|
||||
}
|
||||
|
||||
long id = boxGroup.getId();
|
||||
if (this.boxGroupById.containsKey(id))
|
||||
@@ -495,7 +499,7 @@ public class BlazeDhGenericObjectRenderer implements IDhGenericRenderer
|
||||
BlazeDhMetaRenderer.INSTANCE.dhDepthTextureWrapper.textureView,
|
||||
/*optionalDepthValueAsDouble*/ OptionalDouble.empty()))
|
||||
{
|
||||
this.renderBoxGroupInstanced(renderPass, renderEventParam, boxGroup, camPos, profiler);
|
||||
this.renderBoxGroupInstanced(renderPass, renderEventParam, boxGroup, profiler);
|
||||
}
|
||||
|
||||
profiler.pop(); // resource path
|
||||
@@ -534,7 +538,7 @@ public class BlazeDhGenericObjectRenderer implements IDhGenericRenderer
|
||||
|
||||
private void renderBoxGroupInstanced(
|
||||
RenderPass renderPass, RenderParams renderEventParam,
|
||||
RenderableBoxGroup boxGroup, Vec3d camPos,
|
||||
RenderableBoxGroup boxGroup,
|
||||
IProfilerWrapper profiler)
|
||||
{
|
||||
// update instance data //
|
||||
@@ -568,7 +572,7 @@ public class BlazeDhGenericObjectRenderer implements IDhGenericRenderer
|
||||
renderPass.drawIndexed(
|
||||
/*indexStart*/ 0,
|
||||
/*firstIndex*/0,
|
||||
/*indexCount*/container.uploadedBoxCount * 36,
|
||||
/*indexCount*/container.uploadedBoxCount * 36, // 36 = 6 faces * 6 verticies per face
|
||||
/*instanceCount*/1);
|
||||
|
||||
}
|
||||
|
||||
+4
-9
@@ -88,11 +88,6 @@ public class BlazeGenericObjectVertexContainer implements IDhGenericObjectVertex
|
||||
public void updateVertexData(List<DhApiRenderableBox> uploadBoxList)
|
||||
{
|
||||
int boxCount = uploadBoxList.size();
|
||||
if (boxCount == 0)
|
||||
{
|
||||
return; // TODO done just to fix a buffer empty crash
|
||||
}
|
||||
|
||||
|
||||
// recreate the data arrays if their size is different
|
||||
if (this.uploadedBoxCount != boxCount)
|
||||
@@ -196,8 +191,8 @@ public class BlazeGenericObjectVertexContainer implements IDhGenericObjectVertex
|
||||
// minimum of 1 box to prevent trying to create a buffer of size 0
|
||||
int boxCount = Math.max(this.uploadedBoxCount, 1);
|
||||
|
||||
int faceCount = boxCount * 6;
|
||||
int vertexCount = faceCount * 6;
|
||||
int faceCount = boxCount * 6; // 6 faces on a cube
|
||||
int vertexCount = faceCount * 6; // 6 vertices per cube
|
||||
|
||||
int byteSize = vertexCount * 3 * Float.BYTES; // x,y,z
|
||||
byteSize += vertexCount * 4; // r,g,b,a
|
||||
@@ -209,8 +204,8 @@ public class BlazeGenericObjectVertexContainer implements IDhGenericObjectVertex
|
||||
// minimum of 1 box to prevent trying to create a buffer of size 0
|
||||
int boxCount = Math.max(this.uploadedBoxCount, 1);
|
||||
|
||||
int quadCount = boxCount * 36;
|
||||
int byteSize = quadCount * GLEnums.getTypeSize(GL32.GL_UNSIGNED_INT) * 6;
|
||||
int quadCount = boxCount * 6 * 6; // 6 faces with 6 vertices each
|
||||
int byteSize = quadCount * GLEnums.getTypeSize(GL32.GL_UNSIGNED_INT);
|
||||
return byteSize;
|
||||
}
|
||||
|
||||
|
||||
+5
@@ -361,6 +361,11 @@ public class GlGenericObjectRenderer implements IDhGenericRenderer
|
||||
throw new IllegalArgumentException("Box group must be of type ["+ RenderableBoxGroup.class.getSimpleName()+"], type received: ["+(iBoxGroup != null ? iBoxGroup.getClass() : "NULL")+"].");
|
||||
}
|
||||
RenderableBoxGroup boxGroup = (RenderableBoxGroup) iBoxGroup;
|
||||
if (boxGroup.size() != 0)
|
||||
{
|
||||
// trigger a box change to make sure the initial data is uploaded
|
||||
boxGroup.triggerBoxChange();
|
||||
}
|
||||
|
||||
|
||||
long id = boxGroup.getId();
|
||||
|
||||
+1
-1
Submodule coreSubProjects updated: 8a39610b8c...082b364f52
Reference in New Issue
Block a user