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

x33g5p2x  于2022-01-30 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(97)

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

Spatial.getNumControls介绍

暂无

代码示例

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

private static void dumpSpatialProperties( String indent, Spatial s ) {
  dumpProperties(indent, s, "children");
  if( !s.getUserDataKeys().isEmpty() ) {
    System.out.println(indent + "userData:");
    for( String key : s.getUserDataKeys() ) {
      System.out.println(indent + "  " + key + ":" + objectToString(s.getUserData(key)));
    }
  }
  if( s.getNumControls() > 0 ) {
    System.out.println(indent + "controls:");
    for( int i = 0; i < s.getNumControls(); i++ ) {
      Control ctl = s.getControl(i);
      //dump(indent + "  ", ctl);
      dumpObject(indent + "  ", ctl);
    }
  }
  LightList lights = s.getLocalLightList();
  if( lights.size() > 0 ) {
    System.out.println(indent + "lights:");
    for( Light l : lights ) {
      dumpObject(indent + "  ", l);
    }
  }
}

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

/**
 * adds an object to the physics space
 * @param obj the PhysicsControl or Spatial with PhysicsControl to add
 */
public void add(Object obj) {
  if (obj == null) return;
  if (obj instanceof PhysicsControl) {
    ((PhysicsControl) obj).setPhysicsSpace(this);
  } else if (obj instanceof Spatial) {
    Spatial node = (Spatial) obj;
    for (int i = 0; i < node.getNumControls(); i++) {
      if (node.getControl(i) instanceof PhysicsControl) {
        add(((PhysicsControl) node.getControl(i)));
      }
    }
  } else if (obj instanceof PhysicsCollisionObject) {
    addCollisionObject((PhysicsCollisionObject) obj);
  } else if (obj instanceof PhysicsJoint) {
    addJoint((PhysicsJoint) obj);
  } else {
    throw (new UnsupportedOperationException("Cannot add this kind of object to the physics space."));
  }
}

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

/**
 * Add the specified object to this space.
 *
 * @param obj the PhysicsControl, Spatial-with-PhysicsControl,
 * PhysicsCollisionObject, or PhysicsJoint to add (not null, modified)
 */
public void add(Object obj) {
  if (obj instanceof PhysicsControl) {
    ((PhysicsControl) obj).setPhysicsSpace(this);
  } else if (obj instanceof Spatial) {
    Spatial node = (Spatial) obj;
    for (int i = 0; i < node.getNumControls(); i++) {
      if (node.getControl(i) instanceof PhysicsControl) {
        add(((PhysicsControl) node.getControl(i)));
      }
    }
  } else if (obj instanceof PhysicsCollisionObject) {
    addCollisionObject((PhysicsCollisionObject) obj);
  } else if (obj instanceof PhysicsJoint) {
    addJoint((PhysicsJoint) obj);
  } else {
    throw (new UnsupportedOperationException("Cannot add this kind of object to the physics space."));
  }
}

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

/**
 * Remove the specified object from this space.
 *
 * @param obj the PhysicsCollisionObject to add, or null (modified)
 */
public void remove(Object obj) {
  if (obj == null) return;
  if (obj instanceof PhysicsControl) {
    ((PhysicsControl) obj).setPhysicsSpace(null);
  } else if (obj instanceof Spatial) {
    Spatial node = (Spatial) obj;
    for (int i = 0; i < node.getNumControls(); i++) {
      if (node.getControl(i) instanceof PhysicsControl) {
        remove(((PhysicsControl) node.getControl(i)));
      }
    }
  } else if (obj instanceof PhysicsCollisionObject) {
    removeCollisionObject((PhysicsCollisionObject) obj);
  } else if (obj instanceof PhysicsJoint) {
    removeJoint((PhysicsJoint) obj);
  } else {
    throw (new UnsupportedOperationException("Cannot remove this kind of object from the physics space."));
  }
}

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

/**
 * removes an object from the physics space
 *
 * @param obj the PhysicsControl or Spatial with PhysicsControl to remove
 */
public void remove(Object obj) {
  if (obj == null) return;
  if (obj instanceof PhysicsControl) {
    ((PhysicsControl) obj).setPhysicsSpace(null);
  } else if (obj instanceof Spatial) {
    Spatial node = (Spatial) obj;
    for (int i = 0; i < node.getNumControls(); i++) {
      if (node.getControl(i) instanceof PhysicsControl) {
        remove(((PhysicsControl) node.getControl(i)));
      }
    }
  } else if (obj instanceof PhysicsCollisionObject) {
    removeCollisionObject((PhysicsCollisionObject) obj);
  } else if (obj instanceof PhysicsJoint) {
    removeJoint((PhysicsJoint) obj);
  } else {
    throw (new UnsupportedOperationException("Cannot remove this kind of object from the physics space."));
  }
}

代码示例来源:origin: jMonkeyEngine-Contributions/Lemur

public static FocusTarget findFocusTarget( Spatial s ) {
  if( s == null )
    return null;
  for( int i = 0; i < s.getNumControls(); i++ ) {
    Control c = s.getControl(i);
    if( c instanceof FocusTarget )
      return (FocusTarget)c;
  }
  return null;
}

代码示例来源:origin: jMonkeyEngine-Contributions/Lemur

/**
 *  Utillity method to get the control for a spatial when we don't
 *  care if the interface implements control.
 */
protected static <T> T getControl( Spatial s, Class<T> type ) {
  if( s == null ) {
    return null;
  }
  for( int i = 0; i < s.getNumControls(); i++ ) {
    Object c = s.getControl(i);
    if( type.isInstance(c) )
      return type.cast(c);
  }
  return null;
}

代码示例来源:origin: net.sf.phat/phat-core

public static void printControls(Spatial spatial) {
  System.out.println("Controls of "+spatial.getName());
  for (int i = 0; i < spatial.getNumControls(); i++) {
    Control c = spatial.getControl(i);
    System.out.print("\t-" + c.getClass().getSimpleName());
    if (c instanceof AbstractControl) {
      System.out.println(" " + ((AbstractControl) c).isEnabled());
    } else if (c instanceof AbstractPhysicsControl) {
      System.out.println(" " + ((AbstractPhysicsControl) c).isEnabled());
    } else {
      System.out.println("");
    }
  }
  System.out.println("");
}

代码示例来源:origin: net.sf.phat/phat-core

public static void addAllPhysicsControls(Spatial spatial, BulletAppState bulletAppState) {
  for (int i = 0; i < spatial.getNumControls(); i++) {
    if (spatial.getControl(i) instanceof PhysicsControl) {
      bulletAppState.getPhysicsSpace().add(spatial.getControl(i));
    }
  }
}

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

/**
 * adds an object to the physics space
 *
 * @param obj the PhysicsControl or Spatial with PhysicsControl to add
 */
public void add(Object obj) {
  if (obj instanceof PhysicsControl) {
    ((PhysicsControl) obj).setPhysicsSpace(this);
  } else if (obj instanceof Spatial) {
    Spatial node = (Spatial) obj;
    for (int i = 0; i < node.getNumControls(); i++) {
      if (node.getControl(i) instanceof PhysicsControl) {
        add(((PhysicsControl) node.getControl(i)));
      }
    }
  } else if (obj instanceof PhysicsCollisionObject) {
    addCollisionObject((PhysicsCollisionObject) obj);
  } else if (obj instanceof PhysicsJoint) {
    addJoint((PhysicsJoint) obj);
  } else {
    throw (new UnsupportedOperationException("Cannot add this kind of object to the physics space."));
  }
}

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

/**
 * removes an object from the physics space
 *
 * @param obj the PhysicsControl or Spatial with PhysicsControl to remove
 */
public void remove(Object obj) {
  if (obj == null) return;
  if (obj instanceof PhysicsControl) {
    ((PhysicsControl) obj).setPhysicsSpace(null);
  } else if (obj instanceof Spatial) {
    Spatial node = (Spatial) obj;
    for (int i = 0; i < node.getNumControls(); i++) {
      if (node.getControl(i) instanceof PhysicsControl) {
        remove(((PhysicsControl) node.getControl(i)));
      }
    }
  } else if (obj instanceof PhysicsCollisionObject) {
    removeCollisionObject((PhysicsCollisionObject) obj);
  } else if (obj instanceof PhysicsJoint) {
    removeJoint((PhysicsJoint) obj);
  } else {
    throw (new UnsupportedOperationException("Cannot remove this kind of object from the physics space."));
  }
}

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

/**
 * adds an object to the physics space
 * @param obj the PhysicsControl or Spatial with PhysicsControl to add
 */
public void add(Object obj) {
  if (obj == null) return;
  if (obj instanceof PhysicsControl) {
    ((PhysicsControl) obj).setPhysicsSpace(this);
  } else if (obj instanceof Spatial) {
    Spatial node = (Spatial) obj;
    for (int i = 0; i < node.getNumControls(); i++) {
      if (node.getControl(i) instanceof PhysicsControl) {
        add(((PhysicsControl) node.getControl(i)));
      }
    }
  } else if (obj instanceof PhysicsCollisionObject) {
    addCollisionObject((PhysicsCollisionObject) obj);
  } else if (obj instanceof PhysicsJoint) {
    addJoint((PhysicsJoint) obj);
  } else {
    throw (new UnsupportedOperationException("Cannot add this kind of object to the physics space."));
  }
}

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

/**
 * removes an object from the physics space
 *
 * @param obj the PhysicsControl or Spatial with PhysicsControl to remove
 */
public void remove(Object obj) {
  if (obj == null) return;
  if (obj instanceof PhysicsControl) {
    ((PhysicsControl) obj).setPhysicsSpace(null);
  } else if (obj instanceof Spatial) {
    Spatial node = (Spatial) obj;
    for (int i = 0; i < node.getNumControls(); i++) {
      if (node.getControl(i) instanceof PhysicsControl) {
        remove(((PhysicsControl) node.getControl(i)));
      }
    }
  } else if (obj instanceof PhysicsCollisionObject) {
    removeCollisionObject((PhysicsCollisionObject) obj);
  } else if (obj instanceof PhysicsJoint) {
    removeJoint((PhysicsJoint) obj);
  } else {
    throw (new UnsupportedOperationException("Cannot remove this kind of object from the physics space."));
  }
}

相关文章

Spatial类方法