本文整理汇总了Java中hmi.util.Resources类的典型用法代码示例。如果您正苦于以下问题:Java Resources类的具体用法?Java Resources怎么用?Java Resources使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Resources类属于hmi.util包,在下文中一共展示了Resources类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: EmotionWheelPanel
import hmi.util.Resources; //导入依赖的package包/类
public EmotionWheelPanel()
{
try
{
String filename = "Humanoids/shared/mpeg4face/emotion_wheel_plutchik.png";
BufferedInputStream is = new Resources("").getInputStream(filename);
image = ImageIO.read(is);
}
catch (IOException exception)
{
exception.printStackTrace();
}
setPreferredSize(new Dimension(image.getWidth(), image.getHeight()));
setBorder(new LineBorder(new Color(0, 0, 0)));
addMouseMotionListener(this);
addMouseListener(this);
}
示例2: decodeAttributes
import hmi.util.Resources; //导入依赖的package包/类
public void decodeAttributes(HashMap<String, String> attrMap, XMLTokenizer tokenizer)
{
String resources = getRequiredAttribute("resources", attrMap, tokenizer);
String filename = getRequiredAttribute("filename", attrMap, tokenizer);
XMLPhonemeToVisemeMapping xmlmapping = new XMLPhonemeToVisemeMapping();
try
{
xmlmapping.readXML(new Resources(resources).getReader(filename));
}
catch (IOException e)
{
XMLScanException ex = new XMLScanException(e.getMessage());
ex.initCause(e);
throw ex;
}
mapping = xmlmapping;
}
示例3: loadShaderText
import hmi.util.Resources; //导入依赖的package包/类
/**
* Loads a shader text from file, and returns the shader program text.
* The shader is searched for inside a resource directory.
*/
public static String loadShaderText(Resources resources, String shaderName) {
BufferedReader br = resources.getReader(shaderName);
if (br == null) {
log.warn("GLSL: Could not find shader file: " + shaderName + " in resources: " + resources);
return null;
}
StringBuilder buf = new StringBuilder();
try {
String line = br.readLine();
while (line != null) {
buf.append(line);
buf.append('\n');
line = br.readLine();
}
return buf.toString();
} catch (IOException e) {
logger.error("GLSL.loadShaderText: " + e);
return null;
}
}
示例4: xmlTest0
import hmi.util.Resources; //导入依赖的package包/类
@Test
public void xmlTest0() throws IOException {
Resources res = new Resources("scenegraph");
Reader reader = res.getReader("gmaterial0.xml");
XMLTokenizer tokenizer = new XMLTokenizer(reader);
GMaterial gmat1 = new GMaterial(tokenizer);
String encoding = gmat1.toXMLString();
//System.out.println("gmat1:\n" + encoding);
XMLTokenizer tokenizer2 = new XMLTokenizer(encoding);
GMaterial gmat2 = new GMaterial(tokenizer2);
assertTrue(gmat2.getName() == "");
assertTrue(gmat2.getShader().equals(""));
assertTrue(gmat2.getShader() == "");
assertTrue(gmat2.getDiffuseColor()[0] == 0.0f);
assertTrue(gmat2.getDiffuseColor()[3] == 1.0f);
}
示例5: diffTest
import hmi.util.Resources; //导入依赖的package包/类
@Test
public void diffTest() throws IOException {
Resources res = new Resources("scenegraph");
Reader reader = res.getReader("gmaterial3.xml");
XMLTokenizer tokenizer = new XMLTokenizer(reader);
GMaterial gmat1 = new GMaterial(tokenizer);
String encoding = gmat1.toXMLString();
XMLTokenizer tokenizer2 = new XMLTokenizer(encoding);
GMaterial gmat2 = new GMaterial(tokenizer2);
String diff1 = gmat1.showDiff(gmat2);
//System.out.println("diff1=" + diff1);
assertTrue(diff1 == "");
gmat2.getDiffuseTexture().setImageFileName("XX");
String diff2 = gmat1.showDiff(gmat2);
//System.out.println("diff2=" + diff2);
assertTrue(diff2 != "");
}
示例6: binaryTest0
import hmi.util.Resources; //导入依赖的package包/类
@Test
public void binaryTest0() throws IOException {
Resources res = new Resources("scenegraph");
Reader reader = res.getReader("gmaterial0.xml");
XMLTokenizer tokenizer = new XMLTokenizer(reader);
GMaterial gmat1 = new GMaterial(tokenizer);
String tmpdir = System.getProperty("java.io.tmpdir");
// System.out.println("userdir=" + userdir + " tmpdir=" + tmpdir);
DataOutputStream dataOut = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(tmpdir+"/gmatbintest.dat")));
gmat1.writeBinary(dataOut);
dataOut.close();
DataInputStream dataIn = new DataInputStream(new BufferedInputStream(new FileInputStream(tmpdir+"/gmatbintest.dat")));
GMaterial gmat2 = new GMaterial();
gmat2.readBinary(dataIn);
dataIn.close();
assertTrue(gmat2.getName() == "");
assertTrue(gmat2.getShader() == "");
assertTrue(gmat2.getDiffuseColor()[0] == 0.0f);
assertTrue(gmat2.getDiffuseColor()[3] == 1.0f);
}
示例7: readTestFile
import hmi.util.Resources; //导入依赖的package包/类
protected String readTestFile(String filename) throws IOException
{
Resources res = new Resources(getTestDirectory());
BufferedReader reader = res.getReader(filename);
StringBuffer fileData = new StringBuffer(1000);
char[] buf = new char[1024];
int numRead = 0;
while ((numRead = reader.read(buf)) != -1)
{
String readData = String.valueOf(buf, 0, numRead);
fileData.append(readData);
buf = new char[1024];
}
reader.close();
return fileData.toString();
}
示例8: test
import hmi.util.Resources; //导入依赖的package包/类
@Test
public void test() throws IOException
{
float g[]={0,-9.8f,0};
loadDaeHuman();
Odejava.init();
PhysicalHumanoid ph = new OdeHumanoid("Armandia", new World(), new HashSpace());
MixedSystem m = new MixedSystem(g,ph);
MixedSystemAssembler msa = new MixedSystemAssembler(human,ph,m);
Resources res = new Resources("");
msa.readXML(res.getReader("mixedsystemtest/armandialowerbody.xml"));
}
示例9: EmotionConverter
import hmi.util.Resources; //导入依赖的package包/类
public EmotionConverter(Resources r, String filename)
{
loadRanges(r, filename);
for (AE ae : AE.values())
setPreferredProfile(ae, 0);
}
示例10: read
import hmi.util.Resources; //导入依赖的package包/类
/**
* Creates a new SkeletonInterpolator from an XML encoded file. The first argument must be a
* Resources object that determines the resource directory, whereas the seond argument must be
* the filename relative to the resource directory.
*/
public static SkeletonInterpolator read(Resources resources, String fileName) throws IOException
{
Reader reader = resources.getReader(fileName);
XMLTokenizer tk = new XMLTokenizer(reader);
SkeletonInterpolator ip = new SkeletonInterpolator(tk);
reader.close();
return ip;
}
示例11: Include
import hmi.util.Resources; //导入依赖的package包/类
public Include(Resources resources) {
this();
if (resources == null) {
logger.error("Collada include with null resources ");
}
this.resources = resources;
}
示例12: readFromResourceFile
import hmi.util.Resources; //导入依赖的package包/类
/**
* Like readFromStream, where the InputStream is obtained from the specified resource file.
*/
public static GLTexture readFromResourceFile(Resources resources, String resourceName, boolean rescale, boolean flip) throws IOException
{
currentFileName = resourceName;
InputStream is = resources.getInputStream(resourceName);
return readFromStream(is, rescale, flip, resourceName);
}
示例13: readShaderFromResourceFile
import hmi.util.Resources; //导入依赖的package包/类
/**
* Loads a shader text from file, and returns the shader program text. The shader is searched for inside a resources directory.
*/
private static String readShaderFromResourceFile(Resources resources, String shaderName)
{
BufferedReader br = resources.getReader(shaderName);
if (br == null)
{
logger.info("GLShaderProgramLoader: Could not find shader file: " + shaderName + " in resources: " + resources);
return null;
}
StringBuilder buf = new StringBuilder();
try
{
String line = br.readLine();
while (line != null)
{
buf.append(line);
buf.append('\n');
line = br.readLine();
}
return buf.toString();
}
catch (IOException e)
{
logger.error("GLShaderLoader.loadShaderText: " + e);
return null;
}
}
示例14: readFromResourceFile
import hmi.util.Resources; //导入依赖的package包/类
/**
* Loads a shader program, consisting of a vertex shader and a fragment shader, from two files, located within a resources directory. The vertex
* shader is supposed to be in a file with name shaderProgramName.vs, the fragment shader in shaderProgramName.fs The GLSL program handle is
* returned, or -1 when some error occurs.
*/
private static GLShaderProgram readFromResourceFile(Resources resources, String shaderProgramName)
{
String vstext = readShaderFromResourceFile(resources, shaderProgramName + ".vs");
String fstext = readShaderFromResourceFile(resources, shaderProgramName + ".fs");
if (vstext == null || fstext == null)
return null;
GLShaderProgram prog = new GLShaderProgram(shaderProgramName, vstext, fstext);
return prog;
}
示例15: loadShaderProgram
import hmi.util.Resources; //导入依赖的package包/类
/**
* Loads a shader program, consisting of a vertex shader and a fragment shader, from two files,
* located within a resources directory. The vertex shader is supposed to be in a file
* with name shaderProgramName.vs, the fragment shader in shaderProgramName.fs
* The GLSL program handle is returned, or -1 when some error occurs.
*/
public static int loadShaderProgram(GLRenderContext glc, Resources resources, String shaderProgramName) {
String vstext = loadShaderText(resources, shaderProgramName + ".vs");
if (vstext == null) return -1;
String fstext = loadShaderText(resources, shaderProgramName + ".fs");
if (fstext == null) return -1;
return createShaderProgram(glc, vstext, fstext);
}