teapot.java
来自「java 3d game jme 工程开发源代码」· Java 代码 · 共 920 行 · 第 1/5 页
JAVA
920 行
/*
* Copyright (c) 2003-2009 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.jme.scene.shape;
import com.jme.scene.TexCoords;
import com.jme.scene.TriMesh;
import com.jme.util.export.Savable;
import com.jme.util.geom.BufferUtils;
/**
* <code>Teapot</code> is the classical teapot model ready for you to use in
* jME! If you plan to texture this shape, use wrapmode WM_WRAP_S_WRAP_T.
*
* @author Joshua Slack
* @version $Id: Teapot.java,v 1.3 2007/09/21 15:45:27 nca Exp $
* @see "http://www.sjbaker.org/teapot/"
*/
public class Teapot extends TriMesh implements Savable {
private static final long serialVersionUID = 1L;
/**
* Instantiates a new <code>Teapot</code> object. All information must be
* applies later. For internal usage only
*/
public Teapot() {
super("teapot");
}
/**
* Constructor instantiates a new <code>Teapot</code> object.
*
* @param name
* the name of the scene element. This is required for
* identification and comparision purposes.
*/
public Teapot(String name) {
super(name);
updateGeometryData();
}
/**
* <code>clone</code> creates a new Teapot object containing the same data
* as this one.
*
* @return the new Teapot
*/
public Teapot clone() {
return new Teapot(getName() + "_clone");
}
/**
* sets up the data for the Teapot
* @deprecated Use {@link #updateGeometryData()} instead
*/
public void resetData() {
updateGeometryData();
}
/**
* <code>setIndexData</code> sets the indices into the list of vertices,
* defining all triangles that constitute the Teapot.
*/
private void setIndexData() {
int[] indices = {
0, 1, 2, 0, 2, 3, 4, 5, 1, 4, 1, 0, 6, 7, 5, 6, 5, 4,
8, 9, 7, 8, 7, 6, 10, 0, 3, 10, 3, 11, 12, 4, 0, 12, 0, 10, 13,
6, 4, 13, 4, 12, 14, 8, 6, 14, 6, 13, 15, 10, 11, 15, 11, 16,
17, 12, 10, 17, 10, 15, 18, 13, 12, 18, 12, 17, 19, 14, 13, 19,
13, 18, 20, 15, 16, 20, 16, 21, 22, 17, 15, 22, 15, 20, 23, 18,
17, 23, 17, 22, 24, 19, 18, 24, 18, 23, 25, 26, 27, 25, 27, 28,
29, 30, 26, 29, 26, 25, 31, 32, 30, 31, 30, 29, 33, 34, 32, 33,
32, 31, 35, 25, 28, 35, 28, 36, 37, 29, 25, 37, 25, 35, 38, 31,
29, 38, 29, 37, 39, 33, 31, 39, 31, 38, 40, 35, 36, 40, 36, 41,
42, 37, 35, 42, 35, 40, 43, 38, 37, 43, 37, 42, 44, 39, 38, 44,
38, 43, 45, 40, 41, 45, 41, 46, 47, 42, 40, 47, 40, 45, 48, 43,
42, 48, 42, 47, 49, 44, 43, 49, 43, 48, 50, 51, 52, 50, 52, 53,
54, 55, 51, 54, 51, 50, 56, 57, 55, 56, 55, 54, 58, 59, 57, 58,
57, 56, 60, 50, 53, 60, 53, 61, 62, 54, 50, 62, 50, 60, 63, 56,
54, 63, 54, 62, 64, 58, 56, 64, 56, 63, 65, 60, 61, 65, 61, 66,
67, 62, 60, 67, 60, 65, 68, 63, 62, 68, 62, 67, 69, 64, 63, 69,
63, 68, 70, 65, 66, 70, 66, 71, 72, 67, 65, 72, 65, 70, 73, 68,
67, 73, 67, 72, 74, 69, 68, 74, 68, 73, 75, 76, 77, 75, 77, 78,
79, 80, 76, 79, 76, 75, 81, 82, 80, 81, 80, 79, 83, 84, 82, 83,
82, 81, 85, 75, 78, 85, 78, 86, 87, 79, 75, 87, 75, 85, 88, 81,
79, 88, 79, 87, 89, 83, 81, 89, 81, 88, 90, 85, 86, 90, 86, 91,
92, 87, 85, 92, 85, 90, 93, 88, 87, 93, 87, 92, 94, 89, 88, 94,
88, 93, 95, 90, 91, 95, 91, 96, 97, 92, 90, 97, 90, 95, 98, 93,
92, 98, 92, 97, 99, 94, 93, 99, 93, 98, 100, 101, 102, 100,
102, 103, 104, 105, 101, 104, 101, 100, 106, 107, 105, 106,
105, 104, 108, 109, 107, 108, 107, 106, 110, 100, 103, 110,
103, 111, 112, 104, 100, 112, 100, 110, 113, 106, 104, 113,
104, 112, 114, 108, 106, 114, 106, 113, 115, 110, 111, 115,
111, 116, 117, 112, 110, 117, 110, 115, 118, 113, 112, 118,
112, 117, 119, 114, 113, 119, 113, 118, 120, 115, 116, 120,
116, 121, 122, 117, 115, 122, 115, 120, 123, 118, 117, 123,
117, 122, 124, 119, 118, 124, 118, 123, 125, 126, 127, 125,
127, 128, 129, 130, 126, 129, 126, 125, 131, 132, 130, 131,
130, 129, 133, 134, 132, 133, 132, 131, 135, 125, 128, 135,
128, 136, 137, 129, 125, 137, 125, 135, 138, 131, 129, 138,
129, 137, 139, 133, 131, 139, 131, 138, 140, 135, 136, 140,
136, 141, 142, 137, 135, 142, 135, 140, 143, 138, 137, 143,
137, 142, 144, 139, 138, 144, 138, 143, 145, 140, 141, 145,
141, 146, 147, 142, 140, 147, 140, 145, 148, 143, 142, 148,
142, 147, 149, 144, 143, 149, 143, 148, 150, 151, 152, 150,
152, 153, 154, 155, 151, 154, 151, 150, 156, 157, 155, 156,
155, 154, 158, 159, 157, 158, 157, 156, 160, 150, 153, 160,
153, 161, 162, 154, 150, 162, 150, 160, 163, 156, 154, 163,
154, 162, 164, 158, 156, 164, 156, 163, 165, 160, 161, 165,
161, 166, 167, 162, 160, 167, 160, 165, 168, 163, 162, 168,
162, 167, 169, 164, 163, 169, 163, 168, 170, 165, 166, 170,
166, 171, 172, 167, 165, 172, 165, 170, 173, 168, 167, 173,
167, 172, 174, 169, 168, 174, 168, 173, 175, 176, 177, 175,
177, 178, 179, 180, 176, 179, 176, 175, 181, 182, 180, 181,
180, 179, 183, 184, 182, 183, 182, 181, 185, 175, 178, 185,
178, 186, 187, 179, 175, 187, 175, 185, 188, 181, 179, 188,
179, 187, 189, 183, 181, 189, 181, 188, 190, 185, 186, 190,
186, 191, 192, 187, 185, 192, 185, 190, 193, 188, 187, 193,
187, 192, 194, 189, 188, 194, 188, 193, 195, 190, 191, 195,
191, 196, 197, 192, 190, 197, 190, 195, 198, 193, 192, 198,
192, 197, 199, 194, 193, 199, 193, 198, 200, 201, 202, 200,
202, 203, 204, 205, 201, 204, 201, 200, 206, 207, 205, 206,
205, 204, 208, 209, 207, 208, 207, 206, 210, 200, 203, 210,
203, 211, 212, 204, 200, 212, 200, 210, 213, 206, 204, 213,
204, 212, 214, 208, 206, 214, 206, 213, 215, 210, 211, 215,
211, 216, 217, 212, 210, 217, 210, 215, 218, 213, 212, 218,
212, 217, 219, 214, 213, 219, 213, 218, 220, 215, 216, 220,
216, 221, 222, 217, 215, 222, 215, 220, 223, 218, 217, 223,
217, 222, 224, 219, 218, 224, 218, 223, 225, 226, 227, 225,
227, 228, 229, 230, 226, 229, 226, 225, 231, 232, 230, 231,
230, 229, 233, 234, 232, 233, 232, 231, 235, 225, 228, 235,
228, 236, 237, 229, 225, 237, 225, 235, 238, 231, 229, 238,
229, 237, 239, 233, 231, 239, 231, 238, 240, 235, 236, 240,
236, 241, 242, 237, 235, 242, 235, 240, 243, 238, 237, 243,
237, 242, 244, 239, 238, 244, 238, 243, 245, 240, 241, 245,
241, 246, 247, 242, 240, 247, 240, 245, 248, 243, 242, 248,
242, 247, 249, 244, 243, 249, 243, 248, 250, 251, 252, 250,
252, 253, 254, 255, 251, 254, 251, 250, 256, 257, 255, 256,
255, 254, 258, 259, 257, 258, 257, 256, 260, 250, 253, 260,
253, 261, 262, 254, 250, 262, 250, 260, 263, 256, 254, 263,
254, 262, 264, 258, 256, 264, 256, 263, 265, 260, 261, 265,
261, 266, 267, 262, 260, 267, 260, 265, 268, 263, 262, 268,
262, 267, 269, 264, 263, 269, 263, 268, 270, 265, 266, 270,
266, 271, 272, 267, 265, 272, 265, 270, 273, 268, 267, 273,
267, 272, 274, 269, 268, 274, 268, 273, 275, 276, 277, 275,
277, 278, 279, 280, 276, 279, 276, 275, 281, 282, 280, 281,
280, 279, 283, 284, 282, 283, 282, 281, 285, 275, 278, 285,
278, 286, 287, 279, 275, 287, 275, 285, 288, 281, 279, 288,
279, 287, 289, 283, 281, 289, 281, 288, 290, 285, 286, 290,
286, 291, 292, 287, 285, 292, 285, 290, 293, 288, 287, 293,
287, 292, 294, 289, 288, 294, 288, 293, 295, 290, 291, 295,
291, 296, 297, 292, 290, 297, 290, 295, 298, 293, 292, 298,
292, 297, 299, 294, 293, 299, 293, 298, 300, 301, 302, 300,
302, 303, 304, 305, 301, 304, 301, 300, 306, 307, 305, 306,
305, 304, 308, 309, 307, 308, 307, 306, 310, 300, 303, 310,
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?