Problème rendu ISBRH et .obj …



  • Salut !!!

    Bon depuis quelques jours je cherche à render un .obj avec un rendu ISBRH mais le probléme c'est que je ne trouve absolument rien sur le net, j'ai foullier touts les site possible mais non … Et comme d'hab le wiki forge donne des trucs qui ne fonctionne pas ... (http://www.minecraftforge.net/wiki/Using_wavefront_model)

    Merci d'avance 😄
    Cordialement Sidney


  • Moddeurs confirmés Modérateurs

    Faut pas utiliser un isbrh mais un tesr


  • Moddeurs confirmés Rédacteurs Administrateurs

    Il faut passer par un TileEntitySpecialRenderer en effet, le rendu avec ISimpleBlockRenderingHandler ne permet pas de render les obj.



  • Ouai mais j ai vu sur plusieurs forum que des personnes avais réussi 😕


  • Moddeurs confirmés Modérateurs

    non tu a du mal lire car il faut forcement une tile entity, car ca revient au même que de faire un model techne



  • Bas pourtant même sur les doc de forge :"now lets imagine I'm inside a TESR (but its practicly the same for ISBRH or Class"


  • Moddeurs confirmés Rédacteurs Administrateurs

    Ah, tu peux envoyer ton code alors ?
    C'est peut être possible.



  • J'ai essayes quelque trucs que j'ai trouvé sur internet:

    Comme sa:

    
    public class RenderModel implements ISimpleBlockRenderingHandler
    {
    private IModelCustom yourModel;
    
    public RenderModel() {
    yourModel = AdvancedModelLoader.loadModel("[path to your model]");
    }
    
    @Override
    public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
    if(modelID == [your moder render ID]) {
    Icon c = block.getIcon(0, 0);
    WavefrontObject wfo = getWFO(meta);
    GroupObject go = getGroupObjectFromWFO(wfo);
    
    Tessellator tes = Tessellator.instance;
    tes.addTranslation(x, y, z);
    for(Face f : go.faces) {
    tes.setNormal(f.faceNormal.x, f.faceNormal.y, f.faceNormal.z);
    for(int i = 0; i < f.vertices.length; i++) {
    Vertex v = f.vertices*;
    TextureCoordinate t = f.textureCoordinates*;
    tes.addVertexWithUV(v.x, v.y, v.z,
    c.getInterpolatedU(t.u * 16),
    c.getInterpolatedV(t.v * 16));
    }
    }
    tes.addTranslation(-x, -y, -z);
    }
    return true;
    }
    
    private GroupObject getGroupObjectFromWFO(WavefrontObject wfo) {
    GroupObject goReturn = new GroupObject();
    for(GroupObject go : wfo.groupObjects) {
    goReturn.faces.addAll(go.faces);
    }
    return goReturn;
    }
    
    private WavefrontObject getWFO(int meta) {
    return (WavefrontObject) yourModel;
    }
    
    @Override
    public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
    // TODO Auto-generated method stub
    }
    
    @Override
    public boolean shouldRender3DInInventory() {
    // TODO Auto-generated method stub
    return false;
    }
    
    @Override
    public int getRenderId() {
    // TODO Auto-generated method stub
    return 0;
    }
    }
    

    Celui ci ne fait pas crash mais je ne vois pas le model quand je pose le bloc,peut etre car il ne y a aucun chemin vers une texture.

    Et j ai aussi essayer de faire comme sur le wiki de forge mais sa crash quand je pose le bloc.


  • Moddeurs confirmés Rédacteurs Administrateurs

    Tu peux envoyer le crash lorsque tu fais comme sur le wiki de forge ?



  • Il me met sa:

    2014-08-08 19:14:40 [Infos] [STDERR] java.lang.IllegalStateException: Already tesselating!
    2014-08-08 19:14:40 [Infos] [STDERR] at net.minecraft.client.renderer.Tessellator.startDrawing(Tessellator.java:343)
    2014-08-08 19:14:40 [Infos] [STDERR] at net.minecraftforge.client.model.obj.WavefrontObject.renderAll(WavefrontObject.java:179)
    2014-08-08 19:14:40 [Infos] [STDERR] at modCrafttech.proxy.Sale.renderWorldBlock(Sale.java:44)
    2014-08-08 19:14:40 [Infos] [STDERR] at cpw.mods.fml.client.registry.RenderingRegistry.renderWorldBlock(RenderingRegistry.java:152)
    2014-08-08 19:14:40 [Infos] [STDERR] at net.minecraft.src.FMLRenderAccessLibrary.renderWorldBlock(FMLRenderAccessLibrary.java:57)
    2014-08-08 19:14:41 [Infos] [STDERR] at net.minecraft.client.renderer.RenderBlocks.renderBlockByRenderType(RenderBlocks.java:485)
    2014-08-08 19:14:41 [Infos] [STDERR] at net.minecraft.client.renderer.WorldRenderer.updateRenderer(WorldRenderer.java:224)
    2014-08-08 19:14:41 [Infos] [STDERR] at net.minecraft.client.renderer.RenderGlobal.updateRenderers(RenderGlobal.java:1551)
    2014-08-08 19:14:41 [Infos] [STDERR] at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1129)
    2014-08-08 19:14:41 [Infos] [STDERR] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1006)
    2014-08-08 19:14:41 [Infos] [STDERR] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:946)
    2014-08-08 19:14:41 [Infos] [STDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:838)
    2014-08-08 19:14:41 [Infos] [STDERR] at net.minecraft.client.main.Main.main(Main.java:93)
    2014-08-08 19:14:41 [Infos] [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2014-08-08 19:14:41 [Infos] [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    2014-08-08 19:14:41 [Infos] [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    2014-08-08 19:14:41 [Infos] [STDERR] at java.lang.reflect.Method.invoke(Unknown Source)
    2014-08-08 19:14:41 [Infos] [STDERR] at net.minecraft.launchwrapper.Launch.launch(Launch.java:131)
    2014-08-08 19:14:41 [Infos] [STDERR] at net.minecraft.launchwrapper.Launch.main(Launch.java:27)
    2014-08-08 19:14:41 [Infos] [STDOUT] –-- Minecraft Crash Report ----
    2014-08-08 19:14:41 [Infos] [STDOUT] // There are four lights!
    2014-08-08 19:14:41 [Infos] [STDOUT]
    2014-08-08 19:14:41 [Infos] [STDOUT] Time: 08/08/14 19:14
    2014-08-08 19:14:41 [Infos] [STDOUT] Description: Unexpected error
    2014-08-08 19:14:41 [Infos] [STDOUT]
    2014-08-08 19:14:41 [Infos] [STDOUT] java.lang.IllegalStateException: Already tesselating!
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.client.renderer.Tessellator.startDrawing(Tessellator.java:343)
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraftforge.client.model.obj.WavefrontObject.renderAll(WavefrontObject.java:179)
    2014-08-08 19:14:41 [Infos] [STDOUT] at modCrafttech.proxy.Sale.renderWorldBlock(Sale.java:44)
    2014-08-08 19:14:41 [Infos] [STDOUT] at cpw.mods.fml.client.registry.RenderingRegistry.renderWorldBlock(RenderingRegistry.java:152)
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.src.FMLRenderAccessLibrary.renderWorldBlock(FMLRenderAccessLibrary.java:57)
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.client.renderer.RenderBlocks.renderBlockByRenderType(RenderBlocks.java:485)
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.client.renderer.WorldRenderer.updateRenderer(WorldRenderer.java:224)
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.client.renderer.RenderGlobal.updateRenderers(RenderGlobal.java:1551)
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1129)
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1006)
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:946)
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.client.Minecraft.run(Minecraft.java:838)
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.client.main.Main.main(Main.java:93)
    2014-08-08 19:14:41 [Infos] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2014-08-08 19:14:41 [Infos] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    2014-08-08 19:14:41 [Infos] [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    2014-08-08 19:14:41 [Infos] [STDOUT] at java.lang.reflect.Method.invoke(Unknown Source)
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.launchwrapper.Launch.launch(Launch.java:131)
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.launchwrapper.Launch.main(Launch.java:27)
    2014-08-08 19:14:41 [Infos] [STDOUT]
    2014-08-08 19:14:41 [Infos] [STDOUT]
    2014-08-08 19:14:41 [Infos] [STDOUT] A detailed walkthrough of the error, its code path and all known details is as follows:
    2014-08-08 19:14:41 [Infos] [STDOUT] –-------------------------------------------------------------------------------------
    2014-08-08 19:14:41 [Infos] [STDOUT]
    2014-08-08 19:14:41 [Infos] [STDOUT] – Head --
    2014-08-08 19:14:41 [Infos] [STDOUT] Stacktrace:
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.client.renderer.Tessellator.startDrawing(Tessellator.java:343)
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraftforge.client.model.obj.WavefrontObject.renderAll(WavefrontObject.java:179)
    2014-08-08 19:14:41 [Infos] [STDOUT] at modCrafttech.proxy.Sale.renderWorldBlock(Sale.java:44)
    2014-08-08 19:14:41 [Infos] [STDOUT] at cpw.mods.fml.client.registry.RenderingRegistry.renderWorldBlock(RenderingRegistry.java:152)
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.src.FMLRenderAccessLibrary.renderWorldBlock(FMLRenderAccessLibrary.java:57)
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.client.renderer.RenderBlocks.renderBlockByRenderType(RenderBlocks.java:485)
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.client.renderer.WorldRenderer.updateRenderer(WorldRenderer.java:224)
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.client.renderer.RenderGlobal.updateRenderers(RenderGlobal.java:1551)
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1129)
    2014-08-08 19:14:41 [Infos] [STDOUT]
    2014-08-08 19:14:41 [Infos] [STDOUT] – Affected level --
    2014-08-08 19:14:41 [Infos] [STDOUT] Details:
    2014-08-08 19:14:41 [Infos] [STDOUT] Level name: MpServer
    2014-08-08 19:14:41 [Infos] [STDOUT] All players: 1 total; [EntityClientPlayerMP['Player367'/6, l='MpServer', x=1066,15, y=5,62, z=954,49]]
    2014-08-08 19:14:41 [Infos] [STDOUT] Chunk stats: MultiplayerChunkCache: 441
    2014-08-08 19:14:41 [Infos] [STDOUT] Level seed: 0
    2014-08-08 19:14:41 [Infos] [STDOUT] Level generator: ID 01 - flat, ver 0\. Features enabled: false
    2014-08-08 19:14:41 [Infos] [STDOUT] Level generator options:
    2014-08-08 19:14:41 [Infos] [STDOUT] Level spawn location: World: (1067,4,958), Chunk: (at 11,0,14 in 66,59; contains blocks 1056,0,944 to 1071,255,959), Region: (2,1; contains chunks 64,32 to 95,63, blocks 1024,0,512 to 1535,255,1023)
    2014-08-08 19:14:41 [Infos] [STDOUT] Level time: 162 game time, 162 day time
    2014-08-08 19:14:41 [Infos] [STDOUT] Level dimension: 0
    2014-08-08 19:14:41 [Infos] [STDOUT] Level storage version: 0x00000 - Unknown?
    2014-08-08 19:14:41 [Infos] [STDOUT] Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
    2014-08-08 19:14:41 [Infos] [STDOUT] Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
    2014-08-08 19:14:41 [Infos] [STDOUT] Forced entities: 1 total; [EntityClientPlayerMP['Player367'/6, l='MpServer', x=1066,15, y=5,62, z=954,49]]
    2014-08-08 19:14:41 [Infos] [STDOUT] Retry entities: 0 total; []
    2014-08-08 19:14:41 [Infos] [STDOUT] Server brand: fml,forge
    2014-08-08 19:14:41 [Infos] [STDOUT] Server type: Integrated singleplayer server
    2014-08-08 19:14:41 [Infos] [STDOUT] Stacktrace:
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:440)
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2312)
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.client.Minecraft.run(Minecraft.java:863)
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.client.main.Main.main(Main.java:93)
    2014-08-08 19:14:41 [Infos] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2014-08-08 19:14:41 [Infos] [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    2014-08-08 19:14:41 [Infos] [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    2014-08-08 19:14:41 [Infos] [STDOUT] at java.lang.reflect.Method.invoke(Unknown Source)
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.launchwrapper.Launch.launch(Launch.java:131)
    2014-08-08 19:14:41 [Infos] [STDOUT] at net.minecraft.launchwrapper.Launch.main(Launch.java:27)
    2014-08-08 19:14:41 [Infos] [STDOUT]
    

  • Moddeurs confirmés Modérateurs

    ligne 44 de modCrafttech.proxy.Sale.renderWorldBlock?



  • myModel.renderAll();
    

  • Moddeurs confirmés Rédacteurs Administrateurs

    En effet, on ne peut pas passer par les ISBRH avec model.renderAll(), ça fait la même erreur qu'avec un bloc techne.
    Du-coup je ne sais pas 😕



  • Je pence avoir trouvé, le tessellator et la solution ! 🙂


Log in to reply