Ну и как же?Dragon2488 написал(а):Так же как и везде, только без глубины.
С чего ты взял такую глупость? Майн в инвентаре рисует именно блок. В атласе иконок блоков нет.Salamandr написал(а):ну зайди в этот метод, ты там был?
и что там видно? он рисует 3д модель или блок?
- нет, не рисует, он рисует иконку блока, которая заранее отрисована в атласе.
А иконка сама по себе уже плоская вещь, и тебе её не повернуть.
Рисуй блок сам и будет он в том виде, что надо тебе.
добрые дяди подскажут формулы для поворота tesselator
а я по прежнему буду настаивать на голом OpenGL
svk написал(а):Лучше расскажите как это сделать : )
package xxxmod.models;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
/**
* table - Undefined
* Created using Tabula 4.1.1
*/
public class ModelTable1 extends ModelBase {
public ModelRenderer shape1;
public ModelRenderer shape2;
public ModelRenderer shape3;
public ModelRenderer shape4;
public ModelRenderer shape5;
public ModelRenderer center;
public ModelTable1() {
this.textureWidth = 64;
this.textureHeight = 32;
center = new ModelRenderer(this, 0, 0);
center.setRotationPoint(-1.0f, -1.0f, -1.0f);
center.addBox(0.0f, 0.0f, 0.0f, 2, 2, 2, 0.0f);
this.shape3 = new ModelRenderer(this, 0, 0);
this.shape3.setRotationPoint(-8.0F, 8.0F, 7.0F);
this.shape3.addBox(0.0F, 0.0F, 0.0F, 1, 16, 1, 0.0F);
this.shape5 = new ModelRenderer(this, 0, 0);
this.shape5.setRotationPoint(-8.0F, 8.0F, -8.0F);
this.shape5.addBox(0.0F, 0.0F, 0.0F, 1, 16, 1, 0.0F);
this.shape2 = new ModelRenderer(this, 0, 0);
this.shape2.setRotationPoint(6.0F, 8.0F, 7.0F);
this.shape2.addBox(1.0F, 0.0F, 0.0F, 1, 16, 1, 0.0F);
this.shape1 = new ModelRenderer(this, 0, 0);
this.shape1.setRotationPoint(-8.0F, 8.0F, -8.0F);
this.shape1.addBox(0.0F, 0.0F, 0.0F, 16, 1, 16, 0.0F);
this.shape4 = new ModelRenderer(this, 0, 0);
this.shape4.setRotationPoint(7.0F, 8.0F, -8.0F);
this.shape4.addBox(0.0F, 0.0F, 0.0F, 1, 16, 1, 0.0F);
}
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
center.render(f5);
this.shape3.render(f5);
this.shape5.render(f5);
this.shape2.render(f5);
this.shape1.render(f5);
this.shape4.render(f5);
}
/**
* This is a helper function from Tabula to set the rotation of model parts
*/
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float var8){
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5f, (float) y + 1.0f , (float) z + 0.5f);
if (rotAngle<360f){
rotAngle += 1f;
} else rotAngle = 0.0f;
GL11.glRotatef(rotAngle, 0f, 0f, 1f);
this.bindTexture(texture);
table.render(null, 0f, 0f, 0f, 0f, 0f, 0.0625f);
GL11.glPopMatrix();
}
И что за это отвечает?BlackCrafter написал(а):модель:
рендер:Код:package xxxmod.models; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; /** * table - Undefined * Created using Tabula 4.1.1 */ public class ModelTable1 extends ModelBase { public ModelRenderer shape1; public ModelRenderer shape2; public ModelRenderer shape3; public ModelRenderer shape4; public ModelRenderer shape5; public ModelRenderer center; public ModelTable1() { this.textureWidth = 64; this.textureHeight = 32; center = new ModelRenderer(this, 0, 0); center.setRotationPoint(-1.0f, -1.0f, -1.0f); center.addBox(0.0f, 0.0f, 0.0f, 2, 2, 2, 0.0f); this.shape3 = new ModelRenderer(this, 0, 0); this.shape3.setRotationPoint(-8.0F, 8.0F, 7.0F); this.shape3.addBox(0.0F, 0.0F, 0.0F, 1, 16, 1, 0.0F); this.shape5 = new ModelRenderer(this, 0, 0); this.shape5.setRotationPoint(-8.0F, 8.0F, -8.0F); this.shape5.addBox(0.0F, 0.0F, 0.0F, 1, 16, 1, 0.0F); this.shape2 = new ModelRenderer(this, 0, 0); this.shape2.setRotationPoint(6.0F, 8.0F, 7.0F); this.shape2.addBox(1.0F, 0.0F, 0.0F, 1, 16, 1, 0.0F); this.shape1 = new ModelRenderer(this, 0, 0); this.shape1.setRotationPoint(-8.0F, 8.0F, -8.0F); this.shape1.addBox(0.0F, 0.0F, 0.0F, 16, 1, 16, 0.0F); this.shape4 = new ModelRenderer(this, 0, 0); this.shape4.setRotationPoint(7.0F, 8.0F, -8.0F); this.shape4.addBox(0.0F, 0.0F, 0.0F, 1, 16, 1, 0.0F); } @Override public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { center.render(f5); this.shape3.render(f5); this.shape5.render(f5); this.shape2.render(f5); this.shape1.render(f5); this.shape4.render(f5); } /** * This is a helper function from Tabula to set the rotation of model parts */ public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { modelRenderer.rotateAngleX = x; modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; } }
результат:Код:@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float var8){ GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.5f, (float) y + 1.0f , (float) z + 0.5f); if (rotAngle<360f){ rotAngle += 1f; } else rotAngle = 0.0f; GL11.glRotatef(rotAngle, 0f, 0f, 1f); this.bindTexture(texture); table.render(null, 0f, 0f, 0f, 0f, 0f, 0.0625f); GL11.glPopMatrix(); }
стол вращается вокруг кубика.
всмысле?svk написал(а):И что за это отвечает?
Ну дыsvk написал(а):В прямом, я не вижу кода, который фиксирует центр вращения на кубике.
Это что-ли?
Код:public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { modelRenderer.rotateAngleX = x; modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; }
Центр вращения по-дефолту находится в точке 0,0,0. Кубик находится как-раз в этой точке. Каким кодом можно "зафиксировать" центр вращения в нужном месте?svk написал(а):В прямом, я не вижу кода, который фиксирует центр вращения на кубике.
Не знаешь - не советуй. Как минимум, obj формат неэффективный.Vova_master написал(а):Хм. А почему бы не сделать obj? Дело конечно не мое, но все же. И потом, нафига делать не в центре?
Давай представим, что ты не создавал никакую тему полгода назад, тебе там никто не отвечал и ты не пытался гуглить.BlackCrafter написал(а):Я так понимаю, проблема не решаема?
Если создал модель не в центре, иди кури?
glPushMatrix();
glRotatef(angle++, 0, 1, 0);
mesh.render();
glPopMatrix();
glPushMatrix();
glRotatef(angle++, 0, 1, 0); //потом это
glTranslatef(-0.5f, 0, -0.5f); //сначала это применится
mesh.render();
glPopMatrix();
glPushMatrix();
glTranslatef(0.5f, 0, 0.5f); //последняя трансформация
glRotatef(angle++, 0, 1, 0);
glTranslatef(-0.5f, 0, -0.5f);
mesh.render();
glPopMatrix();