mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-27 06:34:11 +00:00
1dff24dbd0
It copies an entire hierarchy (minus actual entities, but I'm as yet unsure how to proceed with them), even across scenes as the source scene is irrelevant and the destination scene is used for creating the new transforms.
80 lines
2.1 KiB
C
80 lines
2.1 KiB
C
/*
|
|
hierarch.h
|
|
|
|
Hierarchy management
|
|
|
|
Copyright (C) 2021 Bill Currie <bill@taniwha.org>
|
|
|
|
Author: Bill Currie <bill@taniwha.org>
|
|
Date: 2021/02/26
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU General Public License
|
|
as published by the Free Software Foundation; either version 2
|
|
of the License, or (at your option) any later version.
|
|
|
|
This program 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 General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to:
|
|
|
|
Free Software Foundation, Inc.
|
|
59 Temple Place - Suite 330
|
|
Boston, MA 02111-1307, USA
|
|
|
|
*/
|
|
|
|
#ifndef __QF_scene_hierarch_h
|
|
#define __QF_scene_hierarch_h
|
|
|
|
#include "QF/darray.h"
|
|
#include "QF/qtypes.h"
|
|
#include "QF/scene/types.h"
|
|
#include "QF/simd/vec4f.h"
|
|
#include "QF/simd/mat4f.h"
|
|
|
|
/** \defgroup entity Hierarchy management
|
|
\ingroup utils
|
|
*/
|
|
///@{
|
|
|
|
#define null_transform (~0u)
|
|
|
|
typedef struct hierarchy_s {
|
|
struct hierarchy_s *next;
|
|
struct hierarchy_s **prev;
|
|
struct scene_s *scene;
|
|
xformset_t transform;
|
|
entityset_t entity;
|
|
uint32set_t childCount;
|
|
uint32set_t childIndex;
|
|
uint32set_t parentIndex;
|
|
stringset_t name;
|
|
uint32set_t tag;
|
|
byteset_t modified;
|
|
mat4fset_t localMatrix;
|
|
mat4fset_t localInverse;
|
|
mat4fset_t worldMatrix;
|
|
mat4fset_t worldInverse;
|
|
vec4fset_t localRotation;
|
|
vec4fset_t localScale;
|
|
vec4fset_t worldRotation;
|
|
vec4fset_t worldScale;
|
|
} hierarchy_t;
|
|
|
|
hierarchy_t *Hierarchy_New (struct scene_s *scene, int createRoot);
|
|
void Hierarchy_Reserve (hierarchy_t *hierarchy, uint32_t count);
|
|
hierarchy_t *Hierarchy_Copy (struct scene_s *scene, const hierarchy_t *src);
|
|
void Hierarchy_Delete (hierarchy_t *hierarchy);
|
|
|
|
void Hierarchy_UpdateMatrices (hierarchy_t *hierarchy);
|
|
uint32_t Hierarchy_InsertHierarchy (hierarchy_t *dst, const hierarchy_t *src,
|
|
uint32_t dstParent, uint32_t srcRoot);
|
|
void Hierarchy_RemoveHierarchy (hierarchy_t *hierarchy, uint32_t index);
|
|
///@}
|
|
|
|
#endif//__QF_scene_hierarch_h
|