+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.proconf.g3d.base;\r
-\r
-import java.util.Collection;\r
-\r
-import org.simantics.layer0.utils.IEntity;\r
-import org.simantics.proconf.g3d.Resources;\r
-import org.simantics.proconf.g3d.stubs.Appearance;\r
-\r
-import com.jme.renderer.Renderer;\r
-import com.jme.scene.state.RenderState;\r
-\r
-public class DefaultAppearanceProvider implements AppearanceProvider {\r
- \r
- \r
-\r
- @Override\r
- public boolean canHandle(IEntity instance) {\r
- return instance.hasStatement(Resources.g3dResource.HasAppearance);\r
- }\r
- \r
- @Override\r
- public Collection<RenderState> getAppearanceFromResource(IEntity instance, Renderer renderer) {\r
- Collection<IEntity> appearanceResource;\r
- if ((appearanceResource = instance.getRelatedObjects(Resources.g3dResource.HasAppearance)) != null && appearanceResource.size() > 0) {\r
- return AppearanceTools.getAppearance(new Appearance(instance.getGraph(),appearanceResource.iterator().next().getResource()), renderer);\r
- }\r
- throw new RuntimeException("Given instance does not have Appearance definition!");\r
- }\r
-}\r