Package codechicken.lib.vec

Examples of codechicken.lib.vec.Vector3


        if(part == null)
            return false;

        if(world.isRemote && !player.isSneaking())//attempt to use block activated like normal and tell the server the right stuff
        {
            Vector3 f = new Vector3(hit.hitVec).add(-hit.blockX, -hit.blockY, -hit.blockZ);
            Block block = world.getBlock(hit.blockX, hit.blockY, hit.blockZ);
            if(!ignoreActivate(block) && block.onBlockActivated(world, hit.blockX, hit.blockY, hit.blockZ, player, hit.sideHit, (float)f.x, (float)f.y, (float)f.z))
            {
                player.swingItem();
                PacketCustom.sendToServer(new C08PacketPlayerBlockPlacement(
View Full Code Here


      e.getValue().computeLighting(LightModel.standardLightModel);
    }

    contents_models = CCModel.parseObjModels(MekanismUtils.getResource(ResourceType.MODEL, "transmitter_contents.obj"), 7, null);
    LightModel interiorLightModel = new LightModel()
        .setAmbient(new Vector3(0.6, 0.6, 0.6))
        .addLight(new Light(new Vector3(0.3, 1, -0.7))
            .setDiffuse(new Vector3(0.6, 0.6, 0.6)))
        .addLight(new Light(new Vector3(-0.3, 1, 0.7))
            .setDiffuse(new Vector3(0.6, 0.6, 0.6)));

    for(CCModel c : contents_models.values())
    {
      c.apply(new Translation(Vector3.center));
      c.computeLighting(interiorLightModel);
View Full Code Here

            side += 6;
        return computeO(vec, side);
    }

    public LC computeO(Vector3 vec, int side) {
        Vector3 v1 = Rotation.axes[((side & 0xE) + 3) % 6];
        Vector3 v2 = Rotation.axes[((side & 0xE) + 5) % 6];
        float d1 = (float) vec.scalarProject(v1);
        float d2 = 1 - d1;
        float d3 = (float) vec.scalarProject(v2);
        float d4 = 1 - d3;
        return set(side, d2 * d4, d2 * d3, d1 * d4, d1 * d3);
 
View Full Code Here

     * @param colour The pre-lighting vertex colour. RGBA format
     * @param normal The normal at the vertex
     * @return The lighting applied colour
     */
    public int apply(int colour, Vector3 normal) {
        Vector3 n_colour = ambient.copy();
        for (int l = 0; l < lightCount; l++) {
            Light light = lights[l];
            double n_l = light.position.dotProduct(normal);
            double f = n_l > 0 ? 1 : 0;
            n_colour.x += light.ambient.x + f * light.diffuse.x * n_l;
            n_colour.y += light.ambient.y + f * light.diffuse.y * n_l;
            n_colour.z += light.ambient.z + f * light.diffuse.z * n_l;
        }

        if (n_colour.x > 1)
            n_colour.x = 1;
        if (n_colour.y > 1)
            n_colour.y = 1;
        if (n_colour.z > 1)
            n_colour.z = 1;

        n_colour.multiply((colour >>> 24) / 255D, (colour >> 16 & 0xFF) / 255D, (colour >> 8 & 0xFF) / 255D);
        return (int) (n_colour.x * 255) << 24 | (int) (n_colour.y * 255) << 16 | (int) (n_colour.z * 255) << 8 | colour & 0xFF;
    }
View Full Code Here

    }
   
    private void traceSide(int side, Vector3 start, Vector3 end, Cuboid6 cuboid)
    {
        vec.set(start);
        Vector3 hit = null;
        switch(side)
        {
            case 0:
                hit = vec.XZintercept(end, cuboid.min.y);
                break;
View Full Code Here

            {
                double ry = hlen-y;
                if(ry > res)
                    ry = res;

                Vector3 dx1 = vectors[2].set(wide).multiply(x/wlen);
                Vector3 dx2 = vectors[3].set(wide).multiply((x+rx)/wlen);   
                Vector3 dy1 = vectors[4].set(high).multiply(y/hlen);   
                Vector3 dy2 = vectors[5].set(high).multiply((y+ry)/hlen);

                t.addVertexWithUV(base.x+dx1.x+dy2.x, base.y+dx1.y+dy2.y, base.z+dx1.z+dy2.z, u1, v2-ry/res*dv);
                t.addVertexWithUV(base.x+dx1.x+dy1.x, base.y+dx1.y+dy1.y, base.z+dx1.z+dy1.z, u1, v2);
                t.addVertexWithUV(base.x+dx2.x+dy1.x, base.y+dx2.y+dy1.y, base.z+dx2.z+dy1.z, u1+rx/res*du, v2);
                t.addVertexWithUV(base.x+dx2.x+dy2.x, base.y+dx2.y+dy2.y, base.z+dx2.z+dy2.z, u1+rx/res*du, v2-ry/res*dv);
 
View Full Code Here

            mop.typeOfHit = MovingObjectType.BLOCK;
            mop.blockX = pos.x;
            mop.blockY = pos.y;
            mop.blockZ = pos.z;
            if(block != null)
                c_cuboid.add(new Vector3(-pos.x, -pos.y, -pos.z)).setBlockBounds(block);
        }
        return mop;
    }
View Full Code Here

    }
   
    public static void renderFluidCuboid(Cuboid6 bound, IIcon tex, double res)
    {
        renderFluidQuad(//bottom
                new Vector3(bound.min.x, bound.min.y, bound.min.z),
                new Vector3(bound.max.x, bound.min.y, bound.min.z),
                new Vector3(bound.max.x, bound.min.y, bound.max.z),
                new Vector3(bound.min.x, bound.min.y, bound.max.z),
                tex, res);
        renderFluidQuad(//top
                new Vector3(bound.min.x, bound.max.y, bound.min.z),
                new Vector3(bound.min.x, bound.max.y, bound.max.z),
                new Vector3(bound.max.x, bound.max.y, bound.max.z),
                new Vector3(bound.max.x, bound.max.y, bound.min.z),
                tex, res);
        renderFluidQuad(//-x
                new Vector3(bound.min.x, bound.max.y, bound.min.z),
                new Vector3(bound.min.x, bound.min.y, bound.min.z),
                new Vector3(bound.min.x, bound.min.y, bound.max.z),
                new Vector3(bound.min.x, bound.max.y, bound.max.z),
                tex, res);
        renderFluidQuad(//+x
                new Vector3(bound.max.x, bound.max.y, bound.max.z),
                new Vector3(bound.max.x, bound.min.y, bound.max.z),
                new Vector3(bound.max.x, bound.min.y, bound.min.z),
                new Vector3(bound.max.x, bound.max.y, bound.min.z),
                tex, res);
        renderFluidQuad(//-z
                new Vector3(bound.max.x, bound.max.y, bound.min.z),
                new Vector3(bound.max.x, bound.min.y, bound.min.z),
                new Vector3(bound.min.x, bound.min.y, bound.min.z),
                new Vector3(bound.min.x, bound.max.y, bound.min.z),
                tex, res);
        renderFluidQuad(//+z
                new Vector3(bound.min.x, bound.max.y, bound.max.z),
                new Vector3(bound.min.x, bound.min.y, bound.max.z),
                new Vector3(bound.max.x, bound.min.y, bound.max.z),
                new Vector3(bound.max.x, bound.max.y, bound.max.z),
                tex, res);
    }
View Full Code Here

        }
       
        IIcon tex = prepareFluidRender(stack, alpha);
        CCRenderState.startDrawing();
        renderFluidQuad(
                new Vector3(rect.x, rect.y+rect.h, 0),
                new Vector3(rect.w,0, 0),
                new Vector3(0, -rect.h, 0), tex, res);
        CCRenderState.draw();
        postFluidRender();
    }
View Full Code Here

    public Vector3 vec;
    public UV uv;
   
    public Vertex5()
    {
        this(new Vector3(), new UV());
    }
View Full Code Here

TOP

Related Classes of codechicken.lib.vec.Vector3

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.