public void setStyle(int style) { if (characters.size() > 1) { throw new RuntimeException("Applicable only for single style font"); } Entry<IntMap<BitmapCharacter>> entry = characters.iterator().next(); IntMap<BitmapCharacter> charset = entry.getValue(); characters.remove(entry.getKey()); characters.put(style, charset); }
int hash2 = JoyAxisTrigger.joyAxisHash(joyId, axis, false); Float val1 = axisValues.get(hash1); Float val2 = axisValues.get(hash2); axisValues.remove(hash1); axisValues.remove(hash2); Float otherVal = axisValues.get(otherHash); if (otherVal != null && otherVal > effectiveDeadZone) { invokeActions(otherHash, false); axisValues.put(hash, -value); axisValues.remove(otherHash); } else { int hash = JoyAxisTrigger.joyAxisHash(joyId, axis, false); Float otherVal = axisValues.get(otherHash); if (otherVal != null && otherVal > effectiveDeadZone) { invokeActions(otherHash, false); axisValues.put(hash, value); axisValues.remove(otherHash);
IntMap<List<Integer>> indexBuffers = new IntMap<>(); for(int polygon = 0; polygon < materials.length; ++polygon) { int material = materials[polygon]; List<Integer> list = indexBuffers.get(material); if(list == null) { list = new ArrayList<>(); indexBuffers.put(material, list); list.add(polygon * 3 + 2); Iterator<Entry<List<Integer>>> iterator = indexBuffers.iterator(); while(iterator.hasNext()) { Entry<List<Integer>> e = iterator.next();
/** * Called by the Renderer when a texture has been set. * * @param image The image that was set * @param wasSwitched If true, the texture has required a state switch */ public void onTextureUse(Image image, boolean wasSwitched){ assert image.getId() >= 1; if( !enabled ) return; if (!texturesUsed.containsKey(image.getId())) texturesUsed.put(image.getId(), null); if (wasSwitched) numTextureBinds ++; }
IntMap<List<IrPolygon>> materialToPolyList = new IntMap<List<IrPolygon>>(); for (IrPolygon polygon : mesh.polygons) { int materialIndex = -1; List<IrPolygon> polyList = materialToPolyList.get(materialIndex); if (polyList == null) { polyList = new ArrayList<IrPolygon>(); materialToPolyList.put(materialIndex, polyList); IntMap<IrMesh> materialToMesh = new IntMap<IrMesh>(); for (IntMap.Entry<List<IrPolygon>> entry : materialToPolyList) { int key = entry.getKey(); newMesh.polygons = new IrPolygon[polygons.size()]; polygons.toArray(newMesh.polygons); materialToMesh.put(key, newMesh);
private void invokeTimedActions(int hash, long time, boolean pressed) { if (!bindings.containsKey(hash)) { return; } if (pressed) { pressedButtons.put(hash, time); } else { Long pressTimeObj = pressedButtons.remove(hash); if (pressTimeObj == null) { return; // under certain circumstances it can be null, ignore } // the event then. long pressTime = pressTimeObj; long lastUpdate = lastLastUpdateTime; long releaseTime = time; long timeDelta = releaseTime - Math.max(pressTime, lastUpdate); if (timeDelta > 0) { invokeAnalogs(hash, computeAnalogValue(timeDelta), false); } } }
public OggPage getOggPage(int index) throws IOException { return oggPages.get(index); }
IntMap<Mesh> jmeMeshes = new IntMap<Mesh>(); for (IntMap.Entry<IrMesh> irMeshEntry : irMeshes) { Mesh jmeMesh = IrUtils.convertIrMeshToJmeMesh(irMeshEntry.getValue()); jmeMeshes.put(irMeshEntry.getKey(), jmeMesh); if (jmeMeshes.size() == 0) { if (jmeMeshes.containsKey(-1) && jmeMeshes.size() > 1) { logger.log(Level.WARNING, "Mesh has polygons with no material " + "indices (unusual) - they will use material index 0.");
int numIndices = indexBuf.size(); IntMap<Integer> oldIndicesToNewIndices = new IntMap<>(numIndices); ArrayList<Integer> newIndicesToOldIndices = new ArrayList<>(); int newIndex = 0; int oldIndex = indexBuf.get(i); if (!oldIndicesToNewIndices.containsKey(oldIndex)) { oldIndicesToNewIndices.put(oldIndex, newIndex); newIndicesToOldIndices.add(oldIndex); newIndex = oldIndicesToNewIndices.get(oldIndex);
public static void handleSkinningBuffers(Mesh mesh, IntMap<GltfLoader.SkinBuffers> skinBuffers) { if (skinBuffers.size() > 0) { int length = skinBuffers.get(0).joints.length; short[] jointsArray = new short[length]; float[] weightsArray = new float[length]; for (int j = 0; j < skinBuffers.size(); j++) { GltfLoader.SkinBuffers buffs = skinBuffers.get(j); for (int k = 0; k < 4; k++) { weightData.add(new GltfLoader.WeightData(buffs.weights[i + k], buffs.joints[i + k], buffs.componentSize));
public void addKerning(int second, int amount){ kerning.put(second, amount); }
/** * Retrieves the statistics data into the given array. * The array should be as large as the array given in * {@link #getLabels() }. * * @param data The data array to write to */ public void getData(int[] data){ data[0] = numVertices; data[1] = numTriangles; data[2] = numUniformsSet; data[3] = numObjects; data[4] = numShaderSwitches; data[5] = shadersUsed.size(); data[6] = memoryShaders; data[7] = numTextureBinds; data[8] = texturesUsed.size(); data[9] = memoryTextures; data[10] = numFboSwitches; data[11] = fbosUsed.size(); data[12] = memoryFrameBuffers; }
private void invokeAnalogsAndActions(int hash, float value, float effectiveDeadZone, boolean applyTpf) { if (value < effectiveDeadZone) { invokeAnalogs(hash, value, !applyTpf); return; } ArrayList<Mapping> maps = bindings.get(hash); if (maps == null) { return; } boolean valueChanged = !axisValues.containsKey(hash); if (applyTpf) { value *= frameTPF; } int size = maps.size(); for (int i = size - 1; i >= 0; i--) { Mapping mapping = maps.get(i); ArrayList<InputListener> listeners = mapping.listeners; int listenerSize = listeners.size(); for (int j = listenerSize - 1; j >= 0; j--) { InputListener listener = listeners.get(j); if (listener instanceof ActionListener && valueChanged) { ((ActionListener) listener).onAction(mapping.name, true, frameTPF); } if (listener instanceof AnalogListener) { ((AnalogListener) listener).onAnalog(mapping.name, value, frameTPF); } } } }
/** * Unsets the {@link VertexBuffer} set on this mesh * with the given type. Does nothing if the vertex buffer type is not set * initially. * * @param type The buffer type to remove */ public void clearBuffer(VertexBuffer.Type type){ VertexBuffer vb = buffers.remove(type.ordinal()); if (vb != null){ buffersList.remove(vb); updateCounts(); } }
public BitmapCharacterSet() { characters = new IntMap<IntMap<BitmapCharacter>>(); }