com.jme3.scene.Geometry.isGrouped()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(109)

本文整理了Java中com.jme3.scene.Geometry.isGrouped()方法的一些代码示例,展示了Geometry.isGrouped()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.isGrouped()方法的具体详情如下:
包路径:com.jme3.scene.Geometry
类名称:Geometry
方法名:isGrouped

Geometry.isGrouped介绍

[英]Determine whether this Geometry is managed by a GeometryGroupNode or not.
[中]确定此Geometry是否由GeometryGroupNode管理。

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * @deprecated Use {@link #isGrouped()} instead.
 */
@Deprecated
public boolean isBatched() {
  return isGrouped();
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Sets the material to use for this geometry.
 *
 * @param material the material to use for this geometry
 */
@Override
public void setMaterial(Material material) {
  this.material = material;
  nbSimultaneousGPUMorph = -1;
  if (isGrouped()) {
    groupNode.onMaterialChange(this);
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Associate this <code>Geometry</code> with a {@link GeometryGroupNode}.
 *
 * Should only be called by the parent {@link GeometryGroupNode}.
 *
 * @param node Which {@link GeometryGroupNode} to associate with.
 * @param startIndex The starting index of this geometry in the group.
 */
public void associateWithGroupNode(GeometryGroupNode node, int startIndex) {
  if (isGrouped()) {
    unassociateFromGroupNode();
  }
  this.groupNode = node;
  this.startIndex = startIndex;
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
protected void setParent(Node parent) {
  super.setParent(parent);
  // If the geometry is managed by group node we need to unassociate.
  if (parent == null && isGrouped()) {
    unassociateFromGroupNode();
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
public boolean checkCulling(Camera cam) {
  if (isGrouped()) {
    setLastFrustumIntersection(Camera.FrustumIntersect.Outside);
    return false;
  }
  return super.checkCulling(cam);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Sets the mesh to use for this geometry when rendering.
 *
 * @param mesh the mesh to use for this geometry
 *
 * @throws IllegalArgumentException If mesh is null
 */
public void setMesh(Mesh mesh) {
  if (mesh == null) {
    throw new IllegalArgumentException();
  }
  this.mesh = mesh;
  setBoundRefresh();
  if (isGrouped()) {
    groupNode.onMeshChange(this);
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Sets the LOD level to use when rendering the mesh of this geometry.
 * Level 0 indicates that the default index buffer should be used,
 * levels [1, LodLevels + 1] represent the levels set on the mesh
 * with {@link Mesh#setLodLevels(com.jme3.scene.VertexBuffer[]) }.
 *
 * @param lod The lod level to set
 */
@Override
public void setLodLevel(int lod) {
  if (mesh.getNumLodLevels() == 0) {
    throw new IllegalStateException("LOD levels are not set on this mesh");
  }
  if (lod < 0 || lod >= mesh.getNumLodLevels()) {
    throw new IllegalArgumentException("LOD level is out of range: " + lod);
  }
  lodLevel = lod;
  if (isGrouped()) {
    groupNode.onMeshChange(this);
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * recursively visit the subgraph and unbatch geometries
 *
 * @param s
 */
private void unbatchSubGraph(Spatial s) {
  if (s instanceof Node) {
    for (Spatial sp : ((Node) s).getChildren()) {
      unbatchSubGraph(sp);
    }
  } else if (s instanceof Geometry) {
    Geometry g = (Geometry) s;
    if (g.isGrouped()) {
      g.unassociateFromGroupNode();
    }
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

private void ungroupSceneGraph(Spatial s) {
  if (s instanceof Node) {
    for (Spatial sp : ((Node) s).getChildren()) {
      ungroupSceneGraph(sp);
    }
  } else if (s instanceof Geometry) {
    Geometry g = (Geometry) s;
    if (g.isGrouped()) {
      // Will invoke onGeometryUnassociated automatically.
      g.unassociateFromGroupNode();
      if (InstancedNode.getGeometryStartIndex(g) != -1) {
        throw new AssertionError();
      }
    }
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
protected void updateWorldTransforms() {
  super.updateWorldTransforms();
  computeWorldMatrix();
  if (isGrouped()) {
    groupNode.onTransformChange(this);
  }
  // geometry requires lights to be sorted
  worldLights.sort(true);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

private void instance(Spatial n) {
  if (n instanceof Geometry) {
    Geometry g = (Geometry) n;
    if (!g.isGrouped() && g.getBatchHint() != BatchHint.Never) {
      addToInstancedGeometry(g);
    }
  } else if (n instanceof Node) {
    for (Spatial child : ((Node) n).getChildren()) {
      if (child instanceof GeometryGroupNode) {
        continue;
      }
      instance(child);
    }
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

if (!g.isGrouped() || rebatch) {
  if (g.getMaterial() == null) {
    throw new IllegalStateException("No material is set for Geometry: " + g.getName() + " please set a material before batching");

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
public Node clone(boolean cloneMaterials) {
  InstancedNode clone = (InstancedNode)super.clone(cloneMaterials);
  if (instancesMap.size() > 0) {
    // Remove all instanced geometries from the clone
    for (int i = 0; i < clone.children.size(); i++) {
      if (clone.children.get(i) instanceof InstancedGeometry) {
        clone.children.remove(i);
      } else if (clone.children.get(i) instanceof Geometry) {
        Geometry geom = (Geometry) clone.children.get(i);
        if (geom.isGrouped()) {
          throw new AssertionError();
        }
      }
    }
  }
  // remove original control from the clone
  clone.controls.remove(this.control);
  // put clone's control in
  clone.control = new InstancedNodeControl(clone);
  clone.controls.add(clone.control);
  clone.lookUp = new InstanceTypeKey();
  clone.igByGeom = new HashMap<Geometry, InstancedGeometry>();
  clone.instancesMap = new HashMap<InstanceTypeKey, InstancedGeometry>();
  clone.instance();
  return clone;
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Helper function used to recursively populate the outputGeometryList 
 * with geometry children of scene node
 * 
 * @param camera
 * @param scene
 * @param outputGeometryList 
 */
private static void addGeometriesInCamFrustumFromNode(Camera camera, Node scene, RenderQueue.ShadowMode mode, GeometryList outputGeometryList) {
  if (scene.getCullHint() == Spatial.CullHint.Always) return;
  camera.setPlaneState(0);
  if (camera.contains(scene.getWorldBound()) != Camera.FrustumIntersect.Outside) {
    for (Spatial child: scene.getChildren()) {
      if (child instanceof Node) addGeometriesInCamFrustumFromNode(camera, (Node)child, mode, outputGeometryList);
      else if (child instanceof Geometry && child.getCullHint() != Spatial.CullHint.Always) {
        camera.setPlaneState(0);
        if (checkShadowMode(child.getShadowMode(), mode) &&
            !((Geometry)child).isGrouped() &&
            camera.contains(child.getWorldBound()) != Camera.FrustumIntersect.Outside) {
         outputGeometryList.add((Geometry)child);
        }
      }
    }
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

if (checkShadowMode(scene.getShadowMode(), mode) && !((Geometry)scene).isGrouped() ) {
  outputGeometryList.add((Geometry)scene);

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

&& !occluder.isGrouped() && occluder.getWorldBound()!=null) {
BoundingVolume bv = occluder.getWorldBound();
BoundingVolume occBox = bv.transform(viewProjMatrix, vars.bbox);

代码示例来源:origin: org.jmonkeyengine/jme3-core

/**
 * @deprecated Use {@link #isGrouped()} instead.
 */
@Deprecated
public boolean isBatched() {
  return isGrouped();
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

/**
 * Sets the material to use for this geometry.
 *
 * @param material the material to use for this geometry
 */
@Override
public void setMaterial(Material material) {
  this.material = material;
  if (isGrouped()) {
    groupNode.onMaterialChange(this);
  }
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

@Override
public boolean checkCulling(Camera cam) {
  if (isGrouped()) {
    setLastFrustumIntersection(Camera.FrustumIntersect.Outside);
    return false;
  }
  return super.checkCulling(cam);
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

@Override
protected void setParent(Node parent) {
  super.setParent(parent);
  // If the geometry is managed by group node we need to unassociate.
  if (parent == null && isGrouped()) {
    unassociateFromGroupNode();
  }
}

相关文章