📄 surface.java
字号:
/* * J3DME Fast 3D software rendering for small devices * Copyright (C) 2001 Onno Hommes * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */package net.jscience.j3dme;/** * This class implements the explicit geometry Surface. * The Surface geometry allows a model to be rendered as a flat surface. * The Surface class is extended from the Wireframe and therefor can also be rendered * as a Wireframe without any changes. The most obvious extensions on top of the * Wireframe definitions are the polygon array and the face normal offset. * The polygon array is used to set the boundaries of the surfaces of the gemoetry and the * facen normal offset points to the start of the normals in the coordinate stream. * Without further explaining it must be obvious that the coordinate stream not only contains * the vertices for the surface geometry but also the normal vetors of the surfaces. * All Surface normals must be unit vectors (i.e. vectors of length 1). This however must be * expressed with 8 bit fixed point integers. E.g. (0,256,0) is a unit vector (8 bits are * fraction). * @see Model * @see ViewPort * @see Wireframe */public class Surface extends Wireframe{ protected int normal_offset; protected int[] wires; protected int[] polygons_from; protected int[] polygons_to; /** Construct a new Surface Geometry * Set each of the surface parameters as provided. * * @param w The array representing the wire stream indices for the edges * @param p The array representing the polygon stream indices for the bounderies * @param s The array representing the surface stream bounded by the a polygon * @param o The array representing the normal index into the coordinate stream */ public Surface(int[] x,int[] y,int[] z, int[] wf,int[] wt,int[] ws, int[] pf,int[] pt,int o){ super(x,y,z,wf,wt); wires = ws; polygons_from = pf; polygons_to = pt; normal_offset = o; } /** * Returns the normal offset<p> * This method returns an index of type int into the coordinate stream. * The value indicates the place where the face normals start. * * @return The normal offset of the Surface. */ public int getNormalOffset(){ return normal_offset; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -