<commit_before>package org.concord.energy3d.model;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.concord.energy3d.scene.Scene;
import org.concord.energy3d.util.SelectUtil;

import com.ardor3d.extension.model.collada.jdom.ColladaAnimUtils;
import com.ardor3d.extension.model.collada.jdom.ColladaImporter;
import com.ardor3d.extension.model.collada.jdom.ColladaMaterialUtils;
import com.ardor3d.extension.model.collada.jdom.data.ColladaStorage;
import com.ardor3d.math.Vector3;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.BlendState;
import com.ardor3d.renderer.state.BlendState.TestFunction;
import com.ardor3d.scenegraph.Spatial;
import com.ardor3d.scenegraph.extension.BillboardNode;
import com.ardor3d.scenegraph.shape.Quad;
import com.ardor3d.util.resource.ResourceLocatorTool;
import com.ardor3d.util.resource.ResourceSource;

public class Tree extends HousePart {
	private static final long serialVersionUID = 1L;
	private static Spatial treeModel;
	private transient Spatial model;
	private transient BillboardNode billboard; 
	
	public static void loadModel() {
		new Thread() {
			@Override
			public void run() {
				System.out.print("Loading tree model...");
				Thread.yield();
				final ResourceSource source = ResourceLocatorTool.locateResource(ResourceLocatorTool.TYPE_MODEL, "tree.dae");
				final ColladaImporter colladaImporter = new ColladaImporter();
				Logger.getLogger(ColladaAnimUtils.class.getName()).setLevel(Level.SEVERE);
				Logger.getLogger(ColladaMaterialUtils.class.getName()).setLevel(Level.SEVERE);
				ColladaStorage storage;
				try {
					storage = colladaImporter.load(source);
					treeModel = storage.getScene();
				} catch (final IOException e) {
					e.printStackTrace();
				}
				System.out.println("done");
			}
		}.start();
	}
	
	public Tree() {
		super(1, 1, 1);
		init();
	}
	
	@Override
	protected void init() {
		super.init();
//		model = treeModel.makeCopy(true);
		
		mesh = new Quad("Tree Quad", 30, 30);
//		mesh.setRotation(new Matrix3().fromAngles(Math.PI / 2, 0, 0));		
//		final BlendState rs = new BlendState();
//		rs.setBlendEnabled(true);
//		rs.setTestEnabled(true);
//		mesh.getSceneHints().setRenderBucketType(RenderBucketType.Transparent);
		
		
        final BlendState bs = new BlendState();
        bs.setEnabled(true);
        bs.setBlendEnabled(false);
        bs.setTestEnabled(true);
        bs.setTestFunction(TestFunction.GreaterThan);
        bs.setReference(0.7f);		
        mesh.setRenderState(bs);
        mesh.getSceneHints().setRenderBucketType(RenderBucketType.Transparent);
		
        billboard = new BillboardNode("Billboard");
//        billboard.setAlignment(BillboardAlignment.AxialZ);
		billboard.attachChild(mesh);<commit_msg>Fix problem with Ardor3D billboard<commit_after>package org.concord.energy3d.model;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.concord.energy3d.scene.Scene;
import org.concord.energy3d.util.SelectUtil;

import com.ardor3d.extension.model.collada.jdom.ColladaAnimUtils;
import com.ardor3d.extension.model.collada.jdom.ColladaImporter;
import com.ardor3d.extension.model.collada.jdom.ColladaMaterialUtils;
import com.ardor3d.extension.model.collada.jdom.data.ColladaStorage;
import com.ardor3d.math.Matrix3;
import com.ardor3d.math.Vector3;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.BlendState;
import com.ardor3d.renderer.state.BlendState.TestFunction;
import com.ardor3d.scenegraph.Spatial;
import com.ardor3d.scenegraph.extension.BillboardNode;
import com.ardor3d.scenegraph.extension.BillboardNode.BillboardAlignment;
import com.ardor3d.scenegraph.shape.Quad;
import com.ardor3d.util.resource.ResourceLocatorTool;
import com.ardor3d.util.resource.ResourceSource;

public class Tree extends HousePart {
	private static final long serialVersionUID = 1L;
	private static Spatial treeModel;
	private transient Spatial model;
	private transient BillboardNode billboard; 
	
	public static void loadModel() {
		new Thread() {
			@Override
			public void run() {
				System.out.print("Loading tree model...");
				Thread.yield();
				final ResourceSource source = ResourceLocatorTool.locateResource(ResourceLocatorTool.TYPE_MODEL, "tree.dae");
				final ColladaImporter colladaImporter = new ColladaImporter();
				Logger.getLogger(ColladaAnimUtils.class.getName()).setLevel(Level.SEVERE);
				Logger.getLogger(ColladaMaterialUtils.class.getName()).setLevel(Level.SEVERE);
				ColladaStorage storage;
				try {
					storage = colladaImporter.load(source);
					treeModel = storage.getScene();
				} catch (final IOException e) {
					e.printStackTrace();
				}
				System.out.println("done");
			}
		}.start();
	}
	
	public Tree() {
		super(1, 1, 1);
		init();
	}
	
	@Override
	protected void init() {
		super.init();
//		model = treeModel.makeCopy(true);
		
		mesh = new Quad("Tree Quad", 30, 30);
		mesh.setRotation(new Matrix3().fromAngles(Math.PI / 2, 0, 0));		
		
        final BlendState bs = new BlendState();
        bs.setEnabled(true);
        bs.setBlendEnabled(false);
        bs.setTestEnabled(true);
        bs.setTestFunction(TestFunction.GreaterThan);
        bs.setReference(0.7f);		
        mesh.setRenderState(bs);
        mesh.getSceneHints().setRenderBucketType(RenderBucketType.Transparent);
		
        billboard = new BillboardNode("Billboard");
        billboard.setAlignment(BillboardAlignment.AxialZ);
		billboard.attachChild(mesh);
{'fraction_non_alphanumeric': 0.11692969870875179, 'fraction_numerical': 0.011836441893830704, 'mean_word_length': 4.3936170212765955, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '366158', 'n_tokens_mistral': 1994, 'n_tokens_neox': 1803, 'n_words': 299}