Added missing file headers
This commit is contained in:
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
|
||||
@@ -73,7 +91,8 @@ class CableBuilder
|
||||
static ResourceLocation getConnectionTexture( AECableType cableType, AEColor color )
|
||||
{
|
||||
String textureFolder;
|
||||
switch (cableType) {
|
||||
switch( cableType )
|
||||
{
|
||||
case GLASS:
|
||||
textureFolder = "parts/cable/glass/";
|
||||
break;
|
||||
@@ -275,8 +294,6 @@ class CableBuilder
|
||||
|
||||
addStraightCoveredCableSizedCube( facing, cubeBuilder );
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static void setStraightCableUVs( CubeBuilder cubeBuilder, EnumFacing facing, int x, int y )
|
||||
@@ -374,8 +391,11 @@ class CableBuilder
|
||||
cubeBuilder.setColorRGB( cableColor.whiteVariant );
|
||||
addCoveredCableSizedCube( facing, cubeBuilder );
|
||||
|
||||
/* TODO: this.setSmartConnectionRotations( of, renderer );
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;*/
|
||||
/*
|
||||
* TODO: this.setSmartConnectionRotations( of, renderer );
|
||||
* renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth =
|
||||
* renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
*/
|
||||
}
|
||||
|
||||
public void addStraightSmartConnection( EnumFacing facing, AEColor cableColor, int channels, List<BakedQuad> quadsOut )
|
||||
@@ -460,7 +480,7 @@ class CableBuilder
|
||||
addDenseCableSizedCube( facing, cubeBuilder );
|
||||
|
||||
// Dense cables show used channels in groups of 4, rounded up
|
||||
channels = (channels + 3) / 4;
|
||||
channels = ( channels + 3 ) / 4;
|
||||
|
||||
TextureAtlasSprite oddChannel = smartCableTextures.getOddTextureForChannels( channels );
|
||||
TextureAtlasSprite evenChannel = smartCableTextures.getEvenTextureForChannels( channels );
|
||||
@@ -494,7 +514,7 @@ class CableBuilder
|
||||
addStraightDenseCableSizedCube( facing, cubeBuilder );
|
||||
|
||||
// Dense cables show used channels in groups of 4, rounded up
|
||||
channels = (channels + 3) / 4;
|
||||
channels = ( channels + 3 ) / 4;
|
||||
|
||||
TextureAtlasSprite oddChannel = smartCableTextures.getOddTextureForChannels( channels );
|
||||
TextureAtlasSprite evenChannel = smartCableTextures.getEvenTextureForChannels( channels );
|
||||
@@ -511,7 +531,6 @@ class CableBuilder
|
||||
addStraightDenseCableSizedCube( facing, cubeBuilder );
|
||||
}
|
||||
|
||||
|
||||
private static void addDenseCableSizedCube( EnumFacing facing, CubeBuilder cubeBuilder )
|
||||
{
|
||||
switch( facing )
|
||||
@@ -537,7 +556,8 @@ class CableBuilder
|
||||
}
|
||||
}
|
||||
|
||||
// Adds a cube to the given cube builder that has the size of a dense cable connection and spans the entire block for the given direction
|
||||
// Adds a cube to the given cube builder that has the size of a dense cable connection and spans the entire block
|
||||
// for the given direction
|
||||
private static void addStraightDenseCableSizedCube( EnumFacing facing, CubeBuilder cubeBuilder )
|
||||
{
|
||||
switch( facing )
|
||||
@@ -548,8 +568,10 @@ class CableBuilder
|
||||
break;
|
||||
case EAST:
|
||||
case WEST:
|
||||
/*renderer.uvRotateEast = renderer.uvRotateWest = 1;
|
||||
renderer.uvRotateBottom = renderer.uvRotateTop = 1;*/
|
||||
/*
|
||||
* renderer.uvRotateEast = renderer.uvRotateWest = 1;
|
||||
* renderer.uvRotateBottom = renderer.uvRotateTop = 1;
|
||||
*/
|
||||
cubeBuilder.addCube( 0, 3, 3, 16, 13, 13 );
|
||||
break;
|
||||
case NORTH:
|
||||
@@ -560,7 +582,8 @@ class CableBuilder
|
||||
}
|
||||
}
|
||||
|
||||
// Adds a cube to the given cube builder that has the size of a covered cable connection from the core of the cable to the given face
|
||||
// Adds a cube to the given cube builder that has the size of a covered cable connection from the core of the cable
|
||||
// to the given face
|
||||
private static void addCoveredCableSizedCube( EnumFacing facing, CubeBuilder cubeBuilder )
|
||||
{
|
||||
switch( facing )
|
||||
@@ -586,7 +609,8 @@ class CableBuilder
|
||||
}
|
||||
}
|
||||
|
||||
// Adds a cube to the given cube builder that has the size of a covered cable connection and spans the entire block for the given direction
|
||||
// Adds a cube to the given cube builder that has the size of a covered cable connection and spans the entire block
|
||||
// for the given direction
|
||||
private static void addStraightCoveredCableSizedCube( EnumFacing facing, CubeBuilder cubeBuilder )
|
||||
{
|
||||
switch( facing )
|
||||
@@ -597,8 +621,10 @@ class CableBuilder
|
||||
break;
|
||||
case EAST:
|
||||
case WEST:
|
||||
/*renderer.uvRotateEast = renderer.uvRotateWest = 1;
|
||||
renderer.uvRotateBottom = renderer.uvRotateTop = 1;*/
|
||||
/*
|
||||
* renderer.uvRotateEast = renderer.uvRotateWest = 1;
|
||||
* renderer.uvRotateBottom = renderer.uvRotateTop = 1;
|
||||
*/
|
||||
cubeBuilder.addCube( 0, 5, 5, 16, 11, 11 );
|
||||
break;
|
||||
case NORTH:
|
||||
@@ -635,8 +661,10 @@ class CableBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* This renders a slightly bigger covered cable connection to the specified side. This is used to connect cable cores with adjacent machines
|
||||
* that do not want to be connected to using a glass cable connection. This applies to most machines (interfaces, etc.)
|
||||
* This renders a slightly bigger covered cable connection to the specified side. This is used to connect cable
|
||||
* cores with adjacent machines
|
||||
* that do not want to be connected to using a glass cable connection. This applies to most machines (interfaces,
|
||||
* etc.)
|
||||
*/
|
||||
private void addBigCoveredCableSizedCube( EnumFacing facing, CubeBuilder cubeBuilder )
|
||||
{
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
|
||||
@@ -82,7 +100,6 @@ public class CableBusBakedModel implements IBakedModel
|
||||
return quads;
|
||||
}
|
||||
|
||||
|
||||
// Determines whether a cable is connected to exactly two sides that are opposite each other
|
||||
private static boolean isStraightLine( Set<EnumFacing> sides )
|
||||
{
|
||||
@@ -121,7 +138,8 @@ public class CableBusBakedModel implements IBakedModel
|
||||
{
|
||||
EnumFacing facing = connectionTypes.keySet().iterator().next();
|
||||
|
||||
switch (cableType) {
|
||||
switch( cableType )
|
||||
{
|
||||
case GLASS:
|
||||
cableBuilder.addStraightGlassConnection( facing, cableColor, quadsOut );
|
||||
break;
|
||||
@@ -129,10 +147,10 @@ public class CableBusBakedModel implements IBakedModel
|
||||
cableBuilder.addStraightCoveredConnection( facing, cableColor, quadsOut );
|
||||
break;
|
||||
case SMART:
|
||||
cableBuilder.addStraightSmartConnection( facing, cableColor, renderState.getChannelsOnSide().get(facing), quadsOut );
|
||||
cableBuilder.addStraightSmartConnection( facing, cableColor, renderState.getChannelsOnSide().get( facing ), quadsOut );
|
||||
break;
|
||||
case DENSE:
|
||||
cableBuilder.addStraightDenseConnection( facing, cableColor, renderState.getChannelsOnSide().get(facing), quadsOut );
|
||||
cableBuilder.addStraightDenseConnection( facing, cableColor, renderState.getChannelsOnSide().get( facing ), quadsOut );
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
|
||||
@@ -56,10 +74,7 @@ public class CableBusModel implements IModel
|
||||
return new CableBusBakedModel( cableBuilder, partModels );
|
||||
}
|
||||
|
||||
private Map<ResourceLocation, IBakedModel> loadPartModels(
|
||||
IModelState state,
|
||||
VertexFormat format,
|
||||
Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
|
||||
private Map<ResourceLocation, IBakedModel> loadPartModels( IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
|
||||
{
|
||||
ImmutableMap.Builder<ResourceLocation, IBakedModel> result = ImmutableMap.builder();
|
||||
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
|
||||
@@ -30,8 +48,10 @@ public class CableBusRenderState
|
||||
// Describes the outgoing connections of this cable bus to other blocks, and how they should be rendered
|
||||
private EnumMap<EnumFacing, AECableType> connectionTypes = new EnumMap<>( EnumFacing.class );
|
||||
|
||||
// Indicate on which sides signified by connectionTypes above, there is another cable bus. If a side is connected, but it is absent from this
|
||||
// set, then it means that there is a Grid host, but not a cable bus on that side (i.e. an interface, a controller, etc.)
|
||||
// Indicate on which sides signified by connectionTypes above, there is another cable bus. If a side is connected,
|
||||
// but it is absent from this
|
||||
// set, then it means that there is a Grid host, but not a cable bus on that side (i.e. an interface, a controller,
|
||||
// etc.)
|
||||
private EnumSet<EnumFacing> cableBusAdjacent = EnumSet.noneOf( EnumFacing.class );
|
||||
|
||||
// Specifies the number of channels used for the connection to a given side. Only contains entries if
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
|
||||
@@ -22,9 +40,7 @@ import appeng.core.AppEng;
|
||||
*/
|
||||
public enum CableCoreType
|
||||
{
|
||||
GLASS( "parts/cable/core/glass" ),
|
||||
COVERED( "parts/cable/core/covered" ),
|
||||
DENSE( "parts/cable/core/dense" );
|
||||
GLASS( "parts/cable/core/glass" ), COVERED( "parts/cable/core/covered" ), DENSE( "parts/cable/core/dense" );
|
||||
|
||||
private static final Map<AECableType, CableCoreType> cableMapping = generateCableMapping();
|
||||
|
||||
@@ -52,7 +68,8 @@ public enum CableCoreType
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The type of core that should be rendered when the given cable isn't straight and needs to have a core to attach connections to.
|
||||
* @return The type of core that should be rendered when the given cable isn't straight and needs to have a core to
|
||||
* attach connections to.
|
||||
* Is null for the NULL cable.
|
||||
*/
|
||||
public static CableCoreType fromCableType( AECableType cableType )
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
|
||||
@@ -60,7 +78,8 @@ public class CubeBuilder
|
||||
y2 /= 16.0f;
|
||||
z2 /= 16.0f;
|
||||
|
||||
// If brightness is forced to specific values, extend the vertex format to contain the multi-texturing lightmap offset
|
||||
// If brightness is forced to specific values, extend the vertex format to contain the multi-texturing lightmap
|
||||
// offset
|
||||
VertexFormat savedFormat = null;
|
||||
if( renderFullBright )
|
||||
{
|
||||
@@ -92,10 +111,7 @@ public class CubeBuilder
|
||||
float v2;
|
||||
}
|
||||
|
||||
private void putFace( EnumFacing face,
|
||||
float x1, float y1, float z1,
|
||||
float x2, float y2, float z2
|
||||
)
|
||||
private void putFace( EnumFacing face, float x1, float y1, float z1, float x2, float y2, float z2 )
|
||||
{
|
||||
|
||||
TextureAtlasSprite texture = textures.get( face );
|
||||
@@ -164,9 +180,7 @@ public class CubeBuilder
|
||||
output.add( new BakedQuad( vertexData, -1, face, texture, true, format ) );
|
||||
}
|
||||
|
||||
private UvVector getDefaultUv( EnumFacing face, TextureAtlasSprite texture,
|
||||
float x1, float y1, float z1,
|
||||
float x2, float y2, float z2 )
|
||||
private UvVector getDefaultUv( EnumFacing face, TextureAtlasSprite texture, float x1, float y1, float z1, float x2, float y2, float z2 )
|
||||
{
|
||||
|
||||
UvVector uv = new UvVector();
|
||||
@@ -219,7 +233,8 @@ public class CubeBuilder
|
||||
{
|
||||
float u, v;
|
||||
|
||||
switch (uvRotations[face.ordinal()]) {
|
||||
switch( uvRotations[face.ordinal()] )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
u = uv.u1;
|
||||
@@ -239,7 +254,7 @@ public class CubeBuilder
|
||||
break;
|
||||
}
|
||||
|
||||
putVertex(builder, face, x, y, z, u, v );
|
||||
putVertex( builder, face, x, y, z, u, v );
|
||||
}
|
||||
|
||||
// uv.u2, uv.v1
|
||||
@@ -248,7 +263,8 @@ public class CubeBuilder
|
||||
float u;
|
||||
float v;
|
||||
|
||||
switch (uvRotations[face.ordinal()]) {
|
||||
switch( uvRotations[face.ordinal()] )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
u = uv.u2;
|
||||
@@ -267,7 +283,7 @@ public class CubeBuilder
|
||||
v = uv.v2;
|
||||
break;
|
||||
}
|
||||
putVertex(builder, face, x, y, z, u, v );
|
||||
putVertex( builder, face, x, y, z, u, v );
|
||||
}
|
||||
|
||||
// uv.u2, uv.v2
|
||||
@@ -277,7 +293,8 @@ public class CubeBuilder
|
||||
float u;
|
||||
float v;
|
||||
|
||||
switch (uvRotations[face.ordinal()]) {
|
||||
switch( uvRotations[face.ordinal()] )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
u = uv.u2;
|
||||
@@ -297,7 +314,7 @@ public class CubeBuilder
|
||||
break;
|
||||
}
|
||||
|
||||
putVertex(builder, face, x, y, z, u, v );
|
||||
putVertex( builder, face, x, y, z, u, v );
|
||||
}
|
||||
|
||||
// uv.u1, uv.v2
|
||||
@@ -307,7 +324,8 @@ public class CubeBuilder
|
||||
float u;
|
||||
float v;
|
||||
|
||||
switch (uvRotations[face.ordinal()]) {
|
||||
switch( uvRotations[face.ordinal()] )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
u = uv.u1;
|
||||
@@ -327,7 +345,7 @@ public class CubeBuilder
|
||||
break;
|
||||
}
|
||||
|
||||
putVertex(builder, face, x, y, z, u, v );
|
||||
putVertex( builder, face, x, y, z, u, v );
|
||||
}
|
||||
|
||||
private void putVertex( UnpackedBakedQuad.Builder builder, EnumFacing face, float x, float y, float z, float u, float v )
|
||||
@@ -343,10 +361,7 @@ public class CubeBuilder
|
||||
builder.put( i, x, y, z );
|
||||
break;
|
||||
case NORMAL:
|
||||
builder.put( i,
|
||||
face.getFrontOffsetX(),
|
||||
face.getFrontOffsetY(),
|
||||
face.getFrontOffsetZ() );
|
||||
builder.put( i, face.getFrontOffsetX(), face.getFrontOffsetY(), face.getFrontOffsetZ() );
|
||||
break;
|
||||
case COLOR:
|
||||
// Color format is RGBA
|
||||
@@ -425,9 +440,12 @@ public class CubeBuilder
|
||||
|
||||
public void setUvRotation( EnumFacing facing, int rotation )
|
||||
{
|
||||
if ( rotation == 2 ) {
|
||||
if( rotation == 2 )
|
||||
{
|
||||
rotation = 3;
|
||||
} else if ( rotation == 3 ) {
|
||||
}
|
||||
else if( rotation == 3 )
|
||||
{
|
||||
rotation = 2;
|
||||
}
|
||||
Preconditions.checkArgument( rotation >= 0 && rotation <= 3, "rotation" );
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
|
||||
@@ -17,7 +35,8 @@ import appeng.core.AELog;
|
||||
|
||||
|
||||
/**
|
||||
* Assuming a default-orientation of forward=NORTH and up=UP, this class rotates a given list of quads to the desired facing
|
||||
* Assuming a default-orientation of forward=NORTH and up=UP, this class rotates a given list of quads to the desired
|
||||
* facing
|
||||
*/
|
||||
public class QuadRotator
|
||||
{
|
||||
@@ -42,10 +61,14 @@ public class QuadRotator
|
||||
private BakedQuad rotateQuad( BakedQuad quad, EnumFacing forward, EnumFacing up )
|
||||
{
|
||||
// Sanitize forward/up
|
||||
if (forward.getAxis() == up.getAxis()) {
|
||||
if (up.getAxis() == EnumFacing.Axis.Y) {
|
||||
if( forward.getAxis() == up.getAxis() )
|
||||
{
|
||||
if( up.getAxis() == EnumFacing.Axis.Y )
|
||||
{
|
||||
up = EnumFacing.NORTH;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
up = EnumFacing.UP;
|
||||
}
|
||||
}
|
||||
@@ -77,11 +100,7 @@ public class QuadRotator
|
||||
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
Point3f pos = new Point3f(
|
||||
Float.intBitsToFloat( newData[i * stride + posIdx] ) - 0.5f,
|
||||
Float.intBitsToFloat( newData[i * stride + posIdx + 1] ) - 0.5f,
|
||||
Float.intBitsToFloat( newData[i * stride + posIdx + 2] ) - 0.5f
|
||||
);
|
||||
Point3f pos = new Point3f( Float.intBitsToFloat( newData[i * stride + posIdx] ) - 0.5f, Float.intBitsToFloat( newData[i * stride + posIdx + 1] ) - 0.5f, Float.intBitsToFloat( newData[i * stride + posIdx + 2] ) - 0.5f );
|
||||
|
||||
// Rotate stuff around
|
||||
mat.transform( pos );
|
||||
@@ -92,14 +111,11 @@ public class QuadRotator
|
||||
newData[i * stride + posIdx + 2] = Float.floatToIntBits( pos.getZ() + 0.5f );
|
||||
|
||||
// Transform the normal if one is present
|
||||
if ( normalIdx != -1 ) {
|
||||
if( normalIdx != -1 )
|
||||
{
|
||||
if( normalType == VertexFormatElement.EnumType.FLOAT )
|
||||
{
|
||||
Vector3f normal = new Vector3f(
|
||||
Float.intBitsToFloat( newData[i * stride + normalIdx] ),
|
||||
Float.intBitsToFloat( newData[i * stride + normalIdx + 1] ),
|
||||
Float.intBitsToFloat( newData[i * stride + normalIdx + 2] )
|
||||
);
|
||||
Vector3f normal = new Vector3f( Float.intBitsToFloat( newData[i * stride + normalIdx] ), Float.intBitsToFloat( newData[i * stride + normalIdx + 1] ), Float.intBitsToFloat( newData[i * stride + normalIdx + 2] ) );
|
||||
|
||||
// Rotate stuff around
|
||||
mat.transform( normal );
|
||||
@@ -145,7 +161,7 @@ public class QuadRotator
|
||||
int idx = offset / 4;
|
||||
int subOffset = offset % 4;
|
||||
int mask = 0xFF << ( subOffset * 8 );
|
||||
data[idx] = data[idx] & ( ~mask ) | ( (value & 0xFF) << (subOffset * 8) );
|
||||
data[idx] = data[idx] & ( ~mask ) | ( ( value & 0xFF ) << ( subOffset * 8 ) );
|
||||
}
|
||||
|
||||
private int findPositionOffset( VertexFormat format )
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
|
||||
@@ -17,17 +35,7 @@ import appeng.core.AppEng;
|
||||
public class SmartCableTextures
|
||||
{
|
||||
|
||||
public static final ResourceLocation[] SMART_CHANNELS_TEXTURES = {
|
||||
new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_00" ),
|
||||
new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_01" ),
|
||||
new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_02" ),
|
||||
new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_03" ),
|
||||
new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_04" ),
|
||||
new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_10" ),
|
||||
new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_11" ),
|
||||
new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_12" ),
|
||||
new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_13" ),
|
||||
new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_14" )
|
||||
public static final ResourceLocation[] SMART_CHANNELS_TEXTURES = { new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_00" ), new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_01" ), new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_02" ), new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_03" ), new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_04" ), new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_10" ), new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_11" ), new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_12" ), new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_13" ), new ResourceLocation( AppEng.MOD_ID, "parts/cable/smart/channels_14" )
|
||||
};
|
||||
|
||||
// Textures used to display channels on smart cables. There's two sets of 5 textures each, and
|
||||
@@ -36,9 +44,7 @@ public class SmartCableTextures
|
||||
|
||||
public SmartCableTextures( Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
|
||||
{
|
||||
textures = Arrays.stream( SMART_CHANNELS_TEXTURES )
|
||||
.map( bakedTextureGetter::apply )
|
||||
.toArray( TextureAtlasSprite[]::new );
|
||||
textures = Arrays.stream( SMART_CHANNELS_TEXTURES ).map( bakedTextureGetter::apply ).toArray( TextureAtlasSprite[]::new );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user