@Override public R2LightBufferType onCreate( final JCGLTextureUnitContextParentType tc, final R2LightBufferDescriptionType key) { return R2LightBuffers.newLightBuffer( this.g.getFramebuffers(), this.g.getTextures(), tc, key); }
@Override public R2AmbientOcclusionBufferType onCreate( final JCGLTextureUnitContextParentType tc, final R2AmbientOcclusionBufferDescriptionType key) { return R2AmbientOcclusionBuffer.newAmbientOcclusionBuffer( this.g.getFramebuffers(), this.g.getTextures(), tc, key); }
@Override public R2DepthVarianceBufferType onCreate( final JCGLTextureUnitContextParentType tc, final R2DepthVarianceBufferDescriptionType key) { return R2DepthVarianceBuffer.newDepthVarianceBuffer( this.g.getFramebuffers(), this.g.getTextures(), tc, key); }
@Override public R2ImageBufferType onCreate( final JCGLTextureUnitContextParentType tc, final R2ImageBufferDescriptionType key) { return R2ImageBuffer.newImageBuffer( this.g.getFramebuffers(), this.g.getTextures(), tc, key); }
@Override default void delete( final JCGLInterfaceGL33Type g) throws R2Exception { if (!this.textureWritable().isDeleted()) { final JCGLTexturesType g_tx = g.getTextures(); g_tx.texture2DDelete(this.textureWritable()); } }
@Override default void delete( final JCGLInterfaceGL33Type g) throws R2Exception { if (!this.textureWritable().isDeleted()) { final JCGLTexturesType g_tx = g.getTextures(); g_tx.textureCubeDelete(this.textureWritable()); } }
private static JCGLTexture2DType newProjectionTexture( final JCGLInterfaceGL33Type c) { final JCGLTexturesType gt = c.getTextures(); final List<JCGLTextureUnitType> gu = gt.textureGetUnits(); return gt.texture2DAllocate( gu.get(0), 64L, 64L, JCGLTextureFormat.TEXTURE_FORMAT_RGB_8_3BPP, JCGLTextureWrapS.TEXTURE_WRAP_CLAMP_TO_EDGE, JCGLTextureWrapT.TEXTURE_WRAP_CLAMP_TO_EDGE, JCGLTextureFilterMinification.TEXTURE_FILTER_NEAREST, JCGLTextureFilterMagnification.TEXTURE_FILTER_LINEAR); }
@Override public void onStart() { this.shaders = this.g33.getShaders(); this.textures = this.g33.getTextures(); this.array_objects = this.g33.getArrayObjects(); this.draw = this.g33.getDraw(); this.program.onActivate(this.g33); this.program.onReceiveViewValues( this.g33, this.configureViewParameters()); }
@Override public void onReceiveShadowMap( final JCGLInterfaceGL33Type g, final JCGLTextureUnitContextMutableType tc, final R2Texture2DUsableType map) { NullCheck.notNull(g); NullCheck.notNull(tc); NullCheck.notNull(map); final JCGLShadersType g_sh = g.getShaders(); final JCGLTexturesType g_tex = g.getTextures(); final JCGLTextureUnitType unit_shadow = tc.unitContextBindTexture2D(g_tex, map.texture()); g_sh.shaderUniformPutTexture2DUnit( this.u_shadow_map, unit_shadow); }
private OpaqueConsumer( final JCGLInterfaceGL33Type ig) { this.g33 = NullCheck.notNull(ig); this.shaders = this.g33.getShaders(); this.textures = this.g33.getTextures(); this.array_objects = this.g33.getArrayObjects(); this.draw = this.g33.getDraw(); this.render_state = JCGLRenderStateMutable.create(); this.stencil_state = JCGLStencilStateMutable.create(); this.params_view = R2ShaderParametersViewMutable.create(); this.params_material = R2ShaderParametersMaterialMutable.create(); }
@Override public void onReceiveShadowMap( final JCGLInterfaceGL33Type g, final JCGLTextureUnitContextMutableType tc, final R2Texture2DUsableType map) { NullCheck.notNull(g); NullCheck.notNull(tc); NullCheck.notNull(map); final JCGLShadersType g_sh = g.getShaders(); final JCGLTexturesType g_tex = g.getTextures(); final JCGLTextureUnitType unit_shadow = tc.unitContextBindTexture2D(g_tex, map.texture()); g_sh.shaderUniformPutTexture2DUnit( this.u_shadow_map, unit_shadow); }
@Test public final void testNewError0() { final JCGLContextType gc = this.newGL33Context("main", 24, 8); final JCGLInterfaceGL33Type g33 = gc.contextGetGL33(); final JCGLTexturesType g_tx = g33.getTextures(); final List<JCGLTextureUnitType> us = g_tx.textureGetUnits(); final JCGLTextureUnitAllocatorType alloc = this.newAllocator(2, us); final JCGLTextureUnitContextParentType c_root = alloc.getRootContext(); final JCGLTextureUnitContextType c_0 = c_root.unitContextNew(); this.expected.expect(JCGLExceptionTextureUnitContextNotActive.class); c_root.unitContextNew(); }
@Test public final void testBindError2D() { final JCGLContextType gc = this.newGL33Context("main", 24, 8); final JCGLInterfaceGL33Type g33 = gc.contextGetGL33(); final JCGLTexturesType g_tx = g33.getTextures(); final List<JCGLTextureUnitType> us = g_tx.textureGetUnits(); final JCGLTextureUnitAllocatorType alloc = this.newAllocator(2, us); final JCGLTextureUnitContextParentType c_root = alloc.getRootContext(); final JCGLTextureUnitContextType c_0 = c_root.unitContextNew(); final JCGLTextureUnitType u0 = us.get(0); final JCGLTexture2DType t0 = JCGLTextureUnitAllocatorContract.newTexture(g_tx, u0); g_tx.textureUnitUnbind(u0); c_0.unitContextFinish(g_tx); this.expected.expect(JCGLExceptionTextureUnitContextNotActive.class); c_0.unitContextBindTexture2D(g_tx, t0); }
@Test public final void testFinishError0() { final JCGLContextType gc = this.newGL33Context("main", 24, 8); final JCGLInterfaceGL33Type g33 = gc.contextGetGL33(); final JCGLTexturesType g_tx = g33.getTextures(); final List<JCGLTextureUnitType> us = g_tx.textureGetUnits(); final JCGLTextureUnitAllocatorType alloc = this.newAllocator(2, us); final JCGLTextureUnitContextParentType c_root = alloc.getRootContext(); final JCGLTextureUnitContextType c_0 = c_root.unitContextNew(); c_0.unitContextFinish(g_tx); this.expected.expect(JCGLExceptionTextureUnitContextNotActive.class); c_0.unitContextFinish(g_tx); }
@Test public final void testNewError1() { final JCGLContextType gc = this.newGL33Context("main", 24, 8); final JCGLInterfaceGL33Type g33 = gc.contextGetGL33(); final JCGLTexturesType g_tx = g33.getTextures(); final List<JCGLTextureUnitType> us = g_tx.textureGetUnits(); final JCGLTextureUnitAllocatorType alloc = this.newAllocator(3, us); final JCGLTextureUnitContextParentType c_root = alloc.getRootContext(); final JCGLTextureUnitContextType c_0 = c_root.unitContextNew(); final JCGLTextureUnitContextType c_1 = c_0.unitContextNew(); this.expected.expect(JCGLExceptionTextureUnitContextNotActive.class); c_0.unitContextNew(); }
OpaqueConsumer( final JCGLInterfaceGL33Type ig, final R2ShaderInstanceSingleType<PVectorI4F<R2SpaceRGBAType>> in_shader_single, final R2ShaderInstanceBatchedType<PVectorI4F<R2SpaceRGBAType>> in_shader_batched, final R2ShaderInstanceBillboardedType<PVectorI4F<R2SpaceRGBAType>> in_shader_billboarded) { this.g33 = NullCheck.notNull(ig); this.shader_single = NullCheck.notNull(in_shader_single); this.shader_batched = NullCheck.notNull(in_shader_batched); this.shader_billboarded = NullCheck.notNull(in_shader_billboarded); this.shaders = this.g33.getShaders(); this.textures = this.g33.getTextures(); this.array_objects = this.g33.getArrayObjects(); this.draw = this.g33.getDraw(); this.render_state = JCGLRenderStateMutable.create(); this.params_view = R2ShaderParametersViewMutable.create(); this.params_material = R2ShaderParametersMaterialMutable.create(); }
@Test public final void testUsageBigStackExceeded() { final JCGLContextType gc = this.newGL33Context("main", 24, 8); final JCGLInterfaceGL33Type g33 = gc.contextGetGL33(); final JCGLTexturesType g_tx = g33.getTextures(); final List<JCGLTextureUnitType> us = g_tx.textureGetUnits(); final JCGLTextureUnitAllocatorType alloc = this.newAllocator(4, us); final JCGLTextureUnitContextParentType c_root = alloc.getRootContext(); final JCGLTextureUnitContextType c_0 = c_root.unitContextNew(); final JCGLTextureUnitContextType c_1 = c_0.unitContextNew(); final JCGLTextureUnitContextType c_2 = c_1.unitContextNew(); this.expected.expect(JCGLExceptionTextureUnitContextLimitReached.class); c_2.unitContextNew(); }
@Override protected final R2ShaderFilterEmissionParameters newParameters(final JCGLInterfaceGL33Type g) { final JCGLTexturesType g_tex = g.getTextures(); final JCGLTextureUnitAllocatorType tp = JCGLTextureUnitAllocator.newAllocatorWithStack( 8, g_tex.textureGetUnits()); final JCGLTextureUnitContextParentType tc_root = tp.getRootContext(); final JCGLTextureUnitContextType tc_alloc = tc_root.unitContextNew(); final R2TextureDefaultsType td = R2TextureDefaults.newDefaults(g_tex, tc_alloc); return R2ShaderFilterEmissionParameters.builder() .setAlbedoEmissionTexture(td.texture2DWhite()) .setGlowTexture(td.texture2DBlack()) .build(); }
@Test public final void testIdentities() { final JCGLContextType c = this.newGL33Context("main", 24, 8); final JCGLInterfaceGL33Type g = c.contextGetGL33(); final JCGLTextureUnitAllocatorType tc = JCGLTextureUnitAllocator.newAllocatorWithStack( 8, g.getTextures().textureGetUnits()); final JCGLTextureUnitContextParentType tc_root = tc.getRootContext(); final R2RenderTargetPoolType< R2AmbientOcclusionBufferDescriptionType, R2AmbientOcclusionBufferUsableType> p = R2AmbientOcclusionBufferPool.newPool(g, 0L, 8L * 8L); Assert.assertFalse(p.isDeleted()); p.delete(tc_root); Assert.assertTrue(p.isDeleted()); }
@Test public final void testTexture() { final JCGLContextType c = this.newGL33Context("main", 24, 8); final JCGLInterfaceGL33Type gi = c.contextGetGL33(); final JCGLTexturesType gt = gi.getTextures(); final JCGLTextureUnitAllocatorType tc = JCGLTextureUnitAllocator.newAllocatorWithStack(32, gt.textureGetUnits()); final R2Texture2DType tt = R2SSAONoiseTexture.newNoiseTexture(gt, tc.getRootContext()); final JCGLTexture2DUsableType t = tt.texture(); Assert.assertEquals(64L, t.textureGetWidth()); Assert.assertEquals(64L, t.textureGetWidth()); Assert.assertEquals( JCGLTextureFormat.TEXTURE_FORMAT_RGB_8_3BPP, t.textureGetFormat()); } }