Init
This commit is contained in:
113
exchange/exchangesource/CreatePRCCubes/CreateTessellatedCubes.h
Normal file
113
exchange/exchangesource/CreatePRCCubes/CreateTessellatedCubes.h
Normal file
@@ -0,0 +1,113 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 by Tech Soft 3D, Inc.
|
||||
* The information contained herein is confidential and proprietary to Tech Soft 3D, Inc., and considered a trade secret
|
||||
* as defined under civil and criminal statutes. Tech Soft 3D shall pursue its civil and criminal remedies in the event
|
||||
* of unauthorized use or misappropriation of its trade secrets. Use of this information by anyone other than authorized
|
||||
* employees of Tech Soft 3D, Inc. is granted only under a written non-disclosure agreement, expressly prescribing the
|
||||
* scope and manner of such use.
|
||||
*
|
||||
***********************************************************************************************************************/
|
||||
/**
|
||||
* Sample CreatePRCCubes
|
||||
* file CreateTessellatedCubes.cpp
|
||||
* This file is containing the data and function used to create PRC Tessellation.
|
||||
*
|
||||
* fillCubeTessBaseData is filling the structure A3DTessBaseData
|
||||
* A3DTessBaseData is the structure containing the coordinates of the tessellation.
|
||||
*
|
||||
* fillCubeTessData is filling the structure A3DTess3DData
|
||||
* A3DTess3DData is the structure describing the coordinates from A3DTessBaseData
|
||||
* It contains indexes of vertex coordinates, wire frames coordinates, normals and textures coordinates.
|
||||
*
|
||||
*
|
||||
***********************************************************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include "CreatePRCCubesDef.h"
|
||||
|
||||
//######################################################################################################################
|
||||
//Cube tessellation data
|
||||
|
||||
static A3DDouble stCubePoints[24] = {
|
||||
-1, -1, 1,
|
||||
1, -1, 1,
|
||||
-1, 1, 1,
|
||||
1, 1, 1,
|
||||
-1, 1, -1,
|
||||
1, 1, -1,
|
||||
-1, -1, -1,
|
||||
1, -1, -1
|
||||
};
|
||||
|
||||
static A3DDouble stCubeNormals[18] = {
|
||||
1., 0., 0.,
|
||||
-1., 0., 0.,
|
||||
0., 1., 0.,
|
||||
0., -1., 0.,
|
||||
0., 0., 1.,
|
||||
0., 0., -1.
|
||||
};
|
||||
|
||||
static A3DDouble stCubeUV[8] = {
|
||||
0.0, 0.0,
|
||||
1.0, 0.0,
|
||||
0.0, 1.0,
|
||||
1.0, 1.0
|
||||
// U V
|
||||
};
|
||||
|
||||
#define ADD_FACE_COLOR
|
||||
|
||||
|
||||
static A3DUns32 stCubeFacesNormalPTrianglesUV[72] =
|
||||
{
|
||||
//72 buffer count
|
||||
// N, P, N, P, N, P, N, P, N, P, N, P
|
||||
12, 0, 12, 3, 12, 6, 12, 6, 12, 3, 12, 9, // Face 0
|
||||
6, 6, 6, 9, 6, 12, 6, 12, 6, 9, 6, 15, // Face 1
|
||||
15, 12, 15, 15, 15, 18, 15, 18, 15, 15, 15, 21, // ....
|
||||
9, 18, 9, 21, 9, 0, 9, 0, 9, 21, 9, 3,
|
||||
0, 3, 0, 21, 0, 9, 0, 9, 0, 21, 0, 15,
|
||||
3, 18, 3, 0, 3, 12, 3, 12, 3, 0, 3, 6, // Face N
|
||||
};
|
||||
|
||||
// N = normal index
|
||||
// U = UV index
|
||||
// P = point coordinates index
|
||||
static A3DUns32 stTexturedCubeFacesNormalPTrianglesUV[108] = {
|
||||
12, 0, 0, 12, 2, 3, 12, 4, 6, 12, 4, 6, 12, 2, 3, 12, 6, 9, //Face0
|
||||
6, 0, 6, 6, 2, 9, 6, 4, 12, 6, 4, 12, 6, 2, 9, 6, 6, 15, //Face1
|
||||
15, 6, 12, 15, 4, 15, 15, 2, 18, 15, 2, 18, 15, 4, 15, 15, 0, 21, //....
|
||||
9, 0, 18, 9, 2, 21, 9, 4, 0, 9, 4, 0, 9, 2, 21, 9, 6, 3,
|
||||
0, 0, 3, 0, 2, 21, 0, 4, 9, 0, 4, 9, 0, 2, 21, 0, 6, 15,
|
||||
3, 0, 18, 3, 2, 0, 3, 4, 12, 3, 4, 12, 3, 2, 0, 3, 6, 6 //FaceN
|
||||
/*
|
||||
N,U,P N,U,P N,U,P N,U,P N,U,P N,U,P Face 0
|
||||
\ first triangle / \ second triangle /
|
||||
N,U,P N,U,P N,U,P N,U,P N,U,P N,U,P Face 1
|
||||
N,U,P N,U,P N,U,P N,U,P N,U,P N,U,P Face 2
|
||||
N,U,P N,U,P N,U,P N,U,P N,U,P N,U,P ...
|
||||
N,U,P N,U,P N,U,P N,U,P N,U,P N,U,P Face N
|
||||
*/
|
||||
};
|
||||
|
||||
static A3DUns32 stCubeFacesWireframe[48] = {
|
||||
0, 3, 3, 9, 9, 6, 6, 0,/* Face 0 */
|
||||
6, 9, 9, 15, 15, 12, 12, 6,/* Face 1 */
|
||||
12, 15, 15, 21, 21, 18, 18, 12,/* .... */
|
||||
18, 21, 21, 3, 3, 0, 0, 18,
|
||||
3, 21, 21, 15, 15, 9, 9, 3,
|
||||
18, 0, 0, 6, 6, 12, 12, 18 /* Face N */
|
||||
/* E1 E2 E3 E4 edges */
|
||||
};
|
||||
|
||||
|
||||
//######################################################################################################################
|
||||
void fillCubeTessBaseData(A3DTessBaseData& sTessBaseData, A3DDouble cubeWidth, A3DDouble cubeHeight, A3DDouble cubeLength);
|
||||
void freeTessBaseData(A3DTessBaseData& sTessBaseData);
|
||||
|
||||
//######################################################################################################################
|
||||
void fillCubeTessData(A3DTess3DData& sTess3DData, A3DUns32* puiStyleIndex = NULL);
|
||||
void freeTess3DData(A3DTess3DData& sTess3DData);
|
||||
|
||||
Reference in New Issue
Block a user